Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a static table of political subdivision attributes. #1966

Merged
merged 4 commits into from Oct 4, 2022

Conversation

zaneselvans
Copy link
Member

Consolidates several dictionaries and enumerations that we had scattered across the codebase into a single static table, with information about states, territories, provinces, etc. Including membership in various geographic aggregations, FIPS codes, etc.

In the process, also added a new ownership_country column to the ownership_eia860 table, to clearly differentiate between country and political subdivision information, which was comingled in the state column previously.

Closes #1958

Consolidates several dictionaries and enumerations that we had scattered
across the codebase into a single static table, with information about
states, territories, provinces, etc. Including membership in various
geographic aggregations, FIPS codes, etc.

In the process, also added a new `ownership_country` column to the
`ownership_eia860` table, to clearly differentiate between country and
political subdivision information, which was comingled in the state
column previously.

Closes #1958
@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Base: 82.5% // Head: 82.4% // Decreases project coverage by -0.1% ⚠️

Coverage data is based on head (35e49ba) compared to base (46617fe).
Patch coverage: 100.0% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             dev   #1966     +/-   ##
=======================================
- Coverage   82.5%   82.4%   -0.2%     
=======================================
  Files         64      64             
  Lines       7086    7092      +6     
=======================================
- Hits        5852    5849      -3     
- Misses      1234    1243      +9     
Impacted Files Coverage Δ
src/pudl/metadata/classes.py 82.0% <ø> (ø)
src/pudl/metadata/fields.py 100.0% <ø> (ø)
src/pudl/metadata/resources/eia860.py 100.0% <ø> (ø)
src/pudl/metadata/resources/pudl.py 100.0% <ø> (ø)
src/pudl/metadata/sources.py 100.0% <ø> (ø)
src/pudl/analysis/state_demand.py 24.8% <100.0%> (ø)
src/pudl/etl.py 89.2% <100.0%> (-6.5%) ⬇️
src/pudl/metadata/dfs.py 100.0% <100.0%> (ø)
src/pudl/metadata/enums.py 100.0% <100.0%> (ø)
src/pudl/transform/eia.py 95.2% <100.0%> (-0.1%) ⬇️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zaneselvans zaneselvans linked an issue Oct 3, 2022 that may be closed by this pull request
10 tasks
@zaneselvans zaneselvans added eia860 Anything having to do with EIA Form 860 new-data Requests for integration of new data. labels Oct 3, 2022
@zaneselvans zaneselvans self-assigned this Oct 3, 2022
Comment on lines 29 to 32
STATE_TO_CENSUS_DIVISION: dict[str, str] = {
x.subdivision_code: x.division_code_us_census
for x in POLITICAL_SUBDIVISIONS.itertuples()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TrentonBush this is the state to census division (smaller area than census region in the Census nomenclature, even though EIA seems to be calling the census divisions census regions?) that I think you need.

@zaneselvans zaneselvans marked this pull request as ready for review October 3, 2022 23:51
Copy link
Member

@TrentonBush TrentonBush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I have a couple of questions about the enum tables and one column naming request in POLITICAL_SUBDIVISIONS

src/pudl/metadata/dfs.py Outdated Show resolved Hide resolved
src/pudl/metadata/enums.py Show resolved Hide resolved
src/pudl/transform/eia860.py Show resolved Hide resolved
src/pudl/metadata/enums.py Show resolved Hide resolved
@zaneselvans zaneselvans merged commit 161b4c6 into dev Oct 4, 2022
@zaneselvans zaneselvans deleted the states-table branch October 4, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eia860 Anything having to do with EIA Form 860 new-data Requests for integration of new data.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate static state, territory, and province data in one place
2 participants