Dimension Mappings

DimensionMappingBaseModel

dsgrid.config.dimension_mapping_base.DimensionMappingBaseModel

Base class for mapping dimensions

Fields

Name

Type

Default

Description

id

int | None

None

Registry database ID

version

str | None

None

Version, generated by dsgrid

mapping_type

DimensionMappingType

DimensionMappingType.MANY_TO_ONE_AGGREGATION

Type/purpose of the dimension mapping

archetype

DimensionMappingArchetype | None

None

Dimension mapping archetype, determined based on mapping_type

from_dimension

DimensionReferenceModel

(required)

From dimension

to_dimension

DimensionReferenceModel

(required)

To dimension

from_fraction_tolerance

float

1e-06

Tolerance to apply when checking from_fraction column sums

to_fraction_tolerance

float

1e-06

Tolerance to apply when checking to_fraction column sums

description

str | None

None

Description of dimension mapping

mapping_id

str | None

None

Unique dimension mapping identifier, generated by dsgrid

Validators

Name

Applies To

Description

check_archetype

check_archetype

No description


DimensionMappingReferenceModel

dsgrid.config.dimension_mapping_base.DimensionMappingReferenceModel

Reference to a dimension mapping stored in the registry.

The DimensionMappingReferenceModel is utilized by the project configuration (project.json5) as well as by the dimension mapping reference configuration (dimension_mapping_references.json5) that may be required when submitting a dataset to a project.

Fields

Name

Type

Default

Description

from_dimension_type

DimensionType

(required)

Dimension Type

to_dimension_type

DimensionType

(required)

Dimension Type

mapping_id

str

(required)

Unique ID of the dimension mapping

version

str

(required)

Version of the dimension

Validators

Name

Applies To

Description

handle_legacy_fields

*(model)*

No description


DatasetBaseToProjectMappingTableListModel

dsgrid.config.mapping_tables.DatasetBaseToProjectMappingTableListModel

Represents the config file passed to register-and-submit-dataset command.

Fields

Name

Type

Default

Description

mappings

list[DatasetBaseToProjectMappingTableModel]

(required)


DatasetBaseToProjectMappingTableModel

dsgrid.config.mapping_tables.DatasetBaseToProjectMappingTableModel

Attributes for a dimension mapping table to map soon-to-be-registered dataset base dimensions to a project’s dimensions. This will be converted to a MappingTableModel as soon as the dimensions are registered.

Fields

Name

Type

Default

Description

mapping_type

DimensionMappingType

DimensionMappingType.MANY_TO_ONE_AGGREGATION

Type/purpose of the dimension mapping

archetype

DimensionMappingArchetype | None

None

Dimension mapping archetype, determined based on mapping_type

description

str | None

None

Description of dimension mapping

from_fraction_tolerance

float

1e-06

Tolerance value to apply to the from_fraction column

to_fraction_tolerance

float

1e-06

Tolerance value to apply to the to_fraction column

project_base_dimension_name

str | None

None

Name of the base dimension for which the mapping is being registered. This is required in cases where the project has multiple base dimensions of the same type. If None, there must only be one base dimension of this type in the project.

dimension_type

DimensionType

(required)

Dimension types that will be mapped

filename

str

(required)

Filename containing association table records.


DimensionMappingReferenceListModel

dsgrid.config.dimension_mapping_base.DimensionMappingReferenceListModel

List of dimension mapping references used by the dimensions_mappings.json5 config

Fields

Name

Type

Default

Description

references

list[DimensionMappingReferenceModel]

(required)

List of dimension mapping references


DimensionMappingsConfigModel

dsgrid.config.dimension_mappings_config.DimensionMappingsConfigModel

Represents dimension mapping model configurations

Fields

Name

Type

Default

Description

mappings

list[MappingTableModel]

(required)

dimension mappings between and within projects and datasets


MappingTableModel

dsgrid.config.mapping_tables.MappingTableModel

Attributes for a dimension mapping table

Fields

Name

Type

Default

Description

id

int | None

None

Registry database ID

version

str | None

None

Version, generated by dsgrid

mapping_type

DimensionMappingType

DimensionMappingType.MANY_TO_ONE_AGGREGATION

Type/purpose of the dimension mapping

archetype

DimensionMappingArchetype | None

None

Dimension mapping archetype, determined based on mapping_type

from_dimension

DimensionReferenceModel

(required)

From dimension

to_dimension

DimensionReferenceModel

(required)

To dimension

from_fraction_tolerance

float

1e-06

Tolerance to apply when checking from_fraction column sums

to_fraction_tolerance

float

1e-06

Tolerance to apply when checking to_fraction column sums

description

str | None

None

Description of dimension mapping

mapping_id

str | None

None

Unique dimension mapping identifier, generated by dsgrid

filename

str | None

None

Filename containing association table records. Only assigned for user input and output purposes. The registry database stores records in the mapping JSON document.

file_hash

str | None

None

Hash of the contents of the file, computed by dsgrid.

records

list

[]

dimension mapping records in filename that get loaded at runtime

Validators

Name

Applies To

Description

check_archetype

check_archetype

No description

check_filename

check_filename

Validate record file

compute_file_hash

compute_file_hash

Compute file hash.

add_records

add_records

Add records from the file.