-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinclude_access_model.py
More file actions
1922 lines (1519 loc) · 87.3 KB
/
include_access_model.py
File metadata and controls
1922 lines (1519 loc) · 87.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Auto generated from include_access_model.yaml by pythongen.py version: 0.0.1
# Generation date: 2026-03-12T11:07:16
# Schema: include-access-model
#
# id: https://includedcc.org/include-access-model
# description: LinkML Schema for the internal INCLUDE DCC Access Model
# license: MIT
import dataclasses
import re
from dataclasses import dataclass
from datetime import (
date,
datetime,
time
)
from typing import (
Any,
ClassVar,
Dict,
List,
Optional,
Union
)
from jsonasobj2 import (
JsonObj,
as_dict
)
from linkml_runtime.linkml_model.meta import (
EnumDefinition,
PermissibleValue,
PvFormulaOptions
)
from linkml_runtime.utils.curienamespace import CurieNamespace
from linkml_runtime.utils.enumerations import EnumDefinitionImpl
from linkml_runtime.utils.formatutils import (
camelcase,
sfx,
underscore
)
from linkml_runtime.utils.metamodelcore import (
bnode,
empty_dict,
empty_list
)
from linkml_runtime.utils.slot import Slot
from linkml_runtime.utils.yamlutils import (
YAMLRoot,
extended_float,
extended_int,
extended_str
)
from rdflib import (
Namespace,
URIRef
)
from linkml_runtime.linkml_model.types import Float, Integer, String, Uri, Uriorcurie
from linkml_runtime.utils.metamodelcore import URI, URIorCURIE
metamodel_version = "1.7.0"
version = None
# Namespaces
HP = CurieNamespace('HP', 'http://purl.obolibrary.org/obo/HP_')
MONDO = CurieNamespace('MONDO', 'http://purl.obolibrary.org/obo/MONDO_')
NCIT = CurieNamespace('NCIT', 'http://purl.obolibrary.org/obo/NCIT_')
PATO = CurieNamespace('PATO', 'http://purl.obolibrary.org/obo/PATO_')
CDC_RACE_ETH = CurieNamespace('cdc_race_eth', 'urn:oid:2.16.840.1.113883.6.238/')
HL7_NULL = CurieNamespace('hl7_null', 'http://terminology.hl7.org/CodeSystem/v3-NullFlavor/')
IG2_BIOSPECIMEN_AVAILABILITY = CurieNamespace('ig2_biospecimen_availability', 'https://nih-ncpi.github.io/ncpi-fhir-ig-2/CodeSystem/biospecimen-availability/')
IG2DAC = CurieNamespace('ig2dac', 'https://nih-ncpi.github.io/ncpi-fhir-ig-2/CodeSystem/research-data-access-code/')
IG2DAT = CurieNamespace('ig2dat', 'https://nih-ncpi.github.io/ncpi-fhir-ig-2/CodeSystem/research-data-access-type/')
IG_DOB_METHOD = CurieNamespace('ig_dob_method', 'https://nih-ncpi.github.io/ncpi-fhir-ig-2/CodeSystem/research-data-date-of-birth-method/')
IGCONDTYPE = CurieNamespace('igcondtype', 'https://nih-ncpi.github.io/ncpi-fhir-ig-2/CodeSystem/condition-type/')
INCLUDEDCC = CurieNamespace('includedcc', 'https://includedcc.org/include-access-model/')
LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/')
MESH = CurieNamespace('mesh', 'http://id.nlm.nih.gov/mesh/')
SCHEMA = CurieNamespace('schema', 'http://schema.org/')
SNOMED_CT = CurieNamespace('snomed_ct', 'http://snomed.info/id/')
DEFAULT_ = INCLUDEDCC
# Types
# Class references
class StudyStudyId(extended_str):
pass
class StudyMetadataStudyId(StudyStudyId):
pass
class DOIDoId(extended_str):
pass
class SubjectSubjectId(extended_str):
pass
class DemographicsSubjectId(SubjectSubjectId):
pass
class SubjectAssertionAssertionId(extended_str):
pass
class ConceptConceptCurie(URIorCURIE):
pass
class SampleSampleId(extended_str):
pass
class BiospecimenCollectionBiospecimenCollectionId(extended_str):
pass
class AliquotAliquotId(extended_str):
pass
class EncounterEncounterId(extended_str):
pass
class EncounterDefinitionEncounterDefinitionId(extended_str):
pass
class ActivityDefinitionActivityDefinitionId(extended_str):
pass
class FileFileId(extended_str):
pass
class DatasetDatasetId(extended_str):
pass
@dataclass(repr=False)
class Record(YAMLRoot):
"""
One row / entity within the database
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Record"]
class_class_curie: ClassVar[str] = "includedcc:Record"
class_name: ClassVar[str] = "Record"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Record
external_id: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list()
def __post_init__(self, *_: str, **kwargs: Any):
if not isinstance(self.external_id, list):
self.external_id = [self.external_id] if self.external_id is not None else []
self.external_id = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.external_id]
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Study(Record):
"""
Study Metadata
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Study"]
class_class_curie: ClassVar[str] = "includedcc:Study"
class_name: ClassVar[str] = "Study"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Study
study_id: Union[str, StudyStudyId] = None
study_title: str = None
study_code: str = None
program: Union[Union[str, "EnumProgram"], list[Union[str, "EnumProgram"]]] = None
principal_investigator: Union[Union[dict, "Investigator"], list[Union[dict, "Investigator"]]] = None
contact: Union[Union[dict, "Investigator"], list[Union[dict, "Investigator"]]] = None
study_description: str = None
parent_study: Optional[Union[str, StudyStudyId]] = None
study_short_name: Optional[str] = None
funding_source: Optional[Union[str, list[str]]] = empty_list()
website: Optional[Union[str, URI]] = None
publication: Optional[Union[Union[dict, "Publication"], list[Union[dict, "Publication"]]]] = empty_list()
acknowledgments: Optional[str] = None
citation_statement: Optional[str] = None
do_id: Optional[Union[str, DOIDoId]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.study_id):
self.MissingRequiredField("study_id")
if not isinstance(self.study_id, StudyStudyId):
self.study_id = StudyStudyId(self.study_id)
if self._is_empty(self.study_title):
self.MissingRequiredField("study_title")
if not isinstance(self.study_title, str):
self.study_title = str(self.study_title)
if self._is_empty(self.study_code):
self.MissingRequiredField("study_code")
if not isinstance(self.study_code, str):
self.study_code = str(self.study_code)
if self._is_empty(self.program):
self.MissingRequiredField("program")
if not isinstance(self.program, list):
self.program = [self.program] if self.program is not None else []
self.program = [v if isinstance(v, EnumProgram) else EnumProgram(v) for v in self.program]
if self._is_empty(self.principal_investigator):
self.MissingRequiredField("principal_investigator")
if not isinstance(self.principal_investigator, list):
self.principal_investigator = [self.principal_investigator] if self.principal_investigator is not None else []
self.principal_investigator = [v if isinstance(v, Investigator) else Investigator(**as_dict(v)) for v in self.principal_investigator]
if self._is_empty(self.contact):
self.MissingRequiredField("contact")
if not isinstance(self.contact, list):
self.contact = [self.contact] if self.contact is not None else []
self.contact = [v if isinstance(v, Investigator) else Investigator(**as_dict(v)) for v in self.contact]
if self._is_empty(self.study_description):
self.MissingRequiredField("study_description")
if not isinstance(self.study_description, str):
self.study_description = str(self.study_description)
if self.parent_study is not None and not isinstance(self.parent_study, StudyStudyId):
self.parent_study = StudyStudyId(self.parent_study)
if self.study_short_name is not None and not isinstance(self.study_short_name, str):
self.study_short_name = str(self.study_short_name)
if not isinstance(self.funding_source, list):
self.funding_source = [self.funding_source] if self.funding_source is not None else []
self.funding_source = [v if isinstance(v, str) else str(v) for v in self.funding_source]
if self.website is not None and not isinstance(self.website, URI):
self.website = URI(self.website)
if not isinstance(self.publication, list):
self.publication = [self.publication] if self.publication is not None else []
self.publication = [v if isinstance(v, Publication) else Publication(**as_dict(v)) for v in self.publication]
if self.acknowledgments is not None and not isinstance(self.acknowledgments, str):
self.acknowledgments = str(self.acknowledgments)
if self.citation_statement is not None and not isinstance(self.citation_statement, str):
self.citation_statement = str(self.citation_statement)
if self.do_id is not None and not isinstance(self.do_id, DOIDoId):
self.do_id = DOIDoId(self.do_id)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class StudyMetadata(Record):
"""
Additional features about studies that may not apply to all studies
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["StudyMetadata"]
class_class_curie: ClassVar[str] = "includedcc:StudyMetadata"
class_name: ClassVar[str] = "StudyMetadata"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.StudyMetadata
study_id: Union[str, StudyMetadataStudyId] = None
participant_lifespan_stage: Union[Union[str, "EnumParticipantLifespanStage"], list[Union[str, "EnumParticipantLifespanStage"]]] = None
study_design: Union[Union[str, "EnumStudyDesign"], list[Union[str, "EnumStudyDesign"]]] = None
clinical_data_source_type: Union[Union[str, "EnumClinicalDataSourceType"], list[Union[str, "EnumClinicalDataSourceType"]]] = None
data_category: Union[Union[str, "EnumDataCategory"], list[Union[str, "EnumDataCategory"]]] = None
research_domain: Union[Union[str, "EnumResearchDomain"], list[Union[str, "EnumResearchDomain"]]] = None
expected_number_of_participants: int = None
actual_number_of_participants: int = None
selection_criteria: Optional[str] = None
vbr: Optional[Union[dict, "VirtualBiorepository"]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.study_id):
self.MissingRequiredField("study_id")
if not isinstance(self.study_id, StudyMetadataStudyId):
self.study_id = StudyMetadataStudyId(self.study_id)
if self._is_empty(self.participant_lifespan_stage):
self.MissingRequiredField("participant_lifespan_stage")
if not isinstance(self.participant_lifespan_stage, list):
self.participant_lifespan_stage = [self.participant_lifespan_stage] if self.participant_lifespan_stage is not None else []
self.participant_lifespan_stage = [v if isinstance(v, EnumParticipantLifespanStage) else EnumParticipantLifespanStage(v) for v in self.participant_lifespan_stage]
if self._is_empty(self.study_design):
self.MissingRequiredField("study_design")
if not isinstance(self.study_design, list):
self.study_design = [self.study_design] if self.study_design is not None else []
self.study_design = [v if isinstance(v, EnumStudyDesign) else EnumStudyDesign(v) for v in self.study_design]
if self._is_empty(self.clinical_data_source_type):
self.MissingRequiredField("clinical_data_source_type")
if not isinstance(self.clinical_data_source_type, list):
self.clinical_data_source_type = [self.clinical_data_source_type] if self.clinical_data_source_type is not None else []
self.clinical_data_source_type = [v if isinstance(v, EnumClinicalDataSourceType) else EnumClinicalDataSourceType(v) for v in self.clinical_data_source_type]
if self._is_empty(self.data_category):
self.MissingRequiredField("data_category")
if not isinstance(self.data_category, list):
self.data_category = [self.data_category] if self.data_category is not None else []
self.data_category = [v if isinstance(v, EnumDataCategory) else EnumDataCategory(v) for v in self.data_category]
if self._is_empty(self.research_domain):
self.MissingRequiredField("research_domain")
if not isinstance(self.research_domain, list):
self.research_domain = [self.research_domain] if self.research_domain is not None else []
self.research_domain = [v if isinstance(v, EnumResearchDomain) else EnumResearchDomain(v) for v in self.research_domain]
if self._is_empty(self.expected_number_of_participants):
self.MissingRequiredField("expected_number_of_participants")
if not isinstance(self.expected_number_of_participants, int):
self.expected_number_of_participants = int(self.expected_number_of_participants)
if self._is_empty(self.actual_number_of_participants):
self.MissingRequiredField("actual_number_of_participants")
if not isinstance(self.actual_number_of_participants, int):
self.actual_number_of_participants = int(self.actual_number_of_participants)
if self.selection_criteria is not None and not isinstance(self.selection_criteria, str):
self.selection_criteria = str(self.selection_criteria)
if self.vbr is not None and not isinstance(self.vbr, VirtualBiorepository):
self.vbr = VirtualBiorepository(**as_dict(self.vbr))
super().__post_init__(**kwargs)
@dataclass(repr=False)
class VirtualBiorepository(Record):
"""
An organization that can provide access to specimen for further analysis.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["VirtualBiorepository"]
class_class_curie: ClassVar[str] = "includedcc:VirtualBiorepository"
class_name: ClassVar[str] = "VirtualBiorepository"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.VirtualBiorepository
contact: Union[Union[dict, "Investigator"], list[Union[dict, "Investigator"]]] = None
name: Optional[str] = None
institution: Optional[str] = None
website: Optional[Union[str, URI]] = None
vbr_readme: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.contact):
self.MissingRequiredField("contact")
if not isinstance(self.contact, list):
self.contact = [self.contact] if self.contact is not None else []
self.contact = [v if isinstance(v, Investigator) else Investigator(**as_dict(v)) for v in self.contact]
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
if self.institution is not None and not isinstance(self.institution, str):
self.institution = str(self.institution)
if self.website is not None and not isinstance(self.website, URI):
self.website = URI(self.website)
if self.vbr_readme is not None and not isinstance(self.vbr_readme, str):
self.vbr_readme = str(self.vbr_readme)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class DOI(Record):
"""
A DOI is a permanent reference with metadata about a digital object.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["DOI"]
class_class_curie: ClassVar[str] = "includedcc:DOI"
class_name: ClassVar[str] = "DOI"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.DOI
do_id: Union[str, DOIDoId] = None
bibliographic_reference: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.do_id):
self.MissingRequiredField("do_id")
if not isinstance(self.do_id, DOIDoId):
self.do_id = DOIDoId(self.do_id)
if self.bibliographic_reference is not None and not isinstance(self.bibliographic_reference, str):
self.bibliographic_reference = str(self.bibliographic_reference)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Investigator(Record):
"""
An individual who made contributions to the collection, analysis, or sharing of data.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Investigator"]
class_class_curie: ClassVar[str] = "includedcc:Investigator"
class_name: ClassVar[str] = "Investigator"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Investigator
name: Optional[str] = None
institution: Optional[str] = None
investigator_title: Optional[str] = None
email: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
if self.institution is not None and not isinstance(self.institution, str):
self.institution = str(self.institution)
if self.investigator_title is not None and not isinstance(self.investigator_title, str):
self.investigator_title = str(self.investigator_title)
if self.email is not None and not isinstance(self.email, str):
self.email = str(self.email)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Publication(Record):
"""
Information about a specific publication.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Publication"]
class_class_curie: ClassVar[str] = "includedcc:Publication"
class_name: ClassVar[str] = "Publication"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Publication
bibliographic_reference: Optional[str] = None
website: Optional[Union[str, URI]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self.bibliographic_reference is not None and not isinstance(self.bibliographic_reference, str):
self.bibliographic_reference = str(self.bibliographic_reference)
if self.website is not None and not isinstance(self.website, URI):
self.website = URI(self.website)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Subject(Record):
"""
This entity is the subject about which data or references are recorded. This includes the idea of a human
participant in a study, a cell line, an animal model, or any other similar entity.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Subject"]
class_class_curie: ClassVar[str] = "includedcc:Subject"
class_name: ClassVar[str] = "Subject"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Subject
subject_id: Union[str, SubjectSubjectId] = None
subject_type: Union[str, "EnumSubjectType"] = None
organism_type: Optional[Union[str, URIorCURIE]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.subject_id):
self.MissingRequiredField("subject_id")
if not isinstance(self.subject_id, SubjectSubjectId):
self.subject_id = SubjectSubjectId(self.subject_id)
if self._is_empty(self.subject_type):
self.MissingRequiredField("subject_type")
if not isinstance(self.subject_type, EnumSubjectType):
self.subject_type = EnumSubjectType(self.subject_type)
if self.organism_type is not None and not isinstance(self.organism_type, URIorCURIE):
self.organism_type = URIorCURIE(self.organism_type)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Demographics(Record):
"""
Basic participant demographics summary
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Demographics"]
class_class_curie: ClassVar[str] = "includedcc:Demographics"
class_name: ClassVar[str] = "Demographics"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Demographics
subject_id: Union[str, DemographicsSubjectId] = None
sex: Union[str, "EnumSex"] = None
race: Union[Union[str, "EnumRace"], list[Union[str, "EnumRace"]]] = None
ethnicity: Union[str, "EnumEthnicity"] = None
down_syndrome_status: Union[str, "EnumDownSyndromeStatus"] = None
age_at_last_vital_status: Optional[int] = None
vital_status: Optional[Union[str, "EnumVitalStatus"]] = None
age_at_first_engagement: Optional[int] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.subject_id):
self.MissingRequiredField("subject_id")
if not isinstance(self.subject_id, DemographicsSubjectId):
self.subject_id = DemographicsSubjectId(self.subject_id)
if self._is_empty(self.sex):
self.MissingRequiredField("sex")
if not isinstance(self.sex, EnumSex):
self.sex = EnumSex(self.sex)
if self._is_empty(self.race):
self.MissingRequiredField("race")
if not isinstance(self.race, list):
self.race = [self.race] if self.race is not None else []
self.race = [v if isinstance(v, EnumRace) else EnumRace(v) for v in self.race]
if self._is_empty(self.ethnicity):
self.MissingRequiredField("ethnicity")
if not isinstance(self.ethnicity, EnumEthnicity):
self.ethnicity = EnumEthnicity(self.ethnicity)
if self._is_empty(self.down_syndrome_status):
self.MissingRequiredField("down_syndrome_status")
if not isinstance(self.down_syndrome_status, EnumDownSyndromeStatus):
self.down_syndrome_status = EnumDownSyndromeStatus(self.down_syndrome_status)
if self.age_at_last_vital_status is not None and not isinstance(self.age_at_last_vital_status, int):
self.age_at_last_vital_status = int(self.age_at_last_vital_status)
if self.vital_status is not None and not isinstance(self.vital_status, EnumVitalStatus):
self.vital_status = EnumVitalStatus(self.vital_status)
if self.age_at_first_engagement is not None and not isinstance(self.age_at_first_engagement, int):
self.age_at_first_engagement = int(self.age_at_first_engagement)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class SubjectAssertion(Record):
"""
Assertion about a particular Subject. May include Conditions, Measurements, etc.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["SubjectAssertion"]
class_class_curie: ClassVar[str] = "includedcc:SubjectAssertion"
class_name: ClassVar[str] = "SubjectAssertion"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.SubjectAssertion
assertion_id: Union[str, SubjectAssertionAssertionId] = None
subject_id: Optional[Union[str, SubjectSubjectId]] = None
encounter_id: Optional[Union[str, EncounterEncounterId]] = None
assertion_provenance: Optional[Union[str, "EnumAssertionProvenance"]] = None
age_at_assertion: Optional[int] = None
age_at_event: Optional[int] = None
age_at_resolution: Optional[int] = None
concept: Optional[Union[Union[str, ConceptConceptCurie], list[Union[str, ConceptConceptCurie]]]] = empty_list()
concept_source: Optional[str] = None
value_concept: Optional[Union[Union[str, ConceptConceptCurie], list[Union[str, ConceptConceptCurie]]]] = empty_list()
value_number: Optional[float] = None
value_source: Optional[str] = None
value_unit: Optional[Union[str, ConceptConceptCurie]] = None
value_unit_source: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.assertion_id):
self.MissingRequiredField("assertion_id")
if not isinstance(self.assertion_id, SubjectAssertionAssertionId):
self.assertion_id = SubjectAssertionAssertionId(self.assertion_id)
if self.subject_id is not None and not isinstance(self.subject_id, SubjectSubjectId):
self.subject_id = SubjectSubjectId(self.subject_id)
if self.encounter_id is not None and not isinstance(self.encounter_id, EncounterEncounterId):
self.encounter_id = EncounterEncounterId(self.encounter_id)
if self.assertion_provenance is not None and not isinstance(self.assertion_provenance, EnumAssertionProvenance):
self.assertion_provenance = EnumAssertionProvenance(self.assertion_provenance)
if self.age_at_assertion is not None and not isinstance(self.age_at_assertion, int):
self.age_at_assertion = int(self.age_at_assertion)
if self.age_at_event is not None and not isinstance(self.age_at_event, int):
self.age_at_event = int(self.age_at_event)
if self.age_at_resolution is not None and not isinstance(self.age_at_resolution, int):
self.age_at_resolution = int(self.age_at_resolution)
if not isinstance(self.concept, list):
self.concept = [self.concept] if self.concept is not None else []
self.concept = [v if isinstance(v, ConceptConceptCurie) else ConceptConceptCurie(v) for v in self.concept]
if self.concept_source is not None and not isinstance(self.concept_source, str):
self.concept_source = str(self.concept_source)
if not isinstance(self.value_concept, list):
self.value_concept = [self.value_concept] if self.value_concept is not None else []
self.value_concept = [v if isinstance(v, ConceptConceptCurie) else ConceptConceptCurie(v) for v in self.value_concept]
if self.value_number is not None and not isinstance(self.value_number, float):
self.value_number = float(self.value_number)
if self.value_source is not None and not isinstance(self.value_source, str):
self.value_source = str(self.value_source)
if self.value_unit is not None and not isinstance(self.value_unit, ConceptConceptCurie):
self.value_unit = ConceptConceptCurie(self.value_unit)
if self.value_unit_source is not None and not isinstance(self.value_unit_source, str):
self.value_unit_source = str(self.value_unit_source)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Concept(YAMLRoot):
"""
A standardized concept with display information.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Concept"]
class_class_curie: ClassVar[str] = "includedcc:Concept"
class_name: ClassVar[str] = "Concept"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Concept
concept_curie: Union[str, ConceptConceptCurie] = None
display: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.concept_curie):
self.MissingRequiredField("concept_curie")
if not isinstance(self.concept_curie, ConceptConceptCurie):
self.concept_curie = ConceptConceptCurie(self.concept_curie)
if self.display is not None and not isinstance(self.display, str):
self.display = str(self.display)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Sample(Record):
"""
A functionally equivalent specimen taken from a participant or processed from such a sample.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Sample"]
class_class_curie: ClassVar[str] = "includedcc:Sample"
class_name: ClassVar[str] = "Sample"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Sample
sample_id: Union[str, SampleSampleId] = None
sample_type: Union[str, URIorCURIE] = None
biospecimen_collection_id: Optional[Union[str, BiospecimenCollectionBiospecimenCollectionId]] = None
parent_sample_id: Optional[Union[str, SampleSampleId]] = None
processing: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list()
availablity_status: Optional[Union[str, "EnumAvailabilityStatus"]] = None
storage_method: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list()
quantity_number: Optional[float] = None
quantity_unit: Optional[Union[str, ConceptConceptCurie]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.sample_id):
self.MissingRequiredField("sample_id")
if not isinstance(self.sample_id, SampleSampleId):
self.sample_id = SampleSampleId(self.sample_id)
if self._is_empty(self.sample_type):
self.MissingRequiredField("sample_type")
if not isinstance(self.sample_type, URIorCURIE):
self.sample_type = URIorCURIE(self.sample_type)
if self.biospecimen_collection_id is not None and not isinstance(self.biospecimen_collection_id, BiospecimenCollectionBiospecimenCollectionId):
self.biospecimen_collection_id = BiospecimenCollectionBiospecimenCollectionId(self.biospecimen_collection_id)
if self.parent_sample_id is not None and not isinstance(self.parent_sample_id, SampleSampleId):
self.parent_sample_id = SampleSampleId(self.parent_sample_id)
if not isinstance(self.processing, list):
self.processing = [self.processing] if self.processing is not None else []
self.processing = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.processing]
if self.availablity_status is not None and not isinstance(self.availablity_status, EnumAvailabilityStatus):
self.availablity_status = EnumAvailabilityStatus(self.availablity_status)
if not isinstance(self.storage_method, list):
self.storage_method = [self.storage_method] if self.storage_method is not None else []
self.storage_method = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.storage_method]
if self.quantity_number is not None and not isinstance(self.quantity_number, float):
self.quantity_number = float(self.quantity_number)
if self.quantity_unit is not None and not isinstance(self.quantity_unit, ConceptConceptCurie):
self.quantity_unit = ConceptConceptCurie(self.quantity_unit)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class BiospecimenCollection(Record):
"""
A biospecimen collection event which yields one or more Samples.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["BiospecimenCollection"]
class_class_curie: ClassVar[str] = "includedcc:BiospecimenCollection"
class_name: ClassVar[str] = "BiospecimenCollection"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.BiospecimenCollection
biospecimen_collection_id: Union[str, BiospecimenCollectionBiospecimenCollectionId] = None
age_at_collection: Optional[float] = None
method: Optional[Union[str, "EnumSampleCollectionMethod"]] = None
site: Optional[Union[str, "EnumSite"]] = None
spatial_qualifier: Optional[Union[str, "EnumSpatialQualifiers"]] = None
laterality: Optional[Union[str, "EnumLaterality"]] = None
encounter_id: Optional[Union[str, EncounterEncounterId]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.biospecimen_collection_id):
self.MissingRequiredField("biospecimen_collection_id")
if not isinstance(self.biospecimen_collection_id, BiospecimenCollectionBiospecimenCollectionId):
self.biospecimen_collection_id = BiospecimenCollectionBiospecimenCollectionId(self.biospecimen_collection_id)
if self.age_at_collection is not None and not isinstance(self.age_at_collection, float):
self.age_at_collection = float(self.age_at_collection)
if self.encounter_id is not None and not isinstance(self.encounter_id, EncounterEncounterId):
self.encounter_id = EncounterEncounterId(self.encounter_id)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Aliquot(Record):
"""
A specific tube or amount of a biospecimen associated with a Sample.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Aliquot"]
class_class_curie: ClassVar[str] = "includedcc:Aliquot"
class_name: ClassVar[str] = "Aliquot"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Aliquot
aliquot_id: Union[str, AliquotAliquotId] = None
sample_id: Optional[Union[str, SampleSampleId]] = None
availablity_status: Optional[Union[str, "EnumAvailabilityStatus"]] = None
quantity_number: Optional[float] = None
quantity_unit: Optional[Union[str, ConceptConceptCurie]] = None
concentration_number: Optional[float] = None
concentration_unit: Optional[Union[str, ConceptConceptCurie]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.aliquot_id):
self.MissingRequiredField("aliquot_id")
if not isinstance(self.aliquot_id, AliquotAliquotId):
self.aliquot_id = AliquotAliquotId(self.aliquot_id)
if self.sample_id is not None and not isinstance(self.sample_id, SampleSampleId):
self.sample_id = SampleSampleId(self.sample_id)
if self.availablity_status is not None and not isinstance(self.availablity_status, EnumAvailabilityStatus):
self.availablity_status = EnumAvailabilityStatus(self.availablity_status)
if self.quantity_number is not None and not isinstance(self.quantity_number, float):
self.quantity_number = float(self.quantity_number)
if self.quantity_unit is not None and not isinstance(self.quantity_unit, ConceptConceptCurie):
self.quantity_unit = ConceptConceptCurie(self.quantity_unit)
if self.concentration_number is not None and not isinstance(self.concentration_number, float):
self.concentration_number = float(self.concentration_number)
if self.concentration_unit is not None and not isinstance(self.concentration_unit, ConceptConceptCurie):
self.concentration_unit = ConceptConceptCurie(self.concentration_unit)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class Encounter(Record):
"""
An event at which data was collected about a participant, an intervention was made, or information about a
participant was recorded.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["Encounter"]
class_class_curie: ClassVar[str] = "includedcc:Encounter"
class_name: ClassVar[str] = "Encounter"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.Encounter
encounter_id: Union[str, EncounterEncounterId] = None
subject_id: Optional[Union[str, SubjectSubjectId]] = None
encounter_definition_id: Optional[Union[str, EncounterDefinitionEncounterDefinitionId]] = None
age_at_event: Optional[int] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.encounter_id):
self.MissingRequiredField("encounter_id")
if not isinstance(self.encounter_id, EncounterEncounterId):
self.encounter_id = EncounterEncounterId(self.encounter_id)
if self.subject_id is not None and not isinstance(self.subject_id, SubjectSubjectId):
self.subject_id = SubjectSubjectId(self.subject_id)
if self.encounter_definition_id is not None and not isinstance(self.encounter_definition_id, EncounterDefinitionEncounterDefinitionId):
self.encounter_definition_id = EncounterDefinitionEncounterDefinitionId(self.encounter_definition_id)
if self.age_at_event is not None and not isinstance(self.age_at_event, int):
self.age_at_event = int(self.age_at_event)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class EncounterDefinition(Record):
"""
A definition of an encounter type in this study, ie, an event at which data was collected about a participant, an
intervention was made, or information about a participant was recorded. This may be something planned by a study
or a type of data collection.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["EncounterDefinition"]
class_class_curie: ClassVar[str] = "includedcc:EncounterDefinition"
class_name: ClassVar[str] = "EncounterDefinition"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.EncounterDefinition
encounter_definition_id: Union[str, EncounterDefinitionEncounterDefinitionId] = None
name: Optional[str] = None
description: Optional[str] = None
activity_definition_id: Optional[Union[Union[str, ActivityDefinitionActivityDefinitionId], list[Union[str, ActivityDefinitionActivityDefinitionId]]]] = empty_list()
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.encounter_definition_id):
self.MissingRequiredField("encounter_definition_id")
if not isinstance(self.encounter_definition_id, EncounterDefinitionEncounterDefinitionId):
self.encounter_definition_id = EncounterDefinitionEncounterDefinitionId(self.encounter_definition_id)
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
if not isinstance(self.activity_definition_id, list):
self.activity_definition_id = [self.activity_definition_id] if self.activity_definition_id is not None else []
self.activity_definition_id = [v if isinstance(v, ActivityDefinitionActivityDefinitionId) else ActivityDefinitionActivityDefinitionId(v) for v in self.activity_definition_id]
super().__post_init__(**kwargs)
@dataclass(repr=False)
class ActivityDefinition(Record):
"""
A definition of an activity in this study, eg, a biospecimen collection, intervention, survey, or assessment.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["ActivityDefinition"]
class_class_curie: ClassVar[str] = "includedcc:ActivityDefinition"
class_name: ClassVar[str] = "ActivityDefinition"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.ActivityDefinition
activity_definition_id: Union[str, ActivityDefinitionActivityDefinitionId] = None
name: Optional[str] = None
description: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.activity_definition_id):
self.MissingRequiredField("activity_definition_id")
if not isinstance(self.activity_definition_id, ActivityDefinitionActivityDefinitionId):
self.activity_definition_id = ActivityDefinitionActivityDefinitionId(self.activity_definition_id)
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
super().__post_init__(**kwargs)
@dataclass(repr=False)
class File(Record):
"""
File
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["File"]
class_class_curie: ClassVar[str] = "includedcc:File"
class_name: ClassVar[str] = "File"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.File
file_id: Union[str, FileFileId] = None
subject_id: Optional[Union[Union[str, SubjectSubjectId], list[Union[str, SubjectSubjectId]]]] = empty_list()
sample_id: Optional[Union[Union[str, SampleSampleId], list[Union[str, SampleSampleId]]]] = empty_list()
filename: Optional[str] = None
format: Optional[Union[str, "EnumEDAMFormats"]] = None
data_category: Optional[Union[str, "EnumDataCategory"]] = None
data_type: Optional[Union[str, "EnumEDAMDataTypes"]] = None
size: Optional[int] = None
staging_url: Optional[Union[str, URIorCURIE]] = None
release_url: Optional[Union[str, URIorCURIE]] = None
drs_uri: Optional[Union[str, URIorCURIE]] = None
hash: Optional[Union[dict, "FileHash"]] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self._is_empty(self.file_id):
self.MissingRequiredField("file_id")
if not isinstance(self.file_id, FileFileId):
self.file_id = FileFileId(self.file_id)
if not isinstance(self.subject_id, list):
self.subject_id = [self.subject_id] if self.subject_id is not None else []
self.subject_id = [v if isinstance(v, SubjectSubjectId) else SubjectSubjectId(v) for v in self.subject_id]
if not isinstance(self.sample_id, list):
self.sample_id = [self.sample_id] if self.sample_id is not None else []
self.sample_id = [v if isinstance(v, SampleSampleId) else SampleSampleId(v) for v in self.sample_id]
if self.filename is not None and not isinstance(self.filename, str):
self.filename = str(self.filename)
if self.data_category is not None and not isinstance(self.data_category, EnumDataCategory):
self.data_category = EnumDataCategory(self.data_category)
if self.size is not None and not isinstance(self.size, int):
self.size = int(self.size)
if self.staging_url is not None and not isinstance(self.staging_url, URIorCURIE):
self.staging_url = URIorCURIE(self.staging_url)
if self.release_url is not None and not isinstance(self.release_url, URIorCURIE):
self.release_url = URIorCURIE(self.release_url)
if self.drs_uri is not None and not isinstance(self.drs_uri, URIorCURIE):
self.drs_uri = URIorCURIE(self.drs_uri)
if self.hash is not None and not isinstance(self.hash, FileHash):
self.hash = FileHash(**as_dict(self.hash))
super().__post_init__(**kwargs)
@dataclass(repr=False)
class FileHash(YAMLRoot):
"""
Type and value of a file content hash.
"""
_inherited_slots: ClassVar[list[str]] = []
class_class_uri: ClassVar[URIRef] = INCLUDEDCC["FileHash"]
class_class_curie: ClassVar[str] = "includedcc:FileHash"
class_name: ClassVar[str] = "FileHash"
class_model_uri: ClassVar[URIRef] = INCLUDEDCC.FileHash
hash_type: Optional[Union[str, "EnumFileHashType"]] = None
hash_value: Optional[str] = None
def __post_init__(self, *_: str, **kwargs: Any):
if self.hash_type is not None and not isinstance(self.hash_type, EnumFileHashType):
self.hash_type = EnumFileHashType(self.hash_type)
if self.hash_value is not None and not isinstance(self.hash_value, str):
self.hash_value = str(self.hash_value)
super().__post_init__(**kwargs)