Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changelog.d/liheap-utility-provider-inputs.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add electricity and natural gas provider inputs and a packaged JSON catalog of provider choices by fuel and state.
136 changes: 136 additions & 0 deletions policyengine_us/data/utility_providers.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
48 changes: 48 additions & 0 deletions policyengine_us/tests/unit/test_utility_provider_states.py
Original file line number Diff line number Diff line change
@@ -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"}
20 changes: 20 additions & 0 deletions policyengine_us/tools/utility_providers.py
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
@@ -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",
)
Original file line number Diff line number Diff line change
@@ -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",
)