-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Problem
Each region currently has a single dataset_id FK pointing to one Dataset record. But each geographic area has up to 12 yearly datasets (2024–2035). This means:
- Only one year's dataset is accessible per region
- There's no way to run analyses for different years
- The year is not directly stored on simulations
Requirements
- Replace
regions.dataset_idFK with aregion_datasetsjoin table (many-to-many) so each region can link to multiple yearly datasets - Add
yearcolumn tosimulationstable so the simulation year is directly queryable - Add
yearto analysis request schemas so the API can select the correct yearly dataset for a region - Make
seed_regions.pythe sole source of truth for region-to-dataset wiring —import_state_datasets.pyonly uploads dataset files and creates DB records - Update dataset resolution in analysis and simulation endpoints to query the join table, with optional year filtering (latest year used when omitted)
Acceptance criteria
-
region_datasetsjoin table exists with composite PK (region_id, dataset_id) -
regions.dataset_idcolumn removed -
simulations.yearcolumn added - Alembic migration handles data migration from old FK to join table
-
POST /analysis/economic-impactaccepts optionalyearparameter -
POST /simulations/economyaccepts optionalyearparameter -
seed_regions.pycreatesRegionDatasetLinkentries based on dataset filepath patterns -
import_state_datasets.pyno longer touches regions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels