Skip to content

Commit 72f0733

Browse files
committed
add experiment_id as required field in Experiment
1 parent 7aeca52 commit 72f0733

4 files changed

Lines changed: 37 additions & 10 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,5 @@ dmypy.json
137137
# Claude AI instruction set
138138
CLAUDE.md
139139
.beads/
140+
141+
examples/

project/jsonschema/oae_data_protocol.schema.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,11 @@
13981398
"title": "End Date and Time",
13991399
"type": "string"
14001400
},
1401+
"experiment_id": {
1402+
"description": "The experiment to which the data belong. Any naming convention that produces a unique ID is usable. The recommended naming convention is:\nProject ID + Experiment type + Optional numerical indicator to differentiate between various experiments of the same type for a project. A two digit consecutive number beginning with 01",
1403+
"title": "Experiment ID",
1404+
"type": "string"
1405+
},
14011406
"experiment_type": {
14021407
"$ref": "#/$defs/ExperimentType",
14031408
"description": "The type of mCDR experiment conducted. See Controlled Vocabularies section for definitions.",
@@ -1458,6 +1463,7 @@
14581463
"required": [
14591464
"description",
14601465
"spatial_coverage",
1466+
"experiment_id",
14611467
"experiment_type",
14621468
"investigators",
14631469
"start_datetime",
@@ -1941,6 +1947,11 @@
19411947
"description": "Whether the feedstock was pre-equilibrated or unequilibrated",
19421948
"title": "Equilibration"
19431949
},
1950+
"experiment_id": {
1951+
"description": "The experiment to which the data belong. Any naming convention that produces a unique ID is usable. The recommended naming convention is:\nProject ID + Experiment type + Optional numerical indicator to differentiate between various experiments of the same type for a project. A two digit consecutive number beginning with 01",
1952+
"title": "Experiment ID",
1953+
"type": "string"
1954+
},
19441955
"experiment_type": {
19451956
"$ref": "#/$defs/ExperimentType",
19461957
"description": "The type of mCDR experiment conducted. See Controlled Vocabularies section for definitions.",
@@ -2014,6 +2025,7 @@
20142025
"dosing_description",
20152026
"description",
20162027
"spatial_coverage",
2028+
"experiment_id",
20172029
"experiment_type",
20182030
"investigators",
20192031
"start_datetime",
@@ -2164,6 +2176,11 @@
21642176
"description": "Whether the feedstock was pre-equilibrated or unequilibrated",
21652177
"title": "Equilibration"
21662178
},
2179+
"experiment_id": {
2180+
"description": "The experiment to which the data belong. Any naming convention that produces a unique ID is usable. The recommended naming convention is:\nProject ID + Experiment type + Optional numerical indicator to differentiate between various experiments of the same type for a project. A two digit consecutive number beginning with 01",
2181+
"title": "Experiment ID",
2182+
"type": "string"
2183+
},
21672184
"experiment_type": {
21682185
"$ref": "#/$defs/ExperimentType",
21692186
"description": "The type of mCDR experiment conducted. See Controlled Vocabularies section for definitions.",
@@ -2255,6 +2272,7 @@
22552272
"dosing_description",
22562273
"description",
22572274
"spatial_coverage",
2275+
"experiment_id",
22582276
"experiment_type",
22592277
"investigators",
22602278
"start_datetime",
@@ -3701,6 +3719,11 @@
37013719
"title": "End Date and Time",
37023720
"type": "string"
37033721
},
3722+
"experiment_id": {
3723+
"description": "The experiment to which the data belong. Any naming convention that produces a unique ID is usable. The recommended naming convention is:\nProject ID + Experiment type + Optional numerical indicator to differentiate between various experiments of the same type for a project. A two digit consecutive number beginning with 01",
3724+
"title": "Experiment ID",
3725+
"type": "string"
3726+
},
37043727
"experiment_type": {
37053728
"$ref": "#/$defs/ExperimentType",
37063729
"description": "The type of mCDR experiment conducted. See Controlled Vocabularies section for definitions.",
@@ -3785,6 +3808,7 @@
37853808
"dosing_description",
37863809
"description",
37873810
"spatial_coverage",
3811+
"experiment_id",
37883812
"experiment_type",
37893813
"investigators",
37903814
"start_datetime",

src/oae_data_protocol/datamodel/oae_data_protocol.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Auto generated from oae_data_protocol.yaml by pythongen.py version: 0.0.1
2-
# Generation date: 2026-01-27T19:02:48
2+
# Generation date: 2026-01-27T19:47:22
33
# Schema: OAEDataManagementProtocol
44
#
55
# id: OAEDataManagementProtocol
@@ -561,11 +561,11 @@ class Experiment(YAMLRoot):
561561

562562
description: str = None
563563
spatial_coverage: Union[dict, SpatialCoverage] = None
564+
experiment_id: str = None
564565
experiment_type: Union[str, "ExperimentType"] = None
565566
investigators: Union[Union[dict, "Person"], List[Union[dict, "Person"]]] = None
566567
start_datetime: Union[str, XSDDateTime] = None
567568
end_datetime: Union[str, XSDDateTime] = None
568-
experiment_id: str = None
569569
name: Optional[str] = None
570570
vertical_coverage: Optional[Union[dict, VerticalExtent]] = None
571571
permits: Optional[Union[Union[dict, Permit], List[Union[dict, Permit]]]] = empty_list()
@@ -584,6 +584,11 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
584584
if not isinstance(self.spatial_coverage, SpatialCoverage):
585585
self.spatial_coverage = SpatialCoverage(**as_dict(self.spatial_coverage))
586586

587+
if self._is_empty(self.experiment_id):
588+
self.MissingRequiredField("experiment_id")
589+
if not isinstance(self.experiment_id, str):
590+
self.experiment_id = str(self.experiment_id)
591+
587592
if self._is_empty(self.experiment_type):
588593
self.MissingRequiredField("experiment_type")
589594
if not isinstance(self.experiment_type, ExperimentType):
@@ -605,11 +610,6 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
605610
if not isinstance(self.end_datetime, XSDDateTime):
606611
self.end_datetime = XSDDateTime(self.end_datetime)
607612

608-
if self._is_empty(self.experiment_id):
609-
self.MissingRequiredField("experiment_id")
610-
if not isinstance(self.experiment_id, str):
611-
self.experiment_id = str(self.experiment_id)
612-
613613
if self.name is not None and not isinstance(self.name, str):
614614
self.name = str(self.name)
615615

@@ -648,11 +648,11 @@ class Intervention(Experiment):
648648

649649
description: str = None
650650
spatial_coverage: Union[dict, SpatialCoverage] = None
651+
experiment_id: str = None
651652
experiment_type: Union[str, "ExperimentType"] = None
652653
investigators: Union[Union[dict, "Person"], List[Union[dict, "Person"]]] = None
653654
start_datetime: Union[str, XSDDateTime] = None
654655
end_datetime: Union[str, XSDDateTime] = None
655-
experiment_id: str = None
656656
alkalinity_feedstock_processing: Union[str, "AlkalinityFeedstockProcessing"] = None
657657
alkalinity_feedstock_form: Union[str, "AlkalinityFeedstockForm"] = None
658658
alkalinity_feedstock: Union[str, "FeedstockType"] = None
@@ -758,11 +758,11 @@ class Tracer(Experiment):
758758

759759
description: str = None
760760
spatial_coverage: Union[dict, SpatialCoverage] = None
761+
experiment_id: str = None
761762
experiment_type: Union[str, "ExperimentType"] = None
762763
investigators: Union[Union[dict, "Person"], List[Union[dict, "Person"]]] = None
763764
start_datetime: Union[str, XSDDateTime] = None
764765
end_datetime: Union[str, XSDDateTime] = None
765-
experiment_id: str = None
766766
tracer_form: Union[str, "TracerForm"] = None
767767
tracer_details: str = None
768768
tracer_concentration: Union[dict, "DosingConcentration"] = None
@@ -837,11 +837,11 @@ class InterventionWithTracer(Intervention):
837837

838838
description: str = None
839839
spatial_coverage: Union[dict, SpatialCoverage] = None
840+
experiment_id: str = None
840841
experiment_type: Union[str, "ExperimentType"] = None
841842
investigators: Union[Union[dict, "Person"], List[Union[dict, "Person"]]] = None
842843
start_datetime: Union[str, XSDDateTime] = None
843844
end_datetime: Union[str, XSDDateTime] = None
844-
experiment_id: str = None
845845
alkalinity_feedstock_processing: Union[str, "AlkalinityFeedstockProcessing"] = None
846846
alkalinity_feedstock_form: Union[str, "AlkalinityFeedstockForm"] = None
847847
alkalinity_feedstock: Union[str, "FeedstockType"] = None

src/oae_data_protocol/schema/experiment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ classes:
1717
- spatial_coverage
1818
- vertical_coverage
1919
- permits
20+
- experiment_id
2021
slot_usage:
2122
experiment_id:
2223
required: true

0 commit comments

Comments
 (0)