Skip to content

LINKS : REFACTO#68

Open
berthetclement wants to merge 27 commits into
mainfrom
links/refacto
Open

LINKS : REFACTO#68
berthetclement wants to merge 27 commits into
mainfrom
links/refacto

Conversation

@berthetclement
Copy link
Copy Markdown
Collaborator

@berthetclement berthetclement commented Apr 30, 2026

HVDC will be treated now in this bloc part

  • add links input files (.csv format)
  • parsing transfer links.csv
    • pre filtering
  • parsing index + time series
    • mapping
  • compute median by index for time series
  • treatments + build pegase data frame + export

Remove all old files concerning LINKS/conf/tests

- Added `LinksParser` class for parsing and filtering links data based on scenarios and year ranges.
- Implemented new utility function `filter_based_on_year_range`.
- Introduced new constants in `constants.py` to support links data parsing.
- Added unit tests covering nominal cases, edge cases, and export validations.
- Included sample input files for testing links processing.
…x mapping

- Added `TimeSeriesMedianValues` and `InternalMapping` dataclasses to model median values and index mapping.
- Introduced NTC median repartition computation for grouped data using peak labels.
- Added index parsing and mapping logic for transfer links.
- Refactored `_filter_based_on_ntc` to `_filter_based_on_transfer_type` for better clarity.
- Updated `build_links` to integrate new index and median repartition processing.
…ng logic

- Added new HVDC link types in `constants.py` for more detailed categorization.
- Introduced `_add_links_code_antares_column`, `_filter_non_declared_links_areas`, and `_filter_duplicate_market` methods in `LinksParser` to improve filtering logic.
- Refactored NTC median computation with grouped medians and better type annotations.
- Enhanced `MainParams` to support mapping links market codes to Antares codes.
- Updated links building logic to incorporate new parsing, filtering, and aggregation features.
- Adjusted `LinksColumnsNames` and other supporting structures to align with new features.
…d HVDC handling

- Added `AggregatedValues` for representing detailed HVDC and NTC aggregated metrics.
- Implemented `_get_profile_values` for computing and normalizing link profiles.
- Enhanced `_select_links_profile` for granular aggregation by market zones and directions.
- Updated `build_links` to integrate the enhanced aggregation logic.
- Cleaned up unused code and improved type annotations.
- update constants for output
- add method to utils to transform int date year
- add new export link part
- update constants
- write excel file with pandas (to ensure business format)
- add test nominal cases
@berthetclement berthetclement self-assigned this May 15, 2026
- Introduced `has_curve` attribute in `AggregatedValues` to track curve presence.
- Added `selection_priority` property to enhance sorting by curve presence and reference capacity.
- Updated link aggregation and selection logic to utilize the new `selection_priority`.
- Adjusted tests and expected output to reflect changes in link selection criteria.
…sistency

- Updated HVDC constant names in `constants.py` to align with new naming conventions (`_MW_` and `_FO_Rate_`).
- Adjusted related test output files to reflect changes.
… logic

- Introduced `mean_strict_positive` utility function to compute the mean of strictly positive values.
- Updated HVDC aggregation logic in `parsing.py` to use `mean_strict_positive` for `hvdc_for`.
- Adjusted expected output file to reflect changes in aggregation calculations.
Comment thread src/antares/data_collection/links/constants.py
Comment thread src/antares/data_collection/referential_data/main_params.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/utils.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
- Replaced `Literal`-based `Direction` with `StrEnum`.
- Added new season and hour constants (`WINTER_SEASON`, `SUMMER_SEASON`, `HOUR_PEAK`, `HOUR_OFFPEAK`).
- Refactored `_filter_based_on_year_range` and moved related logic from `utils.py` to `parsing.py`.
- Updated `_filter_duplicate_market` to `_filter_duplicate_market_zone` for better clarity.
- Simplified links filtering and aggregation methods, removing unused utility functions.
- Enhanced year transformation logic with `_transform_year_to_straddling_year`.
- Deleted outdated `tools`, `conf`, and `links` modules from `src/antares/data_collection`.
- Removed associated test files (`test_conf_tools.py`, `test_create_xlsx_workbook.py`).
- Cleaned up unused logic related to links data processing and exports.
# Conflicts:
#	src/antares/data_collection/__init__.py
- Replaced `_filter_non_declared_links_areas` with the new `filter_non_declared_areas` utility for area filtering.
- Streamlined antares code retrieval by removing unused methods (`get_links_antares_code`, `get_links_antares_codes`) and redundant attributes (`_links_market_to_antares`).
- Adjusted relevant logic in `MainParams` (sheet LINKS removed) and `LinksParser` to reflect these changes.
… logic

- Expanded `selection_priority` to include HVDC-related attributes for improved sorting.
- Refined HVDC aggregation with better handling of `hvdc_for` and `NA` values.
- Simplified `_mean_strict_positive` naming and logic for clarity.
- Improved link selection logic to prioritize curve presence and capacity.
…omments

- Eliminated the commented-out `discrim_profil` function to declutter code.
- Removed redundant test variable and outdated comments for clearer implementation.
# Conflicts:
#	tests/antares/resources/MAIN_PARAMS_2025.xlsx
update PEMMDB_LINK.xlsx in expected output files
Comment thread src/antares/data_collection/referential_data/main_params.py
Comment thread src/antares/data_collection/referential_data/main_params.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
Comment thread src/antares/data_collection/links/parsing.py Outdated
…nt code

- Unified the structure of tests for hour and month column validations, improving parameterization for better readability and maintainability.
- Removed deprecated and unused methods `get_peak_hours_label` and `get_peak_months_label` from `MainParams`.
- Updated parsing logic for `PeakParamsColumnsNames` to check for exact hour and month ranges, replacing generic range checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants