Skip to content

Central utility crosswalk, tariff mapper fixes, and NY customer counts#155

Merged
jpvelez merged 10 commits into
mainfrom
119-get-customer-counts-for-ny-utilities-and-run-re-weighting
Feb 17, 2026
Merged

Central utility crosswalk, tariff mapper fixes, and NY customer counts#155
jpvelez merged 10 commits into
mainfrom
119-get-customer-counts-for-ny-utilities-and-run-re-weighting

Conversation

@jpvelez
Copy link
Copy Markdown
Contributor

@jpvelez jpvelez commented Feb 10, 2026

Closes #119

Overview

Introduces a central utility crosswalk (utils/utility_codes.py) as the single source of truth for utility identifiers across EIA-861, NY Open Data polygons, assign_utility_ny, tariff mappers, and types. Refactors assign_utility_ny to use it, adds utility_code to EIA stats output, fixes electric and gas tariff mappers to use real assign_utility data when available, and updates Justfiles to use std_name (coned, nimo, nyseg). Regenerates ny_electric_utility_stats.csv with the new column.

Reviewer focus

  • Does the UTILITIES list in utility_codes.py cover all expected NY utilities and gas tariff keys?
  • Tariff mappers still support synthetic fallback (with deprecation warning) when electric_utility is missing—is that acceptable for now?

Non-obvious details

  • One-record-per-utility: All lookup tables (NY Open Data names, EIA IDs, gas tariff keys) are derived from the UTILITIES list; no parallel maps.
  • EIA mapping: Utility 13573 ("Niagara Mohawk Power Corp.") maps to nimo (National Grid Upstate).
  • Gas split: nimo, keddy, kedli all use national_grid tariff key; crosswalk centralizes this.
  • ResStock reweighting task: Still outstanding (per issue); this PR does not add the Justfile recipe that calls the reweighting script.

…y_electric_utility_stats.csv

- Move NY data Justfile up to rate_design/ny/hp_rates/data/
- Add fetch-ny-utility-stats recipe (uses utils/get_utility_stats_from_eia861.py)
- Add utils/get_utility_stats_from_eia861.py from main
- Force-add ny_electric_utility_stats.csv (EIA-861 NY investor-owned utility stats)

Co-authored-by: Cursor <cursoragent@cursor.com>
jpvelez and others added 7 commits February 17, 2026 03:37
- Add utils/utility_codes.py with UTILITIES list (one record per utility)
- Derive lookup functions: get_ny_open_data_to_std_name,
  get_eia_utility_id_to_std_name, get_std_name_to_gas_tariff_key, etc.
- Update utils/types.py: electric_utility and gas_utility Literals
  use std_name (coned, nyseg, nimo, keddy, kedli, etc.)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ames

- Replace inline utility_name_map with get_ny_open_data_to_std_name()
- Update tests to use _utility_name_map_lazy from utility_codes

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- electric_tariff_mapper: use sb.electric_utility when present,
  support metadata_utility path, accept std_name
- gas_tariff_mapper: use get_std_name_to_gas_tariff_key for
  National Grid split (nimo/keddy/kedli), same metadata handling
- Add tests for both mappers

Co-authored-by: Cursor <cursoragent@cursor.com>
- Use coned, nimo, nyseg in map-electric-tariff and map-gas-tariff
- Add map-electric-rie-default / map-gas-rie-default for RI
- Regenerate ny_electric_utility_stats.csv with utility_code column

Co-authored-by: Cursor <cursoragent@cursor.com>
@jpvelez jpvelez changed the title Get NY customer counts and apply re-weighting Central utility crosswalk, tariff mapper fixes, and NY customer counts Feb 17, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@jpvelez jpvelez force-pushed the 119-get-customer-counts-for-ny-utilities-and-run-re-weighting branch from 4d8eb48 to 8f8dca4 Compare February 17, 2026 04:48
@jpvelez jpvelez merged commit ee5a91d into main Feb 17, 2026
1 of 2 checks passed
@jpvelez jpvelez deleted the 119-get-customer-counts-for-ny-utilities-and-run-re-weighting branch February 17, 2026 04:51
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.

Get customer counts for NY utilities, central utility crosswalk, and tariff mapper fixes

1 participant