Project Config¶
- pydantic model dsgrid.config.project_config.ProjectConfigModel[source]¶
Represents project configurations
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- Validators:
- field datasets: list[InputDatasetModel] [Required]¶
List of input datasets for the project.
- field description: str [Required]¶
Detailed project description.
- field dimension_mappings: DimensionMappingsModel = DimensionMappingsModel(base_to_supplemental_references=[], dataset_to_project={})¶
List of project mappings. Initialized with base-to-base and base-to-supplemental mappings. dataset-to-project mappings are added by dsgrid as datasets get registered with the project.
- field dimensions: DimensionsModel [Required]¶
List of base and supplemental dimensions.
- field id: str | None = None (alias '_id')¶
Registry database ID
- field key: str | None = None (alias '_key')¶
Registry database key
- field name: str [Required]¶
A project name to accompany the ID.
- field project_id: str [Required]¶
A unique project identifier that is project-specific (e.g., ‘standard-scenarios-2021’).
- Validated by:
- field rev: str | None = None (alias '_rev')¶
Registry database revision
- field status: ProjectRegistryStatus = ProjectRegistryStatus.INITIAL_REGISTRATION¶
project registry status
- field version: str | None = None¶
Version, generated by dsgrid
- validator check_project_id_handle » project_id[source]¶
Check for valid characters in project id
- pydantic model dsgrid.config.project_config.InputDatasetModel[source]¶
Defines an input dataset for the project config.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
dataset_type (dsgrid.config.dataset_config.InputDatasetType)
mapping_references (list[dsgrid.config.dimension_mapping_base.DimensionMappingReferenceModel])
required_dimensions (dsgrid.config.project_config.RequiredDimensionsModel)
time_based_data_adjustment (dsgrid.dimension.time.TimeBasedDataAdjustmentModel)
- Validators:
- field dataset_id: str [Required]¶
Unique dataset identifier.
- field dataset_type: InputDatasetType [Required]¶
Dataset type.
- field mapping_references: list[DimensionMappingReferenceModel] = []¶
Defines how to map the dataset dimensions to the project.
- field required_dimensions: RequiredDimensionsModel = RequiredDimensionsModel(single_dimensional=RequiredDimensionRecordsModel(geography=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), metric=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), model_year=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), scenario=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), sector=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), subsector=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), weather_year=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])), multi_dimensional=[])¶
Defines required record IDs that must exist for each dimension.
- field status: DatasetRegistryStatus = DatasetRegistryStatus.UNREGISTERED¶
Registration status of the dataset, added by dsgrid.
- field time_based_data_adjustment: TimeBasedDataAdjustmentModel = TimeBasedDataAdjustmentModel(leap_day_adjustment=<LeapDayAdjustmentType.NONE: 'none'>, daylight_saving_adjustment=DaylightSavingAdjustmentModel(spring_forward_hour=<DaylightSavingSpringForwardType.NONE: 'none'>, fall_back_hour=<DaylightSavingFallBackType.NONE: 'none'>))¶
Defines how the rest of the dataframe is adjusted with respect to time. E.g., when drop associated data when dropping a leap day timestamp.
- Validated by:
- field version: str = None¶
Version of the registered dataset
- field wrap_time_allowed: bool = False¶
Whether to allow dataset time to be wrapped to project time if different
- validator check_data_adjustment » time_based_data_adjustment[source]¶
Check daylight saving adjustment
- pydantic model dsgrid.config.project_config.DimensionsModel[source]¶
Contains dimensions defined by a project
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
base_dimension_references (list[dsgrid.config.dimensions.DimensionReferenceModel])
subset_dimensions (list[dsgrid.config.project_config.SubsetDimensionGroupModel])
supplemental_dimension_references (list[dsgrid.config.dimensions.DimensionReferenceModel])
supplemental_dimensions (list[dsgrid.config.supplemental_dimension.SupplementalDimensionModel])
- Validators:
check_dimension_query_names
»all fields
check_dimensions
»all fields
pre_check_values
»all fields
- field base_dimension_references: list[DimensionReferenceModel] = []¶
List of registry references (
DimensionReferenceModel
) for a project’s base dimensions.- Validated by:
- field base_dimensions: Annotated[list[DimensionModel | DateTimeDimensionModel | AnnualTimeDimensionModel | RepresentativePeriodTimeDimensionModel | IndexTimeDimensionModel | NoOpTimeDimensionModel], BeforeValidator(func=handle_dimension_union, json_schema_input_type=PydanticUndefined)] = []¶
List of dimensions for a project’s base dimensions. They will be automatically registered during project registration and then converted to base_dimension_references.
- Constraints:
func = <function handle_dimension_union at 0x7fdfb5e6f380>
json_schema_input_type = PydanticUndefined
- Validated by:
- field subset_dimensions: list[SubsetDimensionGroupModel] = []¶
List of subset dimension groups
- field supplemental_dimension_references: list[DimensionReferenceModel] = []¶
List of registry references for a project’s supplemental dimensions.
- Validated by:
- field supplemental_dimensions: list[SupplementalDimensionModel] = []¶
List of supplemental dimensions. They will be automatically registered during project registration and then converted to supplemental_dimension_references.
- Validated by:
- validator check_dimension_query_names » all fields[source]¶
Check that all dimension query names are unique.
- validator check_dimensions » all fields[source]¶
Validate that the dimensions are complete and consistent.
- validator check_files » base_dimensions[source]¶
Validate dimension files are unique across all dimensions
- validator check_names » base_dimensions[source]¶
Validate dimension names are unique across all dimensions.
- validator check_subset_dimensions » subset_dimensions[source]¶
Check that each subset dimension has a unique name and display_name.
- validator check_time_zone » base_dimensions[source]¶
Validate the time zone column in geography records.
- pydantic model dsgrid.config.project_config.DimensionReferenceModel[source]¶
Reference to a dimension stored in the registry
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- field dimension_id: str [Required]¶
Unique ID of the dimension in the registry
- field dimension_type: DimensionType [Required] (alias 'type')¶
Type of the dimension
- field version: str [Required]¶
Version of the dimension
- pydantic model dsgrid.config.project_config.RequiredDimensionsModel[source]¶
Defines required record IDs that must exist for each dimension in a dataset. Record IDs can reside in the project’s base, subset, or supplemental dimensions. Using subset dimensions is recommended. dsgrid will substitute base records for mapped subset records at runtime. If no records are listed for a dimension then all project base records are required.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- Validators:
check_for_duplicates
»all fields
- field multi_dimensional: list[RequiredDimensionRecordsModel] = []¶
Required records for a combination of dimensions. For example, there may be a dataset requirement for only one subsector for a given sector instead of a cross product.
- Validated by:
- field single_dimensional: RequiredDimensionRecordsModel = RequiredDimensionRecordsModel(geography=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), metric=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), model_year=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), scenario=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), sector=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), subsector=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]), weather_year=RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[]))¶
Required records for a single dimension.
- Validated by:
- pydantic model dsgrid.config.project_config.DimensionMappingsModel[source]¶
Defines all dimension mappings associated with a dsgrid project, including base-to-supplemental mappings and dataset-to-project mappings.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- field base_to_supplemental_references: list[DimensionMappingReferenceModel] = []¶
Base dimension to supplemental dimension mappings (e.g., county-to-state) used to support various queries and dimension transformations.
- field dataset_to_project: dict[str, list[DimensionMappingReferenceModel]] = {}¶
Dataset-to-project mappings map dataset dimensions to project dimensions.
- pydantic model dsgrid.config.project_config.RequiredDimensionRecordsModel[source]¶
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
geography (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
metric (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
model_year (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
scenario (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
sector (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
subsector (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
weather_year (dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel)
- field geography: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- field metric: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- field model_year: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- field scenario: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- field sector: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- field subsector: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- field weather_year: RequiredDimensionRecordsByTypeModel = RequiredDimensionRecordsByTypeModel(base=[], base_missing=[], subset=[], supplemental=[])¶
- pydantic model dsgrid.config.project_config.RequiredSupplementalDimensionRecordsModel[source]¶
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- field name: str [Required]¶
Name of a supplemental dimension
- field record_ids: list[str] [Required]¶
One or more record IDs in the supplemental dimension
- pydantic model dsgrid.config.project_config.RequiredDimensionRecordsByTypeModel[source]¶
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- Validators:
check_base
»all fields
- field base: list[str] = []¶
- Validated by:
- field base_missing: list[str] = []¶
- Validated by:
- field subset: list[RequiredSubsetDimensionRecordsModel] = []¶
- Validated by:
- field supplemental: list[RequiredSupplementalDimensionRecordsModel] = []¶
- Validated by:
- pydantic model dsgrid.config.project_config.SubsetDimensionGroupModel[source]¶
Defines one or more subset dimension selectors for a dimension type.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- Validators:
- field create_supplemental_dimension: bool = True¶
Auto-generate supplemental dimensions in order to allow aggregrations on the subsets.
- Validated by:
- field description: str [Required]¶
- Validated by:
- field dimension_query_name: str | None = None¶
Auto-generated query name for SQL queries.
- Validated by:
- field dimension_type: DimensionType [Required] (alias 'type')¶
Type of the dimension
- Validated by:
- field display_name: str [Required]¶
- Validated by:
- field filename: str | None = None (alias 'file')¶
Filename containing dimension records. Only populated for initial registration. Each selector’s records are stored as JSON objects in the dsgrid registry.
- Validated by:
- field name: str [Required]¶
- Validated by:
- field record_ids: set[str] = {}¶
- Validated by:
- field selector_references: list[DimensionReferenceModel] = []¶
References to the subset dimensions generated by dsgrid during registration.
- Validated by:
- field selectors: list[SubsetDimensionSelectorModel] [Required]¶
Dimension selectors
- Validated by:
- validator check_display_name » display_name[source]¶
- validator check_query_name » dimension_query_name[source]¶
- pydantic model dsgrid.config.project_config.SubsetDimensionGroupListModel[source]¶
Defines a list of subset dimensions.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- field subset_dimensions: Annotated[List[SubsetDimensionGroupModel], Len(min_length=1, max_length=None)] [Required]¶
List of subset dimensions to be registered
- Constraints:
min_length = 1
To add new supplemental dimensions¶
- pydantic model dsgrid.config.supplemental_dimension.SupplementalDimensionsListModel[source]¶
Defines a list of supplemental dimensions.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- field supplemental_dimensions: Annotated[List[SupplementalDimensionModel], Len(min_length=1, max_length=None)] [Required]¶
List of supplemental dimensions and mappings to be registered
- Constraints:
min_length = 1
To add new dataset requirements¶
- pydantic model dsgrid.config.input_dataset_requirements.InputDatasetListModel[source]¶
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- field datasets: Annotated[List[InputDatasetModel], Len(min_length=1, max_length=None)] [Required]¶
List of input datasets for the project.
- Constraints:
min_length = 1
To replace dataset dimension requirements¶
- pydantic model dsgrid.config.input_dataset_requirements.InputDatasetDimensionRequirementsListModel[source]¶
Defines a list of dataset dimension requirements.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- field dataset_dimension_requirements: Annotated[List[InputDatasetDimensionRequirementsModel], Len(min_length=1, max_length=None)] [Required]¶
List of dataset dimension requirements
- Constraints:
min_length = 1
- pydantic model dsgrid.config.input_dataset_requirements.InputDatasetDimensionRequirementsModel[source]¶
Defines dataset dimension requirements.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- field dataset_id: str [Required]¶
- field required_dimensions: RequiredDimensionsModel [Required]¶
Defines required record IDs that must exist for each dimension.