Commit Graph

19 Commits

Author SHA1 Message Date
Eduardo Rios
f79d51336f fix: remove timestamp normalization instead of gating it by max_count
Review feedback (Vitor): gating the batch-max normalization behind
max_count == 1 just hid the same collapsing behavior for the single-point
case, where it's redundant anyway (aggregation/export don't need it) while
still being the wrong fix conceptually. Removed the normalization block
entirely so every record always keeps its own real timestamp from the PI
Web API, regardless of max_count.

Updated unit tests accordingly and confirmed no e2e scenario needs
adjustment: aggregate_data groups by (tag, name) and always collapses to
one output row per tag per execution, independent of per-record timestamp
values, so pi_web_api_scouter_multiple_tags' aggregated-value assertions
are unaffected.

SIENTIAPDE-1993

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 16:05:37 -03:00
Eduardo Rios
fc3660433f fix: preserve real timestamps in get_tag_values when max_count > 1
Timestamp normalization in API.get_tag_values previously overwrote all
records with the batch's maximum timestamp regardless of max_count.
With max_count > 1, this collapsed distinct historical points for the
same tag onto a single timestamp, causing them to collide on the
(model_id, timestamp, variable) unique constraint and get silently
dropped via ON CONFLICT DO NOTHING.

Normalization is now only applied when max_count == 1, which is the
only case where it is meaningful (aligning minor sampling differences
across tags for a single point each).

SIENTIAPDE-1993

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 14:08:15 -03:00
34dbc886f3 SIENTIAPDE-1646
Update project configuration and dependencies

- Added .mypy_cache and .cursor to .gitignore.
- Changed asyncio_default_fixture_loop_scope and asyncio_default_test_loop_scope to "session" in pyproject.toml.
- Updated e2e testing dependencies in requirements-dev.txt, replacing fakeredis and mongomock with pytest-httpserver.
- Updated requirements.txt to use sientia_do instead of a specific git commit.
- Modified sonar-project.properties to remove a file from coverage exclusions.
- Enhanced E2E test fixtures in e2e/conftest.py for better container management.
- Cleaned up e2e test files related to CoreScouter and PIWebAPIScouter workflows.
2026-05-25 12:58:03 -03:00
c8b287ecdd SIENTIAPDE-1478
Add headers configuration to API class for improved request handling
2026-01-27 11:43:46 -03:00
cf367f2319 SIENTIAPDE-1478
Enhance API class to format timestamps correctly and improve logging. Update test cases to include 'end_time' parameter for better data retrieval flexibility.
2026-01-23 10:40:30 -03:00
fb4bef317d SIENTIAPDE-1478
Remove unused import for DATETIME_FORMAT_WITH_TZ in API class to streamline code and improve readability.
2026-01-23 10:10:52 -03:00
e64af1aa7c SIENTIAPDE-1478
Update tests.ipynb and API class in scouter module

- Reset execution counts in tests.ipynb for reproducibility.
- Removed unnecessary outputs and adjusted execution counts for clarity.
- Enhanced API class to accept 'end_time' parameter for improved data retrieval flexibility.
- Commented out timestamp formatting and normalization for future adjustments.
2026-01-21 15:38:22 -03:00
9dab8da5b3 SIENTIAPDE-1478
Refactor API class to remove unnecessary blank line and improve code readability. Update test cases to rename 'timeout' parameter to 'request_timeout' for consistency.
2026-01-19 10:11:36 -03:00
efeb29414e SIENTIAPDE-1478
Refactor timestamp normalization in API class to handle NaN values correctly by dropping them before calculating the maximum timestamp.
2026-01-12 12:38:59 -03:00
0bc8b55a3d SIENTIAPDE-1478
Enhance API class logging by adding debug statement for latest values retrieval
2026-01-12 12:34:28 -03:00
9ca7c43b2b SIENTIAPDE-1478
Refactor API class to rename 'timeout' parameter to 'request_timeout' for improved clarity and consistency.
2026-01-12 12:27:26 -03:00
4352c67f3a SIENTIAPDE-1478
Enhance PI Web API Scouter Workflow and Documentation

- Added support for PI Web API data ingestion, including real-time and historical data retrieval.
- Implemented timestamp normalization to ensure consistency across records.
- Updated README.md to reflect new features and detailed workflow execution flow.
- Enhanced API class with comprehensive error handling and cleanup operations.
- Improved CoreScouter workflow with early exit conditions and detailed processing steps.
- Updated configuration parameters for better clarity and usability.
2026-01-09 09:49:55 -03:00
f2b648ead2 SIENTIAPDE-1478
Refactor metrics and imports across multiple files

- Removed unused import of CORE_LABELS in metrics.py.
- Updated import statements in api.py for consistency.
- Cleaned up import order in worker.py for better readability.
- Added missing newline at the end of metrics.py.
- Adjusted formatting in core_scouter.py to ensure proper syntax.
- Removed redundant 'on_conflict' and 'unique_columns' keys from test cases in test_core_scouter.py for clarity.
2026-01-08 16:20:10 -03:00
cf7f9fb63c SIENTIAPDE-1478
Refactor PIWebAPIClient and Update Configuration Imports

- Removed outdated PostgreSQL, Redis, MongoDB, and API configuration functions from connectors_config.py.
- Deleted the pi_web_api_client.py file as part of the refactor.
- Updated imports in worker.py and api.py to use the new repository structure.
- Cleaned up scenarios.md by removing obsolete scenarios related to unique constraint violations.
- Commented out the specific version of the sientia-dataops-library in requirements.txt for flexibility.
2026-01-08 12:41:53 -03:00
d9fbd132ef SIENTIAPDE-1445
Update debug logging in API class to display latest values as a string for improved readability.
2025-12-23 11:26:09 -03:00
bcc4e6de6d SIENTIAPDE-1445
Normalize package timestamp in API class to ensure consistent data handling.
2025-12-19 16:32:08 -03:00
3bd44bb12b SIENTIAPDE-1445
Refactor imports and enhance timestamp handling in API and test files

- Removed redundant import statements in api.py and prepare_worker.py for cleaner code.
- Updated timestamp format in test cases to include timezone information for consistency.
- Adjusted test configurations to align with new API structure for improved accuracy in data handling.
2025-12-18 09:36:13 -03:00
23e6890692 SIENTIAPDE-1445
Enhance PI Web API integration and update test configurations

- Adjusted execution counts in tests.ipynb for better notebook state management.
- Introduced a new pi_web_api_query structure in tests.ipynb for improved API configuration.
- Updated API class to format timestamps using DATETIME_FORMAT_WITH_TZ.
- Refactored PIWebAPIClient to ensure correct web ID retrieval and emit metrics accurately.
- Streamlined workflow parameters in pi_web_api_scouter.py for clarity and flexibility.
2025-12-18 09:06:11 -03:00
e87c5d2da6 SIENTIAPDE-1445
Enhance Activities and API Integration

- Updated Activities class to include API operations for external data ingestion.
- Added API configuration builder to connectors_config.py for environment variable management.
- Integrated API configuration into worker setup.
- Expanded unit tests to cover new API functionality and configuration handling.
- Updated requirements.txt to include pycurl and prometheus-client for enhanced metrics support.
2025-12-17 15:16:00 -03:00