Commit Graph

52 Commits

Author SHA1 Message Date
vitor-aignosi
aec5839b5e SIENTIAPDE-1314
Refactor OPC Write Test to Separate Output Data and Metrics

- Updated the test for the OPC write operation to separately assert output data and OPC metrics for improved clarity and accuracy in testing.
- Changed the variable names to reflect the new structure of the returned values from the write operation.
2025-10-24 10:59:48 -03:00
vitor-aignosi
c1a5ab3d3b SIENTIAPDE-1314
Update test_format_and_export_prediction.py to use prediction_data for workflow execution

- Replaced the mock return value with prediction_data in the test_run_none_path_flag function to ensure accurate testing of the workflow's data handling.
2025-10-23 17:55:35 -03:00
vitor-aignosi
0324e2e143 SIENTIAPDE-1314
Enhance OPC Metrics Handling and Refactor Write Operations

- Updated the OPC class to return response times for write operations, improving metrics tracking.
- Refactored the Gates activity to incorporate OPC metrics into the metrics writing process.
- Adjusted the manage_output_tags method in OpcRepository to return response times for each tag written.
- Modified tests to validate the new metrics structure and ensure correct behavior of the updated methods.
2025-10-23 17:48:43 -03:00
vitor-aignosi
c5fb921654 SIENTIAPDE-1312
Refactor error handling in MLFlowRepository and update tests

- Improved error message formatting in MLFlowRepository for better readability.
- Updated test assertions to ensure correct calls to MLflow methods during experiment retrieval and creation.
2025-10-21 15:58:28 -03:00
vitor-aignosi
461a885eeb SIENTIAPDE-1312
Refactor OPC handling by removing pod_id from initialization and updating logging format

- Removed pod_id parameter from OPC class and repository initialization to streamline connection management.
- Updated logging statements for improved readability during disconnection attempts and error handling.
2025-10-20 16:48:21 -03:00
vitor-aignosi
de47820c4a SIENTIAPDE-1231
Refactor tests and update model_repository.py for clarity and consistency

- Added a blank line in model_repository.py for improved readability.
- Adjusted formatting in test_mlflow.py to streamline assertions.
- Updated ensure_bucket_exists method tests in test_minio_repository.py to reflect the new return value of None instead of True.
2025-10-16 10:15:53 -03:00
vitor-aignosi
8ba646bb55 Merge branch 'main' into SIENTIAPDE-1231-ajustar-o-retreino-do-courier-no-laborious 2025-10-16 09:05:58 -03:00
vitor-aignosi
f0fb9b854e SIENTIAPDE-1231
Enhance validation script and refactor code in various modules

- Updated the validation script to include automatic code formatting and linting fixes using Ruff.
- Removed the `clean_tmp_files` method from the Gates class to streamline functionality.
- Simplified conditional checks in the OpcRepository for better clarity and error handling.
- Added model ID to the minimal retrain workflow for improved tracking.
- Introduced new test cases for error handling in MLFlow and storage operations, ensuring robustness in repository interactions.
2025-10-15 16:50:38 -03:00
vitor-aignosi
ac795c7c53 SIENTIAPDE-1231
Update .gitignore and refactor metrics.py for improved logging and consistency

- Added coverage.xml to .gitignore to prevent tracking of coverage reports.
- Refactored metric labels in metrics.py for consistency in string formatting and improved readability.
- Enhanced logging messages in various activities to ensure uniformity in message formatting.
2025-10-15 16:00:18 -03:00
vitor-aignosi
bb13c9a539 Update tests/laborious/activities/test_mlflow.py
Co-authored-by: codeant-ai[bot] <151821869+codeant-ai[bot]@users.noreply.github.com>
2025-09-24 13:07:29 -03:00
vitor-aignosi
bbae728e42 SIENTIAPDE-1222
Add placeholder class 'Any' in test_model_repository.py and update invalid_cases to use it

- Introduced a new placeholder class 'Any' to be used in test cases.
- Updated the 'invalid_cases' list to replace integer keys with instances of the 'Any' class, enhancing test coverage for key types.
2025-09-24 13:07:29 -03:00
vitor-aignosi
673fc79df3 SIENTIAPDE-1222
Refactor model configuration handling in MLFlow and workflows

- Replaced 'model_retention' with 'model_config' to encapsulate retention settings and improve consistency across various components.
- Updated test cases to reflect changes in argument structure, ensuring compatibility with the new model configuration format.
- Added 'prediction_store_policy' to input data handling in workflows for enhanced configuration management.
2025-09-24 13:07:29 -03:00
vitor-aignosi
73c8593993 SIENTIAPDE-1222
Update test cases in model repository and prediction process

- Replaced string data with MagicMock in test_transform_success and test_transform_error to improve test isolation.
- Updated the predict method calls in test_predict_success and test_predict_error to reflect changes in argument structure.
- Added 'prediction_store_policy' to the test_run configuration in test_prediction_process for consistency with recent updates.
2025-09-24 13:07:29 -03:00
vitor-aignosi
20fc938cc0 SIENTIAPDE-1222
Refactor datetime index handling in MLFlow and MLFlowRepository

- Moved the detect_and_parse_datetime_index method from MLFlow to MLFlowRepository for better organization and reusability.
- Updated the method to include enhanced logging and error handling for invalid datetime formats.
- Adjusted the transform method in MLFlowRepository to utilize the new datetime index parsing logic.
- Added unit tests for both valid and invalid datetime index cases to ensure robustness.
2025-09-24 13:07:29 -03:00
vitor-aignosi
4ebbb97de9 Update tests/laborious/activities/test_mlflow.py
Co-authored-by: codeant-ai[bot] <151821869+codeant-ai[bot]@users.noreply.github.com>
2025-09-24 10:30:23 -03:00
vitor-aignosi
d6c34dcaf7 SIENTIAPDE-1222
Add placeholder class 'Any' in test_model_repository.py and update invalid_cases to use it

- Introduced a new placeholder class 'Any' to be used in test cases.
- Updated the 'invalid_cases' list to replace integer keys with instances of the 'Any' class, enhancing test coverage for key types.
2025-09-24 09:59:26 -03:00
vitor-aignosi
84c1371d6c SIENTIAPDE-1222
Refactor model configuration handling in MLFlow and workflows

- Replaced 'model_retention' with 'model_config' to encapsulate retention settings and improve consistency across various components.
- Updated test cases to reflect changes in argument structure, ensuring compatibility with the new model configuration format.
- Added 'prediction_store_policy' to input data handling in workflows for enhanced configuration management.
2025-09-17 16:02:54 -03:00
vitor-aignosi
b2ef523c3b SIENTIAPDE-1222
Update test cases in model repository and prediction process

- Replaced string data with MagicMock in test_transform_success and test_transform_error to improve test isolation.
- Updated the predict method calls in test_predict_success and test_predict_error to reflect changes in argument structure.
- Added 'prediction_store_policy' to the test_run configuration in test_prediction_process for consistency with recent updates.
2025-09-17 10:07:32 -03:00
vitor-aignosi
2075b30243 SIENTIAPDE-1222
Refactor datetime index handling in MLFlow and MLFlowRepository

- Moved the detect_and_parse_datetime_index method from MLFlow to MLFlowRepository for better organization and reusability.
- Updated the method to include enhanced logging and error handling for invalid datetime formats.
- Adjusted the transform method in MLFlowRepository to utilize the new datetime index parsing logic.
- Added unit tests for both valid and invalid datetime index cases to ensure robustness.
2025-09-17 08:59:12 -03:00
vitor-aignosi
8ab1b9b437 SIENTIAPDE-1182
Refactor test data structure in gates.py and model_repository.py for improved clarity and consistency

- Updated test cases in test_gates.py to use dictionaries for prediction and response_time, associating values with timestamps.
- Modified test_predict_success in test_model_repository.py to create a DataFrame with named indices for better readability in assertions.
2025-09-04 12:16:14 -03:00
vitor-aignosi
30c1d6746a SIENTIAPDE-1182
Implement prediction store policy handling in Gates activity

- Added a new method `get_prediction_store_policy` to validate and parse the prediction store policy.
- Updated `format_prediction` method to utilize the new policy handling, allowing for sorting of predictions based on the specified policy.
- Enhanced test coverage for the new policy handling, including various scenarios for valid and invalid policies.
- Removed the obsolete `coverage.sh` script.
2025-08-28 16:31:55 -03:00
vitor-aignosi
7f3ecc9add SIENTIAPDE-1205
Refactor OpcRepository and update tests for async handling

- Removed the shutdown method from OpcRepository and adjusted the disconnect logic.
- Updated tests in test_activities.py and test_opc.py to support async shutdown functionality.
- Enhanced test cases in test_opc_repository.py to ensure proper async behavior and error handling in OpcRepository methods.
2025-08-28 14:39:00 -03:00
vitor-aignosi
8f8859aaa6 SIENTIAPDE-1193
Enhance test cases by adding 'datetime_columns' to input data for MinimalRetrain and PredictionsBatch workflows. This improves metadata handling in asynchronous tests.
2025-08-25 09:11:52 -03:00
vitor-aignosi
ae6d28df54 SIENTIAPDE-1193
Update Gates activity and format_and_export_prediction workflow to use DATETIME_FORMAT_WITH_TZ for consistent timestamp handling

- Modified Gates activity to correctly handle the maximum timestamp without formatting it prematurely.
- Updated format_and_export_prediction workflow to utilize DATETIME_FORMAT_WITH_TZ for timestamp conversion.
- Enhanced tests to ensure timestamp conversion is applied consistently across workflows.
2025-08-22 14:17:54 -03:00
vitor-aignosi
a3b642dbef SIENTIAPDE-1199
Update tests in Gates and OpcRepository to enhance logging and include metadata

- Removed unnecessary debug assertion in the Gates activity test for format prediction.
- Updated the test for last timestamp with no data to include a metadata dictionary.
- Modified OpcRepository tests to utilize custom_error logging with metadata for improved error context.
2025-08-21 08:56:22 -03:00
vitor-aignosi
89384d7783 SIENTIAPDE-1199
Update test for validate_connection method in OpcRepository to include detailed response structure

- Modified the test case to assert the response format when the connection is lost, ensuring it includes notification ID, message, block, and level attributes for better clarity in error handling.
2025-08-19 16:42:48 -03:00
vitor-aignosi
fc6c95c264 SIENTIAPDE-1169
Refactor OPC data writing and repository initialization

- Simplified success tracking logic in the OPC class for writing prediction and confidence data.
- Removed unused pod_id attribute from OpcRepository initialization.
- Updated test cases to include pod_id for improved metrics tracking during data writing operations.
2025-08-19 08:31:58 -03:00
vitor-aignosi
dd513ddfaf SIENTIAPDE-1174
Add async test for write_metrics method in gates_activity

- Implemented a new test to validate the write_metrics functionality, ensuring metrics are correctly recorded for predictions, confidence, and response time.
- Utilized mocking to verify interactions with the metrics tracking system.
2025-08-05 14:39:02 -03:00
vitor-aignosi
fbdf9c3c6c SIENTIAPDE-1174
SIENTIAPDE-1174 Update tests to enhance MLFlow and workflow activity assertions

- Added logger initialization in MLFlowRepository for improved logging.
- Updated prediction test assertions to reflect changes in output structure.
- Increased activity method call count assertions in workflow tests for accuracy.
2025-08-05 14:19:56 -03:00
vitor-aignosi
c9dc00fd08 SIENTIAPDE-1172
Update GITHUB_BRANCH in values.yaml and enhance error notification handling in MLFlow

- Changed GITHUB_BRANCH in values.yaml to reflect the new pipeline for alerts orchestration.
- Added NotificationLevel.ERROR to error notifications in MLFlow for retraining and production model updates.
- Updated tests to verify error notification levels for model management workflows.
2025-07-29 12:45:28 -03:00
vitor-aignosi
c738e8b0df SIENTIAPDE-1171
Refactor model_repository and enhance test coverage for MLFlow functionalities

- Updated model_repository to ensure the 'temp' directory is created if it doesn't exist using `exist_ok=True`.
- Added new tests for retraining and updating production models, including error handling scenarios.
- Improved existing tests for model management workflows to ensure robustness and reliability.
2025-07-24 10:24:08 -03:00
vitor-aignosi
4283730e7a SIENTIAPDE-1171
Update GITHUB_BRANCH in values.yaml and refactor MLFlowRepository for model retraining

- Changed GITHUB_BRANCH in values.yaml to reflect the new pipeline for retraining.
- Refactored MLFlowRepository by introducing create_model_experiment and perform_model_retrain methods to streamline model retraining processes.
- Updated test cases to cover new functionalities and ensure proper error handling in model management workflows.
2025-07-23 16:51:33 -03:00
vitor-aignosi
b440c7d547 SIENTIAPDE-1163
SIENTIAPDE-1163 Enhance OPC tests to improve error handling and notifications. Added tests for MongoDB configuration and refined connection error handling in OPC repository.
2025-07-17 15:21:10 -03:00
vitor-aignosi
50e6479c49 SIENTIAPDE-1110
Refactor notification handling in Gates and OPC activities to use send_notification method with metadata integration, enhancing error reporting and traceability.
2025-07-04 15:19:14 -03:00
vitor-aignosi
cefef0b1e9 SIENTIAPDE-1110
Enhance MLFlow activity to sort data by created_at and remove duplicates; update tests to reflect changes
2025-06-25 15:33:31 -03:00
vitor-aignosi
781e3a43bb SIENTIAPDE-1102
Refactor OPC activity to enhance data writing and confidence processing; update tests accordingly
2025-06-12 14:57:18 -03:00
vitor-aignosi
7c4f3936e8 SIENTIAPDE-1100
Add test for handling invalid data type in write_data method
2025-06-12 09:14:15 -03:00
vitor-aignosi
1057db1d73 SIENTIAPDE-1100
Improve error handling in OPC activities; raise exceptions instead of logging errors and add data type validation in OpcRepository
2025-06-12 09:06:31 -03:00
vitor-aignosi
948fecc444 SIENTIAPDE-1097
Refactor filter configuration keys from 'POLICY' to 'policy' for consistency
2025-06-10 11:51:27 -03:00
vitor-aignosi
5326051714 SIENTIAPDE-1094
Refactor activity imports and remove unused base and logger files; update requirements for library versioning
2025-06-09 11:08:07 -03:00
vitor-aignosi
cfb217963b SIENTIAPDE-994
Add shutdown tests for Activities and OPC classes; improve test assertions
2025-05-28 09:24:16 -03:00
vitor-aignosi
01823554e0 test and coverage fixes 2025-05-26 12:25:21 -03:00
vitor-aignosi
7600d22a61 Merge branch 'main' into SIENTIAPDE-994-implementar-os-workflows-mapeados-utilizando-as-workers-e-activities-apropriadas 2025-05-26 12:19:35 -03:00
vitor-aignosi
09c0fc4043 fix 2025-05-26 12:09:07 -03:00
vitor-aignosi
ad00661516 SIENTIAPDE-994
Refactor tests for Postgres activities and improve error handling

- Updated test_postgres.py to enhance the testing of load_custom_query method, including cases for None data and date conversion.
- Refactored repeat_last_prediction tests to use mocks for SQLAlchemy session execution.
- Added tests for export_data_to_postgres method, covering both success and error scenarios.
- Improved the initialization tests for Activities class to ensure proper instantiation of dependencies.
- Enhanced test coverage for OPC repository connection validation.
- Updated tests for prediction workflows to streamline input handling and improve clarity.
- Introduced tests for connectors configuration to validate environment variable handling for MLFlow, OPC, and Postgres.
- Added tests for logger utility to ensure default settings are correctly applied.
2025-05-26 11:22:50 -03:00
vitor-aignosi
67fe4afaa6 SIENTIAPDE-994
Refactor and enhance the laborious workflow and utilities

- Removed outdated test file `test_predictions_batch.py` from workflows.
- Added `input_sample.json` for standardized input configuration.
- Introduced `connectors_config.py` to manage database and service configurations.
- Implemented a logging utility in `logger.py` for consistent logging across the application.
- Created `policies.py` to define retry policies for workflows.
- Developed comprehensive tests for `MLFlowRepository` in `test_model_repository.py`.
- Added extensive tests for `OpcRepository` in `test_opc_repository.py`.
- Updated `test_predictions_batch.py` to reflect new workflow structure and testing methodology.
2025-05-23 17:34:47 -03:00
Bruno Domingues
77b3859be1 Add quality gate workflow 2. 2025-05-14 17:19:05 -03:00
vitor-aignosi
d22545ba88 SIENTIAPDE-994
Finishing base pipelines, preparing to testing
2025-05-12 14:50:20 -03:00
vitor-aignosi
eb6d2dd79c SIENTIAPDE-994
Implement new get_last_timestamp method in Gates class, refactor MLFlow activity methods to return only transformed data, and update PredictionsBatch and PredictionProcess workflows to utilize Activities module. Add detailed docstrings for new methods and enhance test coverage for get_last_timestamp functionality.
2025-05-12 11:36:21 -03:00
vitor-aignosi
d09fb6ac5e SIENTIAPDE-994
Refactor activity methods and update requirements.txt to enhance functionality and remove deprecated filters. Added detailed docstrings for clarity and improved error handling in data processing workflows.
2025-05-09 16:27:57 -03:00