Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GWDM 1.2 and associated public schema (HDRUK 2.2.1) #27

Merged
merged 6 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion available.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"2.1.3",
"2.1.0",
"2.0.2",
"2.2.1",
"2.2.0"
],
"GWDM": [
"1.0",
"1.1"
"1.1",
"1.2"
],
"SchemaOrg": [
"default",
Expand Down
1,335 changes: 1,335 additions & 0 deletions docs/GWDM/1.2.md

Large diffs are not rendered by default.

1,719 changes: 1,719 additions & 0 deletions docs/GWDM/1.2.structure.json

Large diffs are not rendered by default.

1,073 changes: 1,073 additions & 0 deletions docs/HDRUK/2.2.1.md

Large diffs are not rendered by default.

1,387 changes: 1,387 additions & 0 deletions docs/HDRUK/2.2.1.structure.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions hdr_schemata/definitions/HDRUK/AccessService.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum


class AccessService(Enum):
TRE_SDE = "TRE/SDE"
DIRECT_ACCESS = "Direct access"
OPEN_ACCESS = "Open access"
VARIED = "Varies based on project"
1 change: 1 addition & 0 deletions hdr_schemata/definitions/HDRUK/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .AbstractText import AbstractText
from .AccessService import AccessService
from .AgeRange import AgeRange
from .CommaSeparatedIntegers import CommaSeparatedIntegers
from .CommaSeparatedValues import CommaSeparatedValues
Expand Down
1,949 changes: 1,949 additions & 0 deletions hdr_schemata/models/GWDM/1.2/schema.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions hdr_schemata/models/GWDM/create_json_schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pydantic import ValidationError
from v1_0 import Gwdm10
from v1_1 import Gwdm11
import json
from v1_2 import Gwdm12

Gwdm10.save_schema("1.0/schema.json")
Gwdm11.save_schema("1.1/schema.json")
Gwdm12.save_schema("1.2/schema.json")
53 changes: 26 additions & 27 deletions hdr_schemata/models/GWDM/v1_0/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,61 @@
from .Linkage import Linkage
from .Observations import Observation
from .DataTable import DataTable

from .Usage import Usage
from .Access import Access


class Gwdm10(BaseModel):
class Config:
extra = 'forbid'
extra = "forbid"

required: Required = Field(
...,
description='required metadata needed for the GWDM',
title='Required'
..., description="required metadata needed for the GWDM", title="Required"
)

summary: Summary = Field(
...,
description='Summary of metadata describing key pieces of information.',
title='Summary',
description="Summary of metadata describing key pieces of information.",
title="Summary",
)

coverage: Optional[Coverage] = Field(
None,
description='Spatial and Temporal coverage',
title='Coverage',
description="Spatial and Temporal coverage",
title="Coverage",
)

provenance: Optional[Provenance] = Field(
None,
description='Provenance information',
title='Provenance',
description="Provenance information",
title="Provenance",
)

accessibility: Accessibility = Field(
None,
description='Accessibility information.',
title='Accessibility',
description="Accessibility information.",
title="Accessibility",
)

linkage: Optional[Linkage] = Field(
None,
description='Linkage and enrichment.',
title='Linkage',
description="Linkage and enrichment.",
title="Linkage",
)

observations: Optional[List[Observation]] = Field(
None,
description='Obsservations',
title='Observations',
description="Obsservations",
title="Observations",
)
structuralMetadata: Optional[List[DataTable]] = Field(
None,
description='Descriptions of all tables and data elements that can be included in the dataset',
title='Structural Metadata',
description="Descriptions of all tables and data elements that can be included in the dataset",
title="Structural Metadata",
)


@classmethod
def save_schema(cls,location='./1.0/schema.json'):
with open(location,'w') as f:
json.dump(cls.model_json_schema(),f,indent=6)

def save_schema(cls, location="./1.0/schema.json"):
with open(location, "w") as f:
json.dump(cls.model_json_schema(), f, indent=6)
4 changes: 3 additions & 1 deletion hdr_schemata/models/GWDM/v1_1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from hdr_schemata.models.GWDM import Gwdm10

from hdr_schemata.models.GWDM.v1_0 import *
from .Coverage import Coverage
from .Accessibility import Accessibility
from .Required import Required
from .Summary import Summary
from .TissuesSampleCollection import TissuesSampleCollection
from typing import Optional,List
from typing import Optional, List
from pydantic import Field


Expand Down
14 changes: 14 additions & 0 deletions hdr_schemata/models/GWDM/v1_2/Access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Optional
from pydantic import Field
from hdr_schemata.definitions.HDRUK import CommaSeparatedValues

from hdr_schemata.models.GWDM.v1_1 import Access as BaseAccess


class Access(BaseAccess):
accessServiceCategory: Optional[CommaSeparatedValues] = Field(
None,
description="Where access to data come from: TRE/SED, direct access, open acccess, varies based on project.",
example="",
title="Access/governance requirementss",
)
13 changes: 13 additions & 0 deletions hdr_schemata/models/GWDM/v1_2/Accessibility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pydantic import Field
from hdr_schemata.definitions.HDRUK import *

from hdr_schemata.models.GWDM.v1_1 import Accessibility as BaseAccessibility
from .Access import Access


class Accessibility(BaseAccessibility):
access: Access = Field(
...,
description="This section includes information about data access",
title="Access",
)
13 changes: 13 additions & 0 deletions hdr_schemata/models/GWDM/v1_2/Linkage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Optional
from hdr_schemata.models.GWDM.v1_1 import Linkage as BaseLinkage
from pydantic import Field
from hdr_schemata.definitions.HDRUK import CommaSeparatedValues


class Linkage(BaseLinkage):
syntheticDataWebLink: Optional[CommaSeparatedValues] = Field(
None,
description="Links to locations of information and or raw downloads of synthetic data associated with this dataset",
example="",
title="Synthetic Data Web Links",
)
22 changes: 22 additions & 0 deletions hdr_schemata/models/GWDM/v1_2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from hdr_schemata.models.GWDM import Gwdm11
from hdr_schemata.models.GWDM.v1_1 import *

from .Accessibility import Accessibility
from .Linkage import Linkage

from typing import Optional, List
from pydantic import Field


class Gwdm12(Gwdm11):
linkage: Optional[Linkage] = Field(
None,
description="Linkage and enrichment.",
title="Linkage",
)

accessibility: Accessibility = Field(
None,
description="Accessibility information.",
title="Accessibility",
)
Loading
Loading