Skip to content

Commit

Permalink
following merge from main - apply schema changes to pydantic and excel
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Blackadder committed Sep 13, 2024
1 parent 5d27568 commit a98d5c1
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 35 deletions.
Binary file modified excel_sheets/Document_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Indicator_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Indicators_db_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Microdata_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Resource_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Script_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Table_metadata.xlsx
Binary file not shown.
Binary file modified excel_sheets/Video_metadata.xlsx
Binary file not shown.
28 changes: 8 additions & 20 deletions pydantic_schemas/document_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: document-schema.json
# timestamp: 2024-09-13T18:34:42+00:00
# timestamp: 2024-09-13T19:00:20+00:00

from __future__ import annotations

Expand All @@ -12,15 +12,6 @@
from .utils.schema_base_model import SchemaBaseModel


class Overwrite(Enum):
"""
Overwrite document if already exists?
"""

yes = "yes"
no = "no"


class Producer(SchemaBaseModel):
name: Optional[str] = Field(None, description="Name (required)", title="Name")
abbr: Optional[str] = Field(None, title="Abbreviation")
Expand Down Expand Up @@ -336,7 +327,7 @@ class ProvenanceSchema(SchemaBaseModel):
origin_description: Optional[OriginDescription] = Field(None, title="Origin description")


class Keyword(SchemaBaseModel):
class KeywordItem(SchemaBaseModel):
name: Optional[str] = Field(None, title="Name")
vocabulary: Optional[str] = Field(None, title="Vocabulary name")
uri: Optional[str] = Field(None, title="Vocabulary URI")
Expand Down Expand Up @@ -482,7 +473,7 @@ class Config:
None, description="Title of a book, part of which is being cited", title="Book title"
)
crossref: Optional[str] = Field(
None, description="The database key of the entry being cross referenced", title="Book title"
None, description="The database key of the entry being cross referenced", title="Cross reference"
)
howpublished: Optional[str] = Field(
None,
Expand All @@ -506,6 +497,9 @@ class Config:
url: Optional[List[str]] = Field(None, description="URL of the document, preferably a permanent URL", title="URL")
translators: Optional[List[Translator]] = Field(None, description="Translators", title="Translators")
contributors: Optional[List[Contributor]] = Field(None, description="Contributors", title="Contributors")
acknowledgement_statement: Optional[str] = Field(
None, description="Acknowledgement statement", title="Acknowledgement statement"
)
contacts: Optional[List[Contact]] = Field(None, description="Contacts", title="Contacts")
rights: Optional[str] = Field(
None, description="Information about rights held in and over the resource.", title="Rights"
Expand Down Expand Up @@ -553,7 +547,7 @@ class Config:
),
title="Data Sources",
)
keywords: Optional[List[Keyword]] = Field(None, description="Keywords", title="Keywords")
keywords: Optional[List[KeywordItem]] = Field(None, description="Keywords", title="Keywords")
themes: Optional[List[Theme]] = Field(None, description="Themes")
topics: Optional[List[Topic]] = Field(
None,
Expand Down Expand Up @@ -585,13 +579,7 @@ class ScriptSchemaDraft(SchemaBaseModel):
Schema for Document data type
"""

repositoryid: Optional[str] = Field(
None,
description="Abbreviation for the collection that owns the document",
title="Collection ID that owns the document",
)
published: Optional[int] = Field(0, description="Status - 0=draft, 1=published", title="Status")
overwrite: Optional[Overwrite] = Field("no", description="Overwrite document if already exists?")
idno: Optional[str] = Field(None, description="Project unique identifier", title="Project unique identifier")
metadata_information: Optional[MetadataInformation] = Field(
None, description="Document description", title="Document metadata information"
)
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/geospatial_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: geospatial-schema.json
# timestamp: 2024-09-13T18:34:45+00:00
# timestamp: 2024-09-13T19:00:22+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/image_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: image-schema.json
# timestamp: 2024-09-13T18:34:48+00:00
# timestamp: 2024-09-13T19:00:23+00:00

from __future__ import annotations

Expand Down
15 changes: 8 additions & 7 deletions pydantic_schemas/indicator_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: timeseries-schema.json
# timestamp: 2024-09-13T18:35:02+00:00
# timestamp: 2024-09-13T19:00:32+00:00

from __future__ import annotations

Expand Down Expand Up @@ -85,10 +85,17 @@ class Language(SchemaBaseModel):
code: Optional[str] = Field(None, title="code")


class CodeListItem(SchemaBaseModel):
code: Optional[str] = Field(None, title="Code")
label: Optional[str] = Field(None, title="Label")
description: Optional[str] = Field(None, title="Description")


class Dimension(SchemaBaseModel):
name: Optional[str] = Field(None, title="Name")
label: str = Field(..., title="Label")
description: Optional[str] = Field(None, title="Description")
code_list: Optional[List[CodeListItem]] = Field(None, title="Code list")


class DefinitionReference(SchemaBaseModel):
Expand Down Expand Up @@ -569,12 +576,6 @@ class TimePeriodFormat(Enum):
YYYY_MM_DDTHH_MM_SSZ = "YYYY-MM-DDTHH:MM:SSZ"


class CodeListItem(SchemaBaseModel):
code: Optional[str] = Field(None, title="Code")
label: Optional[str] = Field(None, title="Label")
description: Optional[str] = Field(None, title="Description")


class CodeListReference(SchemaBaseModel):
id: Optional[str] = Field(None, title="Identifier (ID)")
name: Optional[str] = Field(None, title="Name")
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/indicators_db_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: timeseries-db-schema.json
# timestamp: 2024-09-13T18:35:00+00:00
# timestamp: 2024-09-13T19:00:30+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/microdata_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: microdata-schema.json
# timestamp: 2024-09-13T18:34:51+00:00
# timestamp: 2024-09-13T19:00:25+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/resource_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: resource-schema.json
# timestamp: 2024-09-13T18:34:53+00:00
# timestamp: 2024-09-13T19:00:26+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/script_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: script-schema.json
# timestamp: 2024-09-13T18:34:55+00:00
# timestamp: 2024-09-13T19:00:27+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/table_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: table-schema.json
# timestamp: 2024-09-13T18:34:58+00:00
# timestamp: 2024-09-13T19:00:29+00:00

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemas/video_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: video-schema.json
# timestamp: 2024-09-13T18:35:04+00:00
# timestamp: 2024-09-13T19:00:33+00:00

from __future__ import annotations

Expand Down

0 comments on commit a98d5c1

Please sign in to comment.