Project specs#

Pydantic model esgvoc.api.project_specs.DrsCollection[source]#

Bases: BaseModel

A collection part of a DRS specification (e.g., institution_id for CMIP6).

Show JSON schema
{
   "title": "DrsCollection",
   "description": "A collection part of a DRS specification (e.g., institution_id for CMIP6).",
   "type": "object",
   "properties": {
      "collection_id": {
         "title": "Collection Id",
         "type": "string"
      },
      "is_required": {
         "title": "Is Required",
         "type": "boolean"
      },
      "kind": {
         "const": "collection",
         "default": "collection",
         "title": "Kind",
         "type": "string"
      }
   },
   "required": [
      "collection_id",
      "is_required"
   ]
}

field collection_id: str [Required][source]#

The collection id.

field is_required: bool [Required][source]#

Whether the collection is required for the DRS specification or not.

field kind: Literal[DrsPartKind.COLLECTION] = DrsPartKind.COLLECTION[source]#

The DRS part kind.

Pydantic model esgvoc.api.project_specs.DrsConstant[source]#

Bases: BaseModel

A constant part of a DRS specification (e.g., cmip5).

Show JSON schema
{
   "title": "DrsConstant",
   "description": "A constant part of a DRS specification (e.g., cmip5).",
   "type": "object",
   "properties": {
      "value": {
         "title": "Value",
         "type": "string"
      },
      "kind": {
         "const": "constant",
         "default": "constant",
         "title": "Kind",
         "type": "string"
      }
   },
   "required": [
      "value"
   ]
}

field kind: Literal[DrsPartKind.CONSTANT] = DrsPartKind.CONSTANT[source]#

The DRS part kind.

field value: str [Required][source]#

The value of the a constant part.

class esgvoc.api.project_specs.DrsPartKind(*values)[source]#

Bases: str, Enum

The kinds of DRS part (constant and collection).

COLLECTION = 'collection'[source]#

The collection part type.

CONSTANT = 'constant'[source]#

The constant part type.

Pydantic model esgvoc.api.project_specs.DrsSpecification[source]#

Bases: BaseModel

A DRS specification.

Show JSON schema
{
   "title": "DrsSpecification",
   "description": "A DRS specification.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/$defs/DrsType"
      },
      "separator": {
         "title": "Separator",
         "type": "string"
      },
      "properties": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Properties"
      },
      "parts": {
         "items": {
            "discriminator": {
               "mapping": {
                  "collection": "#/$defs/DrsCollection",
                  "constant": "#/$defs/DrsConstant"
               },
               "propertyName": "kind"
            },
            "oneOf": [
               {
                  "$ref": "#/$defs/DrsConstant"
               },
               {
                  "$ref": "#/$defs/DrsCollection"
               }
            ]
         },
         "title": "Parts",
         "type": "array"
      }
   },
   "$defs": {
      "DrsCollection": {
         "description": "A collection part of a DRS specification (e.g., institution_id for CMIP6).",
         "properties": {
            "collection_id": {
               "title": "Collection Id",
               "type": "string"
            },
            "is_required": {
               "title": "Is Required",
               "type": "boolean"
            },
            "kind": {
               "const": "collection",
               "default": "collection",
               "title": "Kind",
               "type": "string"
            }
         },
         "required": [
            "collection_id",
            "is_required"
         ],
         "title": "DrsCollection",
         "type": "object"
      },
      "DrsConstant": {
         "description": "A constant part of a DRS specification (e.g., cmip5).",
         "properties": {
            "value": {
               "title": "Value",
               "type": "string"
            },
            "kind": {
               "const": "constant",
               "default": "constant",
               "title": "Kind",
               "type": "string"
            }
         },
         "required": [
            "value"
         ],
         "title": "DrsConstant",
         "type": "object"
      },
      "DrsType": {
         "description": "The types of DRS specification (directory, file name and dataset id).",
         "enum": [
            "directory",
            "file_name",
            "dataset_id"
         ],
         "title": "DrsType",
         "type": "string"
      }
   },
   "required": [
      "type",
      "separator",
      "parts"
   ]
}

field parts: list[Annotated[DrsConstant | DrsCollection, FieldInfo(annotation=NoneType, required=True, discriminator='kind')]] [Required][source]#

The parts of the DRS specification.

field properties: dict | None = None[source]#

The other specifications (e.g., file name extension for file name DRS specification).

field separator: str [Required][source]#

The textual separator string or character.

field type: DrsType [Required][source]#

The type of the specification.

class esgvoc.api.project_specs.DrsType(*values)[source]#

Bases: str, Enum

The types of DRS specification (directory, file name and dataset id).

DATASET_ID = 'dataset_id'[source]#

The DRS dataset id specification type.

DIRECTORY = 'directory'[source]#

The DRS directory specification type.

FILE_NAME = 'file_name'[source]#

The DRS file name specification type.

Pydantic model esgvoc.api.project_specs.GlobalAttributeSpecBase[source]#

Bases: BaseModel

Specification for a global attribute.

Show JSON schema
{
   "title": "GlobalAttributeSpecBase",
   "description": "Specification for a global attribute.",
   "type": "object",
   "properties": {
      "source_collection": {
         "title": "Source Collection",
         "type": "string"
      },
      "value_type": {
         "$ref": "#/$defs/GlobalAttributeValueType"
      }
   },
   "$defs": {
      "GlobalAttributeValueType": {
         "description": "The types of global attribute values.",
         "enum": [
            "string",
            "integer",
            "float"
         ],
         "title": "GlobalAttributeValueType",
         "type": "string"
      }
   },
   "required": [
      "source_collection",
      "value_type"
   ]
}

field source_collection: str [Required][source]#

the source_collection to get the term from

field value_type: GlobalAttributeValueType [Required][source]#

The expected value type.

accept(attribute_name: str, visitor: GlobalAttributeVisitor) Any[source]#
Pydantic model esgvoc.api.project_specs.GlobalAttributeSpecSpecific[source]#

Bases: GlobalAttributeSpecBase

Specification for a global attribute. with a specific key

Show JSON schema
{
   "title": "GlobalAttributeSpecSpecific",
   "description": "Specification for a global attribute.\nwith a specific key",
   "type": "object",
   "properties": {
      "source_collection": {
         "title": "Source Collection",
         "type": "string"
      },
      "value_type": {
         "$ref": "#/$defs/GlobalAttributeValueType"
      },
      "specific_key": {
         "title": "Specific Key",
         "type": "string"
      }
   },
   "$defs": {
      "GlobalAttributeValueType": {
         "description": "The types of global attribute values.",
         "enum": [
            "string",
            "integer",
            "float"
         ],
         "title": "GlobalAttributeValueType",
         "type": "string"
      }
   },
   "required": [
      "source_collection",
      "value_type",
      "specific_key"
   ]
}

field specific_key: str [Required][source]#

If the validation is for the value of a specific key, for instance description or ui-label

accept(attribute_name: str, visitor: GlobalAttributeVisitor) Any[source]#

Accept a global attribute visitor.

Parameters:
Returns:

Depending on the visitor.

Return type:

Any

Pydantic model esgvoc.api.project_specs.GlobalAttributeSpecs[source]#

Bases: BaseModel

Container for global attribute specifications.

Show JSON schema
{
   "title": "GlobalAttributeSpecs",
   "description": "Container for global attribute specifications.",
   "type": "object",
   "properties": {
      "specs": {
         "additionalProperties": {
            "anyOf": [
               {
                  "$ref": "#/$defs/GlobalAttributeSpecSpecific"
               },
               {
                  "$ref": "#/$defs/GlobalAttributeSpecBase"
               }
            ]
         },
         "title": "Specs",
         "type": "object"
      }
   },
   "$defs": {
      "GlobalAttributeSpecBase": {
         "description": "Specification for a global attribute.",
         "properties": {
            "source_collection": {
               "title": "Source Collection",
               "type": "string"
            },
            "value_type": {
               "$ref": "#/$defs/GlobalAttributeValueType"
            }
         },
         "required": [
            "source_collection",
            "value_type"
         ],
         "title": "GlobalAttributeSpecBase",
         "type": "object"
      },
      "GlobalAttributeSpecSpecific": {
         "description": "Specification for a global attribute.\nwith a specific key",
         "properties": {
            "source_collection": {
               "title": "Source Collection",
               "type": "string"
            },
            "value_type": {
               "$ref": "#/$defs/GlobalAttributeValueType"
            },
            "specific_key": {
               "title": "Specific Key",
               "type": "string"
            }
         },
         "required": [
            "source_collection",
            "value_type",
            "specific_key"
         ],
         "title": "GlobalAttributeSpecSpecific",
         "type": "object"
      },
      "GlobalAttributeValueType": {
         "description": "The types of global attribute values.",
         "enum": [
            "string",
            "integer",
            "float"
         ],
         "title": "GlobalAttributeValueType",
         "type": "string"
      }
   }
}

field specs: dict[str, GlobalAttributeSpecSpecific | GlobalAttributeSpecBase] [Optional][source]#

The global attributes specifications dictionary.

items()[source]#
keys()[source]#
values()[source]#
class esgvoc.api.project_specs.GlobalAttributeValueType(*values)[source]#

Bases: str, Enum

The types of global attribute values.

FLOAT = 'float'[source]#

Float value type.

INTEGER = 'integer'[source]#

Integer value type.

STRING = 'string'[source]#

String value type.

class esgvoc.api.project_specs.GlobalAttributeVisitor(*args, **kwargs)[source]#

Bases: Protocol

Specifications for a global attribute visitor.

visit_base_attribute(attribute_name: str, attribute: GlobalAttributeSpecBase) Any[source]#

Visit a base global attribute.

visit_specific_attribute(attribute_name: str, attribute: GlobalAttributeSpecSpecific) Any[source]#

Visit a specific global attribute.

Pydantic model esgvoc.api.project_specs.ProjectSpecs[source]#

Bases: BaseModel

A project specifications.

Show JSON schema
{
   "title": "ProjectSpecs",
   "description": "A project specifications.",
   "type": "object",
   "properties": {
      "project_id": {
         "title": "Project Id",
         "type": "string"
      },
      "description": {
         "title": "Description",
         "type": "string"
      },
      "drs_specs": {
         "items": {
            "$ref": "#/$defs/DrsSpecification"
         },
         "title": "Drs Specs",
         "type": "array"
      },
      "global_attributes_specs": {
         "anyOf": [
            {
               "$ref": "#/$defs/GlobalAttributeSpecs"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "DrsCollection": {
         "description": "A collection part of a DRS specification (e.g., institution_id for CMIP6).",
         "properties": {
            "collection_id": {
               "title": "Collection Id",
               "type": "string"
            },
            "is_required": {
               "title": "Is Required",
               "type": "boolean"
            },
            "kind": {
               "const": "collection",
               "default": "collection",
               "title": "Kind",
               "type": "string"
            }
         },
         "required": [
            "collection_id",
            "is_required"
         ],
         "title": "DrsCollection",
         "type": "object"
      },
      "DrsConstant": {
         "description": "A constant part of a DRS specification (e.g., cmip5).",
         "properties": {
            "value": {
               "title": "Value",
               "type": "string"
            },
            "kind": {
               "const": "constant",
               "default": "constant",
               "title": "Kind",
               "type": "string"
            }
         },
         "required": [
            "value"
         ],
         "title": "DrsConstant",
         "type": "object"
      },
      "DrsSpecification": {
         "description": "A DRS specification.",
         "properties": {
            "type": {
               "$ref": "#/$defs/DrsType"
            },
            "separator": {
               "title": "Separator",
               "type": "string"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Properties"
            },
            "parts": {
               "items": {
                  "discriminator": {
                     "mapping": {
                        "collection": "#/$defs/DrsCollection",
                        "constant": "#/$defs/DrsConstant"
                     },
                     "propertyName": "kind"
                  },
                  "oneOf": [
                     {
                        "$ref": "#/$defs/DrsConstant"
                     },
                     {
                        "$ref": "#/$defs/DrsCollection"
                     }
                  ]
               },
               "title": "Parts",
               "type": "array"
            }
         },
         "required": [
            "type",
            "separator",
            "parts"
         ],
         "title": "DrsSpecification",
         "type": "object"
      },
      "DrsType": {
         "description": "The types of DRS specification (directory, file name and dataset id).",
         "enum": [
            "directory",
            "file_name",
            "dataset_id"
         ],
         "title": "DrsType",
         "type": "string"
      },
      "GlobalAttributeSpecBase": {
         "description": "Specification for a global attribute.",
         "properties": {
            "source_collection": {
               "title": "Source Collection",
               "type": "string"
            },
            "value_type": {
               "$ref": "#/$defs/GlobalAttributeValueType"
            }
         },
         "required": [
            "source_collection",
            "value_type"
         ],
         "title": "GlobalAttributeSpecBase",
         "type": "object"
      },
      "GlobalAttributeSpecSpecific": {
         "description": "Specification for a global attribute.\nwith a specific key",
         "properties": {
            "source_collection": {
               "title": "Source Collection",
               "type": "string"
            },
            "value_type": {
               "$ref": "#/$defs/GlobalAttributeValueType"
            },
            "specific_key": {
               "title": "Specific Key",
               "type": "string"
            }
         },
         "required": [
            "source_collection",
            "value_type",
            "specific_key"
         ],
         "title": "GlobalAttributeSpecSpecific",
         "type": "object"
      },
      "GlobalAttributeSpecs": {
         "description": "Container for global attribute specifications.",
         "properties": {
            "specs": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/GlobalAttributeSpecSpecific"
                     },
                     {
                        "$ref": "#/$defs/GlobalAttributeSpecBase"
                     }
                  ]
               },
               "title": "Specs",
               "type": "object"
            }
         },
         "title": "GlobalAttributeSpecs",
         "type": "object"
      },
      "GlobalAttributeValueType": {
         "description": "The types of global attribute values.",
         "enum": [
            "string",
            "integer",
            "float"
         ],
         "title": "GlobalAttributeValueType",
         "type": "string"
      }
   },
   "additionalProperties": true,
   "required": [
      "project_id",
      "description",
      "drs_specs"
   ]
}

field description: str [Required][source]#

The description of the project.

field drs_specs: list[DrsSpecification] [Required][source]#

The DRS specifications of the project (directory, file name and dataset id).

field global_attributes_specs: GlobalAttributeSpecs | None = None[source]#

The global attributes specifications of the project.

field project_id: str [Required][source]#

The project id.

esgvoc.api.project_specs.DrsPart[source]#

A fragment of a DRS specification

alias of Annotated[DrsConstant | DrsCollection, FieldInfo(annotation=NoneType, required=True, discriminator=’kind’)]