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.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"
      }
   },
   "$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"
      }
   },
   "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 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’)]