Skip to content

Commit

Permalink
updates for other stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
calmacx committed Feb 26, 2024
1 parent 88a7c3a commit e20d725
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 28 deletions.
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
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)
15 changes: 15 additions & 0 deletions hdr_schemata/models/GWDM/v1_2/Access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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",
)
10 changes: 9 additions & 1 deletion hdr_schemata/models/GWDM/v1_2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
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

Expand All @@ -12,3 +14,9 @@ class Gwdm12(Gwdm11):
description="Linkage and enrichment.",
title="Linkage",
)

accessibility: Accessibility = Field(
None,
description="Accessibility information.",
title="Accessibility",
)
14 changes: 14 additions & 0 deletions hdr_schemata/models/HDRUK/v2_2_1/Access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Optional, List
from pydantic import Field
from hdr_schemata.definitions.HDRUK import AccessService

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


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

from .Usage import Usage
from .Access import Access
from .FormatAndStandards import FormatAndStandards

class Accessibility(BaseModel):
class Config:
extra = 'forbid'

usage: Optional[Usage] = Field(
None,
description='This section includes information about how the data can be used and how it is currently being used',
title='Usage',
)
access: Access = Field(
...,
description='This section includes information about data access',
title='Access',
)
formatAndStandards: Optional[FormatAndStandards] = Field(
None,
description='Section includes technical attributes for language vocabularies, sizes etc. and gives researchers facts about and processing the underlying data in the dataset.',
title='Format and Standards',
)
7 changes: 7 additions & 0 deletions hdr_schemata/models/HDRUK/v2_2_1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pydantic import Field

from .EnrichmentAndLinkage import EnrichmentAndLinkage
from .Accessibility import Accessibility


class Hdruk221(Hdruk220):
Expand All @@ -14,6 +15,12 @@ class Hdruk221(Hdruk220):
title="Enrichment and Linkage",
)

accessibility: Accessibility = Field(
...,
description="Accessibility information allows researchers to understand access, usage, limitations, formats, standards and linkage or interoperability with toolsets.",
title="Accessibility",
)

@classmethod
def save_schema(cls, location="./2.2.1/schema.json"):
with open(location, "w") as f:
Expand Down

0 comments on commit e20d725

Please sign in to comment.