diff --git a/README.md b/README.md index c01b82139f7..fd8dabc7388 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,15 @@ bundle installer published by `policyengine`, for example: uvx --from policyengine policyengine bundle install --country us --venv .venv ``` +## Utility provider choices + +Household forms can load the electricity and natural gas provider lists from +[the model’s JSON file](policyengine_us/data/utility_providers.json) once per +model version. Select the input (`electricity_provider` or `natural_gas_provider`) +and display each choice whose `states` list includes the household’s state or whose +`states` is `null`. Show the `label` and submit the selected `value` on the SPM unit. +`OTHER` covers an unlisted distributor and `UNSPECIFIED` covers an unknown one. + ## Statutes, forms and agency practice When a statute conflicts with a regulation, form, instructions, manual or diff --git a/changelog.d/liheap-utility-provider-inputs.added.md b/changelog.d/liheap-utility-provider-inputs.added.md new file mode 100644 index 00000000000..013537ad3f3 --- /dev/null +++ b/changelog.d/liheap-utility-provider-inputs.added.md @@ -0,0 +1 @@ +Add electricity and natural gas provider inputs and a packaged JSON catalog of provider choices by fuel and state. diff --git a/policyengine_us/data/utility_providers.json b/policyengine_us/data/utility_providers.json new file mode 100644 index 00000000000..ba999d3fe1c --- /dev/null +++ b/policyengine_us/data/utility_providers.json @@ -0,0 +1,136 @@ +{ + "electricity_provider": [ + { + "value": "UNSPECIFIED", + "label": "Unspecified", + "states": null + }, + { + "value": "AMEREN_ILLINOIS", + "label": "Ameren Illinois", + "states": ["IL"] + }, + { + "value": "AVISTA", + "label": "Avista", + "states": ["ID", "MT", "WA"] + }, + { + "value": "BLOCK_ISLAND_UTILITY_DISTRICT", + "label": "Block Island Utility District", + "states": ["RI"] + }, + { + "value": "BONNERS_FERRY_LIGHT_AND_WATER", + "label": "Bonners Ferry Light and Water", + "states": ["ID"] + }, + { + "value": "CLEAR_RIVER_ELECTRIC_AND_WATER_DISTRICT", + "label": "Clear River Electric and Water District (formerly Pascoag)", + "states": ["RI"] + }, + { + "value": "CLEARWATER_POWER", + "label": "Clearwater Power", + "states": ["ID", "OR", "WA"] + }, + { + "value": "COMED", + "label": "ComEd", + "states": ["IL"] + }, + { + "value": "IDAHO_COUNTY_LIGHT_AND_POWER", + "label": "Idaho County Light and Power", + "states": ["ID"] + }, + { + "value": "IDAHO_POWER", + "label": "Idaho Power", + "states": ["ID", "OR"] + }, + { + "value": "INLAND_POWER_AND_LIGHT", + "label": "Inland Power and Light", + "states": ["ID", "WA"] + }, + { + "value": "KOOTENAI_ELECTRIC", + "label": "Kootenai Electric Cooperative", + "states": ["ID", "WA"] + }, + { + "value": "NORTHERN_LIGHTS", + "label": "Northern Lights Incorporated", + "states": ["ID", "MT", "WA"] + }, + { + "value": "PLUMMER_ELECTRIC", + "label": "Plummer Electric Department", + "states": ["ID"] + }, + { + "value": "RHODE_ISLAND_ENERGY", + "label": "Rhode Island Energy (Narragansett Electric)", + "states": ["RI"] + }, + { + "value": "ROCKY_MOUNTAIN_POWER", + "label": "Rocky Mountain Power", + "states": ["ID", "UT", "WY"] + }, + { + "value": "OTHER", + "label": "Other electricity provider", + "states": null + } + ], + "natural_gas_provider": [ + { + "value": "UNSPECIFIED", + "label": "Unspecified", + "states": null + }, + { + "value": "AMEREN_ILLINOIS", + "label": "Ameren Illinois", + "states": ["IL"] + }, + { + "value": "AVISTA", + "label": "Avista", + "states": ["ID", "OR", "WA"] + }, + { + "value": "INTERMOUNTAIN_GAS", + "label": "Intermountain Gas", + "states": ["ID"] + }, + { + "value": "NICOR_GAS", + "label": "Nicor Gas", + "states": ["IL"] + }, + { + "value": "NORTH_SHORE_GAS", + "label": "North Shore Gas", + "states": ["IL"] + }, + { + "value": "PEOPLES_GAS", + "label": "Peoples Gas", + "states": ["IL"] + }, + { + "value": "RHODE_ISLAND_ENERGY", + "label": "Rhode Island Energy (Narragansett Electric)", + "states": ["RI"] + }, + { + "value": "OTHER", + "label": "Other natural gas provider", + "states": null + } + ] +} diff --git a/policyengine_us/tests/unit/test_utility_provider_states.py b/policyengine_us/tests/unit/test_utility_provider_states.py new file mode 100644 index 00000000000..8b96f7ab1f2 --- /dev/null +++ b/policyengine_us/tests/unit/test_utility_provider_states.py @@ -0,0 +1,48 @@ +import json +from importlib.resources import files + +import pytest + +from policyengine_us.variables.household.demographic.geographic.state_code import ( + StateCode, +) +from policyengine_us.variables.household.expense.utilities.electricity_provider import ( + electricity_provider, +) +from policyengine_us.variables.household.expense.utilities.natural_gas_provider import ( + natural_gas_provider, +) + + +@pytest.fixture(scope="module") +def providers(): + catalog = files("policyengine_us").joinpath("data", "utility_providers.json") + return json.loads(catalog.read_text(encoding="utf-8")) + + +@pytest.mark.parametrize("variable", [electricity_provider, natural_gas_provider]) +def test_catalog_matches_model_choices(variable, providers): + options = providers[variable.__name__] + assert [(option["value"], option["label"]) for option in options] == [ + (choice.name, choice.value) for choice in variable.possible_values + ] + assert variable.default_value.name == "UNSPECIFIED" + assert {option["value"] for option in options if option["states"] is None} == { + "OTHER", + "UNSPECIFIED", + } + for option in options: + states = option["states"] + if states is not None: + assert states and set(states) <= StateCode.__members__.keys() + assert len(states) == len(set(states)) + + +def test_avista_territory_depends_on_fuel(providers): + def avista_states(variable): + return next( + row["states"] for row in providers[variable] if row["value"] == "AVISTA" + ) + + assert set(avista_states("electricity_provider")) == {"ID", "MT", "WA"} + assert set(avista_states("natural_gas_provider")) == {"ID", "OR", "WA"} diff --git a/policyengine_us/tools/utility_providers.py b/policyengine_us/tools/utility_providers.py new file mode 100644 index 00000000000..a99c3d7b1c4 --- /dev/null +++ b/policyengine_us/tools/utility_providers.py @@ -0,0 +1,20 @@ +"""Build the model enums from the same ordered choices that partners display.""" + +import json +from importlib.resources import files + +from policyengine_core.enums import Enum + +_catalog = json.loads( + files("policyengine_us") + .joinpath("data", "utility_providers.json") + .read_text(encoding="utf-8") +) + + +def _labels(variable: str) -> dict[str, str]: + return {choice["value"]: choice["label"] for choice in _catalog[variable]} + + +ElectricityProvider = Enum("ElectricityProvider", _labels("electricity_provider")) +NaturalGasProvider = Enum("NaturalGasProvider", _labels("natural_gas_provider")) diff --git a/policyengine_us/variables/household/expense/utilities/electricity_provider.py b/policyengine_us/variables/household/expense/utilities/electricity_provider.py new file mode 100644 index 00000000000..e927dd476ed --- /dev/null +++ b/policyengine_us/variables/household/expense/utilities/electricity_provider.py @@ -0,0 +1,30 @@ +from policyengine_us.model_api import * +from policyengine_us.tools.utility_providers import ElectricityProvider + + +class electricity_provider(Variable): + value_type = Enum + possible_values = ElectricityProvider + default_value = ElectricityProvider.UNSPECIFIED + entity = SPMUnit + definition_period = YEAR + label = "Electricity utility provider" + documentation = ( + "Company providing the home's electric distribution service, as named on " + "the utility bill. Report the distribution utility even when a separate " + "retailer supplies the energy. UNSPECIFIED means the company was not " + "reported; OTHER means a reported company outside the listed choices. " + "Named companies support Idaho, Illinois and Rhode Island heating " + "assistance. The state mapping includes their service in other states. " + "This input does not imply program enrollment or bill receipt." + ) + reference = ( + "https://liheapch.acf.gov/docs/2026/benefits-matricies/ID_BenefitMatrix_Heating_2026.pdf#page=1", + "https://dceo.illinois.gov/communityservices/utilitybillassistance/howtoapply.html", + "https://webserver.rilegislature.gov/Statutes/TITLE39/39-1/39-1-27.12.htm", + "https://oemr.idaho.gov/utilities/", + # Form EIA-861, 2025 final, Service_Territory_2025 (utility by county). + "https://www.eia.gov/electricity/data/eia861/", + # EIA lists PacifiCorp as a whole. This is its Rocky Mountain Power brand. + "https://www.rockymountainpower.net/about.html", + ) diff --git a/policyengine_us/variables/household/expense/utilities/natural_gas_provider.py b/policyengine_us/variables/household/expense/utilities/natural_gas_provider.py new file mode 100644 index 00000000000..2d379a51eda --- /dev/null +++ b/policyengine_us/variables/household/expense/utilities/natural_gas_provider.py @@ -0,0 +1,34 @@ +from policyengine_us.model_api import * +from policyengine_us.tools.utility_providers import NaturalGasProvider + + +class natural_gas_provider(Variable): + value_type = Enum + possible_values = NaturalGasProvider + default_value = NaturalGasProvider.UNSPECIFIED + entity = SPMUnit + definition_period = YEAR + label = "Natural gas utility provider" + documentation = ( + "Company providing the home's natural gas distribution service, as named " + "on the utility bill. Report the distribution utility even when a " + "separate retailer supplies the gas. UNSPECIFIED means the company was " + "not reported; OTHER means a reported company outside the listed choices. " + "Named companies support Idaho, Illinois and Rhode Island heating " + "assistance. The state mapping includes their service in other states. " + "Electricity and gas companies are reported independently. " + "This input does not imply program enrollment or bill receipt." + ) + reference = ( + "https://liheapch.acf.gov/docs/2026/benefits-matricies/ID_BenefitMatrix_Heating_2026.pdf#page=1", + "https://dceo.illinois.gov/communityservices/utilitybillassistance/howtoapply.html", + "https://webserver.rilegislature.gov/Statutes/TITLE39/39-1/39-1-27.12.htm", + # Form EIA-176, 2024, residential customers by reporting company and state. + "https://www.eia.gov/naturalgas/ngqs/", + # Illinois distribution companies, including Peoples Gas Light & Coke. + "https://icc.illinois.gov/public-utility", + # Avista Utilities, Form 10-K, Part I, Item 1 (electric and gas territories). + "https://www.sec.gov/Archives/edgar/data/104918/000119312526067872/ava-20251231.htm", + "https://www.intgas.com/in-the-community/about-us/", + "https://ripuc.ri.gov/utility-information/regulated-utilities", + )