Skip to content

Mapping driven metadata (for solar and wind)#54

Open
dylanjmcconnell wants to merge 10 commits into
mainfrom
map-driven-parsing
Open

Mapping driven metadata (for solar and wind)#54
dylanjmcconnell wants to merge 10 commits into
mainfrom
map-driven-parsing

Conversation

@dylanjmcconnell

Copy link
Copy Markdown
Member

Mapping-driven metadata for solar and wind trace parsing. File stems are looked up in mappings/2024/resources.yaml (instead of reverse-engineered from filenames via regex).

(Demand parsing unchanged - seperate PR, coming next I think).

Changes

  • New resource_trace_metadata.build() for building metadata dict
  • solar_traces.py / wind_traces.py use it instead of the regex extractors.
  • extract_solar_trace_metadata / extract_wind_trace_metadata and their tests deleted (demand extractor kept for now).

Temporary measures

(These measures basically to keep PR's more manageable / phase the implementation)

  • The loader still returns the existing dict[Path, dict[str, str]] shape so downstream helpers, filters, and parquet schema are untouched. Long-term metadata will probably move to a typed object (maybe dataclass, but maybe a pydantic model - given pydantic already used / a dependency). Later PR (likely after dealt with demand traces)

  • _RESOURCE_TYPE_CODES in resource_trace_metadata.py translates the YAML's semantic vocabulary (solar_sat, wind_offshore_floating) to the legacy short codes (SAT, WFL) downstream still expects (will disappear in the longer term)

Tests

One test in tests/test_resource_trace_metadata.py. The function has no branching or differing versions, (i.e. Extra solar/wind/zone cases would just be testing different YAML rows, not code - unlike in the regex driven approach). Only testing two files (a solar project and a wind project, that together test main logic of the function )

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/isp_trace_parser/metadata_extractors.py 77.77% <ø> (-7.94%) ⬇️
src/isp_trace_parser/resource_trace_metadata.py 100.00% <100.00%> (ø)
src/isp_trace_parser/solar_traces.py 100.00% <100.00%> (ø)
src/isp_trace_parser/wind_traces.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant