pudl.settings
#
Module for validating pudl etl settings.
Module Contents#
Classes#
Contains full list of supported FERC XBRL forms. |
|
BaseModel with global configuration. |
|
An abstract pydantic model for generic datasets. |
|
An immutable pydantic model to validate Ferc1Settings. |
|
An immutable pydantic model to validate Ferc714Settings. |
|
An immutable pydantic model to validate EPA CEMS settings. |
|
An immutable pydantic model to validate EIA 923 settings. |
|
An immutable pydantic model to validate EIA 861 settings. |
|
An immutable pydantic model to validate EIA 860 settings. |
|
An immutable pydantic model to validate Glue settings. |
|
An immutable pydantic model to validate EIA datasets settings. |
|
An immutable pydantic model to validate PUDL Dataset settings. |
|
An immutable Pydantic model to validate FERC 1 to SQLite settings. |
|
An immutable pydantic model to validate Ferc1 to SQLite settings. |
|
An immutable pydantic model to validate Ferc1 to SQLite settings. |
|
An immutable pydantic model to validate FERC from 2 XBRL to SQLite settings. |
|
An immutable Pydantic model to validate FERC 2 to SQLite settings. |
|
An immutable Pydantic model to validate FERC 6 to SQLite settings. |
|
An immutable pydantic model to validate FERC from 6 XBRL to SQLite settings. |
|
An immutable Pydantic model to validate FERC 60 to SQLite settings. |
|
An immutable pydantic model to validate FERC from 60 XBRL to SQLite settings. |
|
An immutable pydantic model to validate FERC from 714 XBRL to SQLite settings. |
|
An immutable pydantic model to validate FERC XBRL to SQLite settings. |
|
Main settings validation class. |
Functions#
Convert dictionary of dataset settings to dagster config. |
|
|
Create a dictionary of dagster config for the DatasetsSettings Class. |
|
Make a clickable DOI. |
- class pudl.settings.XbrlFormNumber(*args, **kwds)[source]#
Bases:
enum.Enum
Contains full list of supported FERC XBRL forms.
- class pudl.settings.BaseModel[source]#
Bases:
pydantic.BaseModel
BaseModel with global configuration.
- class pudl.settings.GenericDatasetSettings[source]#
Bases:
BaseModel
An abstract pydantic model for generic datasets.
Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions.
- Parameters:
disabled – if true, skip processing this dataset.
- property partitions: list[None | dict[str, str]][source]#
Return list of dictionaries representing individual partitions.
Convert a list of partitions into a list of dictionaries of partitions. This is intended to be used to store partitions in a format that is easy to use with
pd.json_normalize
.
- validate_partitions(partitions)[source]#
Validate the requested data partitions.
Check that all the partitions defined in the
working_partitions
of the associateddata_source
(e.g. years or states) have been assigned in the definition of the class, and that the requested values are a subset of the allowable values defined by thedata_source
.
- class pudl.settings.Ferc1Settings[source]#
Bases:
GenericDatasetSettings
An immutable pydantic model to validate Ferc1Settings.
- Parameters:
data_source – DataSource metadata object
years – list of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc714Settings[source]#
Bases:
GenericDatasetSettings
An immutable pydantic model to validate Ferc714Settings.
- Parameters:
data_source – DataSource metadata object
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.EpaCemsSettings[source]#
Bases:
GenericDatasetSettings
An immutable pydantic model to validate EPA CEMS settings.
- Parameters:
data_source – DataSource metadata object
years – list of years to validate.
states – list of states to validate.
partition – Whether to output year-state partitioned Parquet files. If True, all available threads / CPUs will be used in parallel.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Eia923Settings[source]#
Bases:
GenericDatasetSettings
An immutable pydantic model to validate EIA 923 settings.
- Parameters:
data_source – DataSource metadata object
years – list of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Eia861Settings[source]#
Bases:
GenericDatasetSettings
An immutable pydantic model to validate EIA 861 settings.
- Parameters:
data_source – DataSource metadata object
years – list of years to validate.
transform_functions – list of transform functions to be applied to eia861
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Eia860Settings[source]#
Bases:
GenericDatasetSettings
An immutable pydantic model to validate EIA 860 settings.
This model also check 860m settings.
- Parameters:
data_source – DataSource metadata object
years – list of years to validate.
ClassVar[str] (eia860m_date) – The 860m year to date.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- eia860m_data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- check_eia860m_date(eia860m: bool) bool [source]#
Check 860m date-year is exactly one year after most recent working 860 year.
- Parameters:
eia860m – True if 860m is requested.
- Returns:
True if 860m is requested.
- Return type:
eia860m
- Raises:
ValueError – the 860m date is within 860 working years.
- class pudl.settings.GlueSettings[source]#
Bases:
BaseModel
An immutable pydantic model to validate Glue settings.
- Parameters:
eia – Include eia in glue settings.
ferc1 – Include ferc1 in glue settings.
- class pudl.settings.EiaSettings[source]#
Bases:
BaseModel
An immutable pydantic model to validate EIA datasets settings.
- Parameters:
eia860 – Immutable pydantic model to validate eia860 settings.
eia923 – Immutable pydantic model to validate eia923 settings.
- eia860: Eia860Settings[source]#
- eia861: Eia861Settings[source]#
- eia923: Eia923Settings[source]#
- class pudl.settings.DatasetsSettings[source]#
Bases:
BaseModel
An immutable pydantic model to validate PUDL Dataset settings.
- Parameters:
ferc1 – Immutable pydantic model to validate ferc1 settings.
eia – Immutable pydantic model to validate eia(860, 923) settings.
glue – Immutable pydantic model to validate glue settings.
epacems – Immutable pydantic model to validate epacems settings.
- eia: EiaSettings[source]#
- epacems: EpaCemsSettings[source]#
- ferc1: Ferc1Settings[source]#
- ferc714: Ferc714Settings[source]#
- glue: GlueSettings[source]#
- make_datasources_table(ds: pudl.workspace.datastore.Datastore) pandas.DataFrame [source]#
Compile a table of dataset information.
There are three places we can look for information about a dataset: * the datastore (for DOIs, working partitions, etc) * the ETL settings (for partitions that are used in the ETL) * the DataSource info (which is stored within the ETL settings)
The ETL settings and the datastore have different levels of nesting - and therefore names for datasets. The nesting happens particularly with the EI data. There are three EIA datasets right now eia923, eia860 and eia860m. eia860m is a monthly update of a few tables in the larger eia860 dataset.
- Parameters:
ds – An initalized PUDL Datastore from which the DOI’s for each raw input dataset can be obtained.
- Returns:
a dataframe describing the partitions and DOI’s of each of the datasets in this settings object.
- class pudl.settings.Ferc1DbfToSqliteSettings[source]#
Bases:
GenericDatasetSettings
An immutable Pydantic model to validate FERC 1 to SQLite settings.
- Parameters:
years – List of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.FercGenericXbrlToSqliteSettings[source]#
Bases:
pydantic.BaseSettings
An immutable pydantic model to validate Ferc1 to SQLite settings.
- Parameters:
taxonomy – URL of XBRL taxonomy used to create structure of SQLite DB.
years – list of years to validate.
disabled – if True, skip processing this dataset.
- class pudl.settings.Ferc1XbrlToSqliteSettings[source]#
Bases:
FercGenericXbrlToSqliteSettings
An immutable pydantic model to validate Ferc1 to SQLite settings.
- Parameters:
taxonomy – URL of taxonomy used to .
years – list of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc2XbrlToSqliteSettings[source]#
Bases:
FercGenericXbrlToSqliteSettings
An immutable pydantic model to validate FERC from 2 XBRL to SQLite settings.
- Parameters:
years – List of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc2DbfToSqliteSettings[source]#
Bases:
GenericDatasetSettings
An immutable Pydantic model to validate FERC 2 to SQLite settings.
- Parameters:
years – List of years to validate.
disabled – if True, skip processing this dataset.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc6DbfToSqliteSettings[source]#
Bases:
GenericDatasetSettings
An immutable Pydantic model to validate FERC 6 to SQLite settings.
- Parameters:
years – List of years to validate.
disabled – if True, skip processing this dataset.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc6XbrlToSqliteSettings[source]#
Bases:
FercGenericXbrlToSqliteSettings
An immutable pydantic model to validate FERC from 6 XBRL to SQLite settings.
- Parameters:
years – List of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc60DbfToSqliteSettings[source]#
Bases:
GenericDatasetSettings
An immutable Pydantic model to validate FERC 60 to SQLite settings.
- Parameters:
years – List of years to validate.
disabled – if True, skip processing this dataset.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc60XbrlToSqliteSettings[source]#
Bases:
FercGenericXbrlToSqliteSettings
An immutable pydantic model to validate FERC from 60 XBRL to SQLite settings.
- Parameters:
years – List of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.Ferc714XbrlToSqliteSettings[source]#
Bases:
FercGenericXbrlToSqliteSettings
An immutable pydantic model to validate FERC from 714 XBRL to SQLite settings.
- Parameters:
years – List of years to validate.
- data_source: ClassVar[pudl.metadata.classes.DataSource][source]#
- class pudl.settings.FercToSqliteSettings[source]#
Bases:
pydantic.BaseSettings
An immutable pydantic model to validate FERC XBRL to SQLite settings.
- Parameters:
ferc1_dbf_to_sqlite_settings – Settings for converting FERC 1 DBF data to SQLite.
ferc1_xbrl_to_sqlite_settings – Settings for converting FERC 1 XBRL data to SQLite.
other_xbrl_forms – List of non-FERC1 forms to convert from XBRL to SQLite.
- ferc1_dbf_to_sqlite_settings: Ferc1DbfToSqliteSettings[source]#
- ferc1_xbrl_to_sqlite_settings: Ferc1XbrlToSqliteSettings[source]#
- ferc2_dbf_to_sqlite_settings: Ferc2DbfToSqliteSettings[source]#
- ferc2_xbrl_to_sqlite_settings: Ferc2XbrlToSqliteSettings[source]#
- ferc6_dbf_to_sqlite_settings: Ferc6DbfToSqliteSettings[source]#
- ferc6_xbrl_to_sqlite_settings: Ferc6XbrlToSqliteSettings[source]#
- ferc60_dbf_to_sqlite_settings: Ferc60DbfToSqliteSettings[source]#
- ferc60_xbrl_to_sqlite_settings: Ferc60XbrlToSqliteSettings[source]#
- ferc714_xbrl_to_sqlite_settings: Ferc714XbrlToSqliteSettings[source]#
- get_xbrl_dataset_settings(form_number: XbrlFormNumber) FercGenericXbrlToSqliteSettings [source]#
Return a list with all requested FERC XBRL to SQLite datasets.
- Parameters:
form_number – Get settings by FERC form number.
- class pudl.settings.EtlSettings[source]#
Bases:
pydantic.BaseSettings
Main settings validation class.
- ferc_to_sqlite_settings: FercToSqliteSettings[source]#
- datasets: DatasetsSettings[source]#
- classmethod from_yaml(path: str) EtlSettings [source]#
Create an EtlSettings instance from a yaml_file path.
- Parameters:
path – path to a yaml file; this could be remote.
- Returns:
An ETL settings object.
- pudl.settings._convert_settings_to_dagster_config(d: dict) None [source]#
Convert dictionary of dataset settings to dagster config.
For each partition parameter in a GenericDatasetSettings subclass, create a Noneable Dagster field with a default value of None. The GenericDatasetSettings subclasses will default to include all working paritions if the partition value is None. Get the value type so dagster can do some basic type checking in the UI.
- Parameters:
d – dictionary of datasources and their parameters.