Dimension Config¶
- pydantic model dsgrid.config.dimensions.DimensionModel[source]¶
Defines a non-time dimension
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 file_hash: str | None = None¶
Hash of the contents of the file
- Validated by:
- field filename: str | None = None (alias 'file')¶
Filename containing dimension records. Only assigned for user input and output purposes. The registry database stores records in the dimension JSON document.
- Validated by:
- field records: list = []¶
Dimension records in filename that get loaded at runtime
- Validated by:
DateTime Dimension Config¶
- pydantic model dsgrid.config.dimensions.DateTimeDimensionModel[source]¶
Defines a time dimension where timestamps translate to datetime objects.
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_frequency
»all fields
handle_legacy_fields
»all fields
- field datetime_format: AlignedTime | LocalTimeAsStrings [Required]¶
Format of the datetime used to define the data format, alignment between geography, and time zone information.
- Validated by:
- field frequency: timedelta [Required]¶
Resolution of the timestamps
- Validated by:
- field measurement_type: MeasurementType = MeasurementType.TOTAL¶
- The type of measurement represented by a value associated with a timestamp:
mean, min, max, measured, total
- Validated by:
- field ranges: list[TimeRangeModel] [Required]¶
Defines the continuous ranges of time in the data, inclusive of start and end time.
- Validated by:
- field str_format: str = '%Y-%m-%d %H:%M:%s'¶
Timestamp string format (for parsing the time ranges)
- Validated by:
- field time_interval_type: TimeIntervalType [Required]¶
The range of time that the value associated with a timestamp represents, e.g., period-beginning
- Validated by:
Annual Time Dimension Config¶
- pydantic model dsgrid.config.dimensions.AnnualTimeDimensionModel[source]¶
Defines an annual time dimension where timestamps are years.
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 include_leap_day: bool = False¶
Whether annual time includes leap day.
- field measurement_type: MeasurementType = MeasurementType.TOTAL¶
- The type of measurement represented by a value associated with a timestamp:
e.g., mean, total
- Validated by:
- field ranges: list[TimeRangeModel] [Required]¶
Defines the contiguous ranges of time in the data, inclusive of start and end time.
- Validated by:
- field str_format: str = '%Y'¶
Timestamp string format
- field time_type: TimeDimensionType = TimeDimensionType.ANNUAL¶
- validator check_measurement_type » measurement_type[source]¶
Representative Period Time Dimension Config¶
- pydantic model dsgrid.config.dimensions.RepresentativePeriodTimeDimensionModel[source]¶
Defines a representative time dimension.
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 format: RepresentativePeriodFormat [Required]¶
Format of the timestamps in the load data
- field measurement_type: MeasurementType = MeasurementType.TOTAL¶
- The type of measurement represented by a value associated with a timestamp:
e.g., mean, total
- field ranges: list[MonthRangeModel] [Required]¶
Defines the continuous ranges of time in the data, inclusive of start and end time.
- field time_interval_type: TimeIntervalType [Required]¶
The range of time that the value associated with a timestamp represents
- field time_type: TimeDimensionType = TimeDimensionType.REPRESENTATIVE_PERIOD¶
No-op Time Dimension Config¶
- pydantic model dsgrid.config.dimensions.NoOpTimeDimensionModel[source]¶
Defines a NoOp time dimension.
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 time_type: TimeDimensionType = TimeDimensionType.NOOP¶
- pydantic model dsgrid.config.dimensions.TimeRangeModel[source]¶
Defines a continuous range of time.
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 end: str [Required]¶
Last timestamp in the data (inclusive)
- field start: str [Required]¶
First timestamp in the data
- pydantic model dsgrid.config.dimensions.MonthRangeModel[source]¶
Defines a continuous range of time.
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 end: int [Required]¶
Last month in the data (inclusive)
- field start: int [Required]¶
First month in the data (January is 1, December is 12)
Dimension Reference¶
- pydantic model dsgrid.config.dimensions.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
Dimensions Config¶
- pydantic model dsgrid.config.dimensions_config.DimensionsConfigModel[source]¶
Represents multiple dimension models.
Used when registering multiple dimensions in one command.
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 dimensions: Annotated[list[DimensionModel | DateTimeDimensionModel | AnnualTimeDimensionModel | RepresentativePeriodTimeDimensionModel | IndexTimeDimensionModel | NoOpTimeDimensionModel], BeforeValidator(func=handle_dimension_union, json_schema_input_type=PydanticUndefined)] [Required]¶
Dimensions for submission to the dimension registry
- Constraints:
func = <function handle_dimension_union at 0x7fdfb5e6f380>
json_schema_input_type = PydanticUndefined
- Validated by:
- validator check_files » dimensions[source]¶
Validate dimension files are unique across all dimensions
- validator check_names » dimensions[source]¶
Validate dimension names are unique across all dimensions.