Skip to content

Commit

Permalink
use updated measured property for hdruk221 only
Browse files Browse the repository at this point in the history
  • Loading branch information
BSnelling committed May 16, 2024
1 parent 450c3a8 commit 4fa1ceb
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 27 deletions.
5 changes: 2 additions & 3 deletions hdr_schemata/definitions/HDRUK/MeasuredProperty.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pydantic import RootModel, constr
from pydantic import RootModel

class MeasuredProperty(RootModel):
root: constr(min_length=1, max_length=100)

pass

5 changes: 1 addition & 4 deletions hdr_schemata/models/GWDM/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,7 @@
"title": "LongDescription"
},
"MeasuredProperty": {
"maxLength": 100,
"minLength": 1,
"title": "MeasuredProperty",
"type": "string"
"title": "MeasuredProperty"
},
"Name": {
"title": "Name"
Expand Down
5 changes: 1 addition & 4 deletions hdr_schemata/models/GWDM/1.1/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,7 @@
"title": "LongDescription"
},
"MeasuredProperty": {
"maxLength": 100,
"minLength": 1,
"title": "MeasuredProperty",
"type": "string"
"title": "MeasuredProperty"
},
"Name": {
"title": "Name"
Expand Down
5 changes: 1 addition & 4 deletions hdr_schemata/models/GWDM/1.2/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,7 @@
"title": "LongDescription"
},
"MeasuredProperty": {
"maxLength": 100,
"minLength": 1,
"title": "MeasuredProperty",
"type": "string"
"title": "MeasuredProperty"
},
"Name": {
"title": "Name"
Expand Down
5 changes: 1 addition & 4 deletions hdr_schemata/models/HDRUK/2.1.2/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,7 @@
"title": "LongDescription"
},
"MeasuredProperty": {
"maxLength": 100,
"minLength": 1,
"title": "MeasuredProperty",
"type": "string"
"title": "MeasuredProperty"
},
"MemberOf": {
"enum": [
Expand Down
5 changes: 1 addition & 4 deletions hdr_schemata/models/HDRUK/2.1.3/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,7 @@
"title": "LongDescription"
},
"MeasuredProperty": {
"maxLength": 100,
"minLength": 1,
"title": "MeasuredProperty",
"type": "string"
"title": "MeasuredProperty"
},
"MemberOf": {
"enum": [
Expand Down
5 changes: 1 addition & 4 deletions hdr_schemata/models/HDRUK/2.2.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,7 @@
"type": "string"
},
"MeasuredProperty": {
"maxLength": 100,
"minLength": 1,
"title": "MeasuredProperty",
"type": "string"
"title": "MeasuredProperty"
},
"MemberOf": {
"enum": [
Expand Down
5 changes: 5 additions & 0 deletions hdr_schemata/models/HDRUK/v2_2_1/MeasuredProperty.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pydantic import RootModel, constr

class MeasuredProperty(RootModel):
root: constr(min_length=1, max_length=100)

10 changes: 10 additions & 0 deletions hdr_schemata/models/HDRUK/v2_2_1/Observations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from hdr_schemata.models.HDRUK.v2_2_0 import Observation as BaseObservation
from pydantic import Field
from .MeasuredProperty import MeasuredProperty

from .annotations import annotations

an = annotations.observations

class Observation(BaseObservation):
measuredProperty: MeasuredProperty = Field(..., **an.measuredProperty.__dict__)
5 changes: 5 additions & 0 deletions hdr_schemata/models/HDRUK/v2_2_1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .EnrichmentAndLinkage import EnrichmentAndLinkage
from .Accessibility import Accessibility
from .Provenance import Provenance
from .Observations import Observation

from .annotations import annotations as an

Expand All @@ -28,6 +29,10 @@ class Hdruk221(Hdruk220):
None, description=an.provenance.description, title=an.provenance.title
)

observations: List[Observation] = Field(
..., description=an.observations.description, title=an.observations.title
)

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

0 comments on commit 4fa1ceb

Please sign in to comment.