nci-cidc-api-modules 1.2.34__py3-none-any.whl → 1.2.53__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. boot.py +14 -0
  2. cidc_api/__init__.py +1 -0
  3. cidc_api/config/db.py +21 -1
  4. cidc_api/config/settings.py +5 -10
  5. cidc_api/models/__init__.py +0 -2
  6. cidc_api/models/data.py +15 -6
  7. cidc_api/models/db/stage1/__init__.py +56 -0
  8. cidc_api/models/db/stage1/additional_treatment_orm.py +22 -0
  9. cidc_api/models/db/stage1/adverse_event_orm.py +46 -0
  10. cidc_api/models/db/stage1/base_orm.py +7 -0
  11. cidc_api/models/db/stage1/baseline_clinical_assessment_orm.py +22 -0
  12. cidc_api/models/db/stage1/comorbidity_orm.py +23 -0
  13. cidc_api/models/db/stage1/consent_group_orm.py +32 -0
  14. cidc_api/models/db/stage1/demographic_orm.py +47 -0
  15. cidc_api/models/db/stage1/disease_orm.py +52 -0
  16. cidc_api/models/db/stage1/exposure_orm.py +22 -0
  17. cidc_api/models/db/stage1/gvhd_diagnosis_acute_orm.py +34 -0
  18. cidc_api/models/db/stage1/gvhd_diagnosis_chronic_orm.py +36 -0
  19. cidc_api/models/db/stage1/gvhd_organ_acute_orm.py +21 -0
  20. cidc_api/models/db/stage1/gvhd_organ_chronic_orm.py +21 -0
  21. cidc_api/models/db/stage1/medical_history_orm.py +30 -0
  22. cidc_api/models/db/stage1/other_malignancy_orm.py +29 -0
  23. cidc_api/models/db/stage1/participant_orm.py +77 -0
  24. cidc_api/models/db/stage1/prior_treatment_orm.py +29 -0
  25. cidc_api/models/db/stage1/radiotherapy_dose_orm.py +39 -0
  26. cidc_api/models/db/stage1/response_by_system_orm.py +30 -0
  27. cidc_api/models/db/stage1/response_orm.py +28 -0
  28. cidc_api/models/db/stage1/specimen_orm.py +46 -0
  29. cidc_api/models/db/stage1/stem_cell_transplant_orm.py +25 -0
  30. cidc_api/models/db/stage1/surgery_orm.py +27 -0
  31. cidc_api/models/db/stage1/therapy_agent_dose_orm.py +31 -0
  32. cidc_api/models/db/stage1/treatment_orm.py +38 -0
  33. cidc_api/models/db/stage1/trial_orm.py +35 -0
  34. cidc_api/models/db/stage2/additional_treatment_orm.py +6 -7
  35. cidc_api/models/db/stage2/administrative_person_orm.py +4 -4
  36. cidc_api/models/db/stage2/administrative_role_assignment_orm.py +4 -4
  37. cidc_api/models/db/stage2/adverse_event_orm.py +11 -13
  38. cidc_api/models/db/stage2/arm_orm.py +3 -3
  39. cidc_api/models/db/stage2/base_orm.py +7 -0
  40. cidc_api/models/db/stage2/baseline_clinical_assessment_orm.py +5 -7
  41. cidc_api/models/db/stage2/cohort_orm.py +3 -3
  42. cidc_api/models/db/stage2/comorbidity_orm.py +6 -8
  43. cidc_api/models/db/stage2/consent_group_orm.py +4 -4
  44. cidc_api/models/db/stage2/contact_orm.py +16 -20
  45. cidc_api/models/db/stage2/demographic_orm.py +3 -3
  46. cidc_api/models/db/stage2/disease_orm.py +4 -4
  47. cidc_api/models/db/stage2/exposure_orm.py +3 -3
  48. cidc_api/models/db/stage2/file_orm.py +6 -9
  49. cidc_api/models/db/stage2/gvhd_diagnosis_acute_orm.py +4 -4
  50. cidc_api/models/db/stage2/gvhd_diagnosis_chronic_orm.py +4 -6
  51. cidc_api/models/db/stage2/gvhd_organ_acute_orm.py +3 -3
  52. cidc_api/models/db/stage2/gvhd_organ_chronic_orm.py +3 -3
  53. cidc_api/models/db/stage2/institution_orm.py +7 -7
  54. cidc_api/models/db/stage2/medical_history_orm.py +9 -9
  55. cidc_api/models/db/stage2/other_clinical_endpoint_orm.py +8 -12
  56. cidc_api/models/db/stage2/other_malignancy_orm.py +8 -10
  57. cidc_api/models/db/stage2/participant_orm.py +23 -24
  58. cidc_api/models/db/stage2/prior_treatment_orm.py +12 -13
  59. cidc_api/models/db/stage2/publication_orm.py +9 -11
  60. cidc_api/models/db/stage2/radiotherapy_dose_orm.py +8 -9
  61. cidc_api/models/db/stage2/response_by_system_orm.py +3 -3
  62. cidc_api/models/db/stage2/response_orm.py +3 -3
  63. cidc_api/models/db/stage2/shipment_orm.py +17 -17
  64. cidc_api/models/db/stage2/shipment_specimen_orm.py +4 -4
  65. cidc_api/models/db/stage2/specimen_orm.py +7 -6
  66. cidc_api/models/db/stage2/stem_cell_transplant_orm.py +6 -7
  67. cidc_api/models/db/stage2/surgery_orm.py +6 -7
  68. cidc_api/models/db/stage2/therapy_agent_dose_orm.py +7 -8
  69. cidc_api/models/db/stage2/treatment_orm.py +15 -15
  70. cidc_api/models/db/stage2/trial_orm.py +15 -17
  71. cidc_api/models/errors.py +7 -0
  72. cidc_api/models/files/facets.py +4 -0
  73. cidc_api/models/models.py +167 -11
  74. cidc_api/models/pydantic/base.py +109 -0
  75. cidc_api/models/pydantic/stage1/__init__.py +56 -0
  76. cidc_api/models/pydantic/stage1/additional_treatment.py +23 -0
  77. cidc_api/models/pydantic/stage1/adverse_event.py +127 -0
  78. cidc_api/models/pydantic/stage1/baseline_clinical_assessment.py +23 -0
  79. cidc_api/models/pydantic/stage1/comorbidity.py +43 -0
  80. cidc_api/models/pydantic/stage1/consent_group.py +30 -0
  81. cidc_api/models/pydantic/stage1/demographic.py +140 -0
  82. cidc_api/models/pydantic/stage1/disease.py +200 -0
  83. cidc_api/models/pydantic/stage1/exposure.py +38 -0
  84. cidc_api/models/pydantic/stage1/gvhd_diagnosis_acute.py +33 -0
  85. cidc_api/models/pydantic/stage1/gvhd_diagnosis_chronic.py +32 -0
  86. cidc_api/models/pydantic/stage1/gvhd_organ_acute.py +22 -0
  87. cidc_api/models/pydantic/stage1/gvhd_organ_chronic.py +23 -0
  88. cidc_api/models/pydantic/stage1/medical_history.py +43 -0
  89. cidc_api/models/pydantic/stage1/other_malignancy.py +55 -0
  90. cidc_api/models/pydantic/stage1/participant.py +63 -0
  91. cidc_api/models/pydantic/stage1/prior_treatment.py +45 -0
  92. cidc_api/models/pydantic/stage1/radiotherapy_dose.py +92 -0
  93. cidc_api/models/pydantic/stage1/response.py +84 -0
  94. cidc_api/models/pydantic/stage1/response_by_system.py +220 -0
  95. cidc_api/models/pydantic/stage1/specimen.py +31 -0
  96. cidc_api/models/pydantic/stage1/stem_cell_transplant.py +35 -0
  97. cidc_api/models/pydantic/stage1/surgery.py +57 -0
  98. cidc_api/models/pydantic/stage1/therapy_agent_dose.py +80 -0
  99. cidc_api/models/pydantic/stage1/treatment.py +64 -0
  100. cidc_api/models/pydantic/stage1/trial.py +45 -0
  101. cidc_api/models/pydantic/stage2/additional_treatment.py +2 -4
  102. cidc_api/models/pydantic/stage2/administrative_person.py +1 -1
  103. cidc_api/models/pydantic/stage2/administrative_role_assignment.py +2 -2
  104. cidc_api/models/pydantic/stage2/adverse_event.py +1 -1
  105. cidc_api/models/pydantic/stage2/arm.py +2 -2
  106. cidc_api/models/pydantic/stage2/baseline_clinical_assessment.py +1 -1
  107. cidc_api/models/pydantic/stage2/cohort.py +1 -1
  108. cidc_api/models/pydantic/stage2/comorbidity.py +1 -1
  109. cidc_api/models/pydantic/stage2/consent_group.py +2 -2
  110. cidc_api/models/pydantic/stage2/contact.py +1 -1
  111. cidc_api/models/pydantic/stage2/demographic.py +1 -1
  112. cidc_api/models/pydantic/stage2/disease.py +1 -1
  113. cidc_api/models/pydantic/stage2/exposure.py +1 -1
  114. cidc_api/models/pydantic/stage2/file.py +2 -2
  115. cidc_api/models/pydantic/stage2/gvhd_diagnosis_acute.py +1 -1
  116. cidc_api/models/pydantic/stage2/gvhd_diagnosis_chronic.py +1 -1
  117. cidc_api/models/pydantic/stage2/gvhd_organ_acute.py +1 -1
  118. cidc_api/models/pydantic/stage2/gvhd_organ_chronic.py +1 -1
  119. cidc_api/models/pydantic/stage2/institution.py +1 -1
  120. cidc_api/models/pydantic/stage2/medical_history.py +1 -1
  121. cidc_api/models/pydantic/stage2/other_clinical_endpoint.py +1 -1
  122. cidc_api/models/pydantic/stage2/other_malignancy.py +1 -1
  123. cidc_api/models/pydantic/stage2/participant.py +6 -3
  124. cidc_api/models/pydantic/stage2/prior_treatment.py +6 -15
  125. cidc_api/models/pydantic/stage2/publication.py +2 -2
  126. cidc_api/models/pydantic/stage2/radiotherapy_dose.py +1 -1
  127. cidc_api/models/pydantic/stage2/response.py +2 -2
  128. cidc_api/models/pydantic/stage2/response_by_system.py +1 -1
  129. cidc_api/models/pydantic/stage2/shipment.py +2 -2
  130. cidc_api/models/pydantic/stage2/shipment_specimen.py +1 -1
  131. cidc_api/models/pydantic/stage2/specimen.py +6 -3
  132. cidc_api/models/pydantic/stage2/stem_cell_transplant.py +2 -2
  133. cidc_api/models/pydantic/stage2/surgery.py +1 -1
  134. cidc_api/models/pydantic/stage2/therapy_agent_dose.py +1 -1
  135. cidc_api/models/pydantic/stage2/treatment.py +1 -1
  136. cidc_api/models/pydantic/stage2/trial.py +8 -10
  137. cidc_api/models/types.py +30 -16
  138. cidc_api/shared/assay_handling.py +68 -0
  139. cidc_api/shared/auth.py +5 -5
  140. cidc_api/shared/file_handling.py +18 -4
  141. cidc_api/shared/gcloud_client.py +96 -16
  142. cidc_api/shared/utils.py +18 -9
  143. cidc_api/telemetry.py +101 -0
  144. {nci_cidc_api_modules-1.2.34.dist-info → nci_cidc_api_modules-1.2.53.dist-info}/METADATA +25 -15
  145. nci_cidc_api_modules-1.2.53.dist-info/RECORD +167 -0
  146. {nci_cidc_api_modules-1.2.34.dist-info → nci_cidc_api_modules-1.2.53.dist-info}/WHEEL +1 -1
  147. {nci_cidc_api_modules-1.2.34.dist-info → nci_cidc_api_modules-1.2.53.dist-info}/top_level.txt +1 -0
  148. cidc_api/models/db/base_orm.py +0 -25
  149. cidc_api/models/pydantic/stage2/base.py +0 -48
  150. nci_cidc_api_modules-1.2.34.dist-info/RECORD +0 -109
  151. {nci_cidc_api_modules-1.2.34.dist-info → nci_cidc_api_modules-1.2.53.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,30 @@
1
+ from pydantic import NonNegativeInt
2
+
3
+ from cidc_api.models.pydantic.base import Base
4
+
5
+
6
+ class ConsentGroup(Base):
7
+ __data_category__ = "consent_group"
8
+ __cardinality__ = "one"
9
+
10
+ # The unique internal identifier for the consent group record
11
+ consent_group_id: int | None = None
12
+
13
+ # The unique internal identifier for the associated Trial record
14
+ trial_id: str | None = None
15
+
16
+ # The version number of the trial dataset
17
+ version: str | None = None
18
+
19
+ # An abbreviated name for the consent group
20
+ consent_group_short_name: str
21
+
22
+ # The words or acronym which describe a set of study participants
23
+ # who have signed the same consent agreement and that will be included in the dbGaP repository.
24
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14534329%20and%20ver_nr=1.00
25
+ consent_group_name: str
26
+
27
+ # A numeral or string of numerals used to identify the set of study participants who have signed the same consent
28
+ # agreement and that will be included in the dbGaP repository.
29
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14534330%20and%20ver_nr=1.00
30
+ consent_group_number: NonNegativeInt
@@ -0,0 +1,140 @@
1
+ from typing import Annotated, List
2
+
3
+ from pydantic import PositiveInt, NonNegativeFloat, PositiveFloat, BeforeValidator
4
+ from cidc_api.models.pydantic.base import forced_validator, forced_validators
5
+
6
+ from cidc_api.models.errors import ValueLocError
7
+ from cidc_api.models.pydantic.base import Base
8
+ from cidc_api.models.types import (
9
+ Sex,
10
+ Race,
11
+ Ethnicity,
12
+ HeightUnits,
13
+ WeightUnits,
14
+ BodySurfaceAreaUnits,
15
+ Occupation,
16
+ Education,
17
+ AgeAtEnrollmentUnits,
18
+ )
19
+
20
+
21
+ @forced_validators
22
+ class Demographic(Base):
23
+ __data_category__ = "demographic"
24
+ __cardinality__ = "one"
25
+
26
+ # The unique internal identifier for this demographic record
27
+ demographic_id: int | None = None
28
+
29
+ # The unique internal identifier for the associated participant
30
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
31
+ participant_id: str | None = None
32
+
33
+ # The age of the subject when the subject enrolled in the study.
34
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15742605%20and%20ver_nr=1
35
+ age_at_enrollment: PositiveInt | None = None
36
+
37
+ # Unit of measurement for the age of the participant. e.g. "Years"
38
+ age_at_enrollment_units: AgeAtEnrollmentUnits | None = None
39
+
40
+ # Indicates whether the participant is 90 years old or over. (for PHI purposes)
41
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15354920%20and%20ver_nr=1
42
+ age_90_or_over: bool
43
+
44
+ # A textual description of a person's sex at birth. e.g. "Male"
45
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=7572817%20and%20ver_nr=3
46
+ sex: Sex
47
+
48
+ # The race of the participant. e.g. "White"
49
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2192199%20and%20ver_nr=1
50
+ race: Annotated[List[Race], BeforeValidator(Base.split_list)]
51
+
52
+ # The ethnicity of the participant. e.g. "Hispanic or Latino"
53
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2192217%20and%20ver_nr=2
54
+ ethnicity: Ethnicity
55
+
56
+ # The number that describes the vertical distance of the participant at enrollment date.
57
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179643%20and%20ver_nr=4
58
+ height: PositiveFloat
59
+
60
+ # Unit of measurement for the height of the participant at the enrollment date. e.g. "in"
61
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2538920%20and%20ver_nr=1
62
+ height_units: HeightUnits
63
+
64
+ # The mass of the participant's entire body at the enrollment date.
65
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179689%20and%20ver_nr=4
66
+ weight: PositiveFloat
67
+
68
+ # Unit of measurement for the weight of the participant at the enrollment date. e.g. "kg"
69
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2630200%20and%20ver_nr=1
70
+ weight_units: WeightUnits
71
+
72
+ # The body mass index of the participant at the enrollment date.
73
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2006410%20and%20ver_nr=3
74
+ body_mass_index: PositiveFloat | None = None
75
+
76
+ # A decimal number that represents the measure of the 2-dimensional extent of the body surface (i.e., the skin) of the participant at the enrollment date.
77
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6606197%20and%20ver_nr=1
78
+ body_surface_area: PositiveFloat | None = None
79
+
80
+ # Unit of measurement for body surface area of the participant at the enrollment date. e.g. "m2"
81
+ # https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15114329%20and%20ver_nr=1
82
+ body_surface_area_units: BodySurfaceAreaUnits | None = None
83
+
84
+ # The occupation/job category of the participant. e.g. "Manager"
85
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6617540%20and%20ver_nr=1
86
+ occupation: Occupation | None = None
87
+
88
+ # The amount of earnings in USD made by the participant's family in a year.
89
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14834966%20and%20ver_nr=1
90
+ income: NonNegativeFloat | None = None
91
+
92
+ # The highest level of education attained by the participant. e.g. "Bachelor's Degree"
93
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2681552%20and%20ver_nr=1
94
+ highest_level_of_education: Education | None = None
95
+
96
+ @forced_validator
97
+ @classmethod
98
+ def validate_age_at_enrollment_cr(cls, data, info) -> None:
99
+ age_at_enrollment_units = data.get("age_at_enrollment_units", None)
100
+ age_90_or_over = data.get("age_90_or_over", None)
101
+ age_at_enrollment = int(data.get("age_at_enrollment", None) or 0)
102
+
103
+ if age_90_or_over == True or age_90_or_over == "Yes":
104
+ if age_at_enrollment or age_at_enrollment_units:
105
+ raise ValueLocError(
106
+ 'If "age_90_or_over" is "Yes" then "age_at_enrollment" and "age_at_enrollment_units" must be blank.',
107
+ loc="age_at_enrollment",
108
+ )
109
+ elif age_90_or_over == False or age_90_or_over == "No":
110
+ if not age_at_enrollment or not age_at_enrollment_units:
111
+ raise ValueLocError(
112
+ 'If "age_90_or_over" is "No" then "age_at_enrollment" and "age_at_enrollment_units" are required.',
113
+ loc="age_at_enrollment",
114
+ )
115
+
116
+ @forced_validator
117
+ @classmethod
118
+ def validate_age_at_enrollment_value(cls, data, info) -> None:
119
+ age_at_enrollment_units = data.get("age_at_enrollment_units", None)
120
+ age_90_or_over = data.get("age_90_or_over", None)
121
+ age_at_enrollment = int(data.get("age_at_enrollment", None) or 0)
122
+
123
+ if not age_90_or_over == True or age_90_or_over == "Yes":
124
+ age_in_years = age_at_enrollment if age_at_enrollment_units == "Years" else age_at_enrollment / 365.25
125
+ if age_in_years >= 90:
126
+ raise ValueLocError(
127
+ '"age_at_enrollment" cannot represent a value greater than 90 years of age.',
128
+ loc="age_at_enrollment",
129
+ )
130
+
131
+ @forced_validator
132
+ @classmethod
133
+ def validate_body_surface_area_units_cr(cls, data, info) -> None:
134
+ body_surface_area = data.get("body_surface_area", None)
135
+ body_surface_area_units = data.get("body_surface_area_units", None)
136
+
137
+ if body_surface_area and not body_surface_area_units:
138
+ raise ValueLocError(
139
+ 'If "body_surface_area" is provided then "body_surface_area_units" must also be provided.'
140
+ )
@@ -0,0 +1,200 @@
1
+ from pydantic import NonPositiveInt, BeforeValidator
2
+ from cidc_api.models.pydantic.base import forced_validator, forced_validators
3
+
4
+ from typing import List, Self, Annotated, get_args, Any
5
+
6
+ from cidc_api.models.errors import ValueLocError
7
+ from cidc_api.models.pydantic.base import Base
8
+ from cidc_api.models.types import (
9
+ TumorGrade,
10
+ CancerStageSystem,
11
+ CancerStageSystemVersion,
12
+ CancerStageSystemVersionAJCC,
13
+ CancerStageSystemVersionRISS,
14
+ CancerStageSystemVersionFIGO,
15
+ CancerStage,
16
+ TCategory,
17
+ NCategory,
18
+ MCategory,
19
+ UberonAnatomicalTerm,
20
+ ICDO3MorphologicalCode,
21
+ ICDO3MorphologicalTerm,
22
+ YNU,
23
+ )
24
+
25
+
26
+ @forced_validators
27
+ class Disease(Base):
28
+ __data_category__ = "disease"
29
+ __cardinality__ = "many"
30
+
31
+ # The unique internal identifier for this disease record
32
+ disease_id: int | None = None
33
+
34
+ # The unique internal identifier for the associated participant
35
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
36
+ participant_id: str | None = None
37
+
38
+ # The location within the body from where the disease of interest originated as captured in the Uberon identifier. e.g. "lung"
39
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14883047%20and%20ver_nr=1
40
+ primary_disease_site: UberonAnatomicalTerm
41
+
42
+ # The ICD-O-3 morphology code that describes the tumor's histology, behavior, and grade-differentiation. e.g. "8480/6"
43
+ # CDE: TBD
44
+ morphological_code: ICDO3MorphologicalCode | None
45
+
46
+ # The ICD-O-3 morphology term that describes the tumor's type. e.g. "Mucinous adenoma"
47
+ # CDE: TBD
48
+ morphological_term: ICDO3MorphologicalTerm | None
49
+
50
+ # Words that broadly describe the cancer's characteristics and type. e.g. "Inflitrating Ductal Carcinoma"
51
+ # CDE: TBD
52
+ cancer_type_description: str | None = None
53
+
54
+ # The number of days elapsed since the participant was first diagnosed with this condition.
55
+ days_since_original_diagnosis: NonPositiveInt | None
56
+
57
+ # Words that express the degree of abnormality of cancer cells as a measure of differentiation and aggressiveness. e.g. "G1 Low Grade"
58
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=11325685%20and%20ver_nr=2
59
+ tumor_grade: TumorGrade | None = None
60
+
61
+ # The name of the staging system used in the evaluation of the disease. e.g. "AJCC"
62
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=7429602%20and%20ver_nr=1
63
+ cancer_stage_system: CancerStageSystem
64
+
65
+ # Release version of the staging system used in the evaluation of the disease. e.g. "8" (for AJCC)
66
+ cancer_stage_system_version: CancerStageSystemVersion | None = None
67
+
68
+ # Stage of the cancer at enrollment date as determined by the specific staging system. e.g. "Stage 0" (for AJCC)
69
+ # CDE(AJCC): https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=3440332%20and%20ver_nr=1
70
+ # CDE(FIGO): TBD
71
+ # CDE(RISS): TBD
72
+ cancer_stage: CancerStage | None = None
73
+
74
+ # Extent of the primary cancer based on evidence obtained from clinical assessment parameters determined prior to treatment. e.g. "T0"
75
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=3440328%20and%20ver_nr=1
76
+ # TODO: Verify this CDE
77
+ t_category: TCategory | None = None
78
+
79
+ # Extent of the regional lymph node involvement for the cancer based on evidence obtained from clinical assessment parameters
80
+ # determined prior to treatment. e.g. "N0"
81
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=3440330%20and%20ver_nr=1
82
+ # TODO: Verify this CDE
83
+ n_category: NCategory | None = None
84
+
85
+ # Extent of the distant metastasis for the cancer based on evidence obtained from clinical assessment parameters determined
86
+ # prior to treatment. e.g. "M0"
87
+ # CDE: https://teams.microsoft.com/l/message/19:1c292b63-5df1-4f29-b177-86aed53f393d_f224ae83-209b-4cd9-a7ef-83d9d2120a27@unq.gbl.spaces/1758827414202?context=%7B%22contextType%22%3A%22chat%22%7D
88
+ # TODO: Verify this CDE
89
+ m_category: MCategory | None = None
90
+
91
+ # The organ site where a tumor develops outside of the bone marrow as specified in the Uberon antatomical term.
92
+ metastatic_organ: Annotated[List[UberonAnatomicalTerm] | None, BeforeValidator(Base.split_list)] = []
93
+
94
+ # Indicates if participant has a hematological malignancy that is only extramedullary. e.g. "Yes"
95
+ solely_extramedullary_disease: YNU
96
+
97
+ extramedullary_organ: Annotated[List[UberonAnatomicalTerm] | None, BeforeValidator(Base.split_list)] = []
98
+
99
+ @forced_validator
100
+ @classmethod
101
+ def validate_code_or_term_or_description_cr(cls, data, info) -> None:
102
+ morphological_term = data.get("morphological_term", None)
103
+ cancer_type_description = data.get("cancer_type_description", None)
104
+ morphological_code = data.get("morphological_code", None)
105
+
106
+ if not morphological_code and not morphological_term and not cancer_type_description:
107
+ raise ValueLocError(
108
+ 'Please provide at least one of "morphological_code", "morphological_term" or "cancer_type_description".',
109
+ loc="morphological_code",
110
+ )
111
+
112
+ @forced_validator
113
+ @classmethod
114
+ def validate_cancer_stage_system_version(cls, data, info) -> None:
115
+ cancer_stage_system_version = data.get("cancer_stage_system_version", None)
116
+ cancer_stage_system = data.get("cancer_stage_system", None)
117
+
118
+ msg = f"{cancer_stage_system_version} is not applicable to {cancer_stage_system}"
119
+ if cancer_stage_system == "AJCC" and cancer_stage_system_version not in get_args(CancerStageSystemVersionAJCC):
120
+ raise ValueLocError(msg, loc="cancer_stage_system")
121
+ elif cancer_stage_system == "RISS" and cancer_stage_system_version not in get_args(
122
+ CancerStageSystemVersionRISS
123
+ ):
124
+ raise ValueLocError(msg, loc="cancer_stage_system")
125
+ elif cancer_stage_system == "FIGO" and cancer_stage_system_version not in get_args(
126
+ CancerStageSystemVersionFIGO
127
+ ):
128
+ raise ValueLocError(msg, loc="cancer_stage_system")
129
+
130
+ @forced_validator
131
+ @classmethod
132
+ def validate_cancer_stage_system_version_cr(cls, data, info) -> None:
133
+ cancer_stage_system = data.get("cancer_stage_system", None)
134
+ cancer_stage_system_version = data.get("cancer_stage_system_version", None)
135
+
136
+ if cancer_stage_system != "Not Applicable" and not cancer_stage_system_version:
137
+ raise ValueLocError(
138
+ f'Please provide cancer_stage_system_version when cancer_stage_system is "{cancer_stage_system}"',
139
+ loc="cancer_stage_system_version",
140
+ )
141
+
142
+ @forced_validator
143
+ @classmethod
144
+ def validate_cancer_stage_cr(cls, data, info) -> None:
145
+ cancer_stage_system = data.get("cancer_stage_system", None)
146
+ cancer_stage = data.get("cancer_stage", None)
147
+
148
+ if cancer_stage_system != "Not Applicable" and not cancer_stage:
149
+ raise ValueLocError(
150
+ f'Please provide cancer_stage when cancer_stage_system is "{cancer_stage_system}"',
151
+ loc="cancer_stage",
152
+ )
153
+
154
+ @forced_validator
155
+ @classmethod
156
+ def validate_t_category_cr(cls, data, info) -> None:
157
+ cancer_stage_system = data.get("cancer_stage_system", None)
158
+ t_category = data.get("t_category", None)
159
+
160
+ if cancer_stage_system == "AJCC" and not t_category:
161
+ raise ValueLocError(
162
+ f'Please provide t_category when cancer_stage_system is "{cancer_stage_system}"',
163
+ loc="t_category",
164
+ )
165
+
166
+ @forced_validator
167
+ @classmethod
168
+ def validate_n_category_cr(cls, data, info) -> None:
169
+ cancer_stage_system = data.get("cancer_stage_system", None)
170
+ n_category = data.get("n_category", None)
171
+
172
+ if cancer_stage_system == "AJCC" and not n_category:
173
+ raise ValueLocError(
174
+ f'Please provide n_category when cancer_stage_system is "{cancer_stage_system}"',
175
+ loc="n_category",
176
+ )
177
+
178
+ @forced_validator
179
+ @classmethod
180
+ def validate_m_category_cr(cls, data, info) -> None:
181
+ cancer_stage_system = data.get("cancer_stage_system", None)
182
+ m_category = data.get("m_category", None)
183
+
184
+ if cancer_stage_system == "AJCC" and not m_category:
185
+ raise ValueLocError(
186
+ f'Please provide m_category when cancer_stage_system is "{cancer_stage_system}"',
187
+ loc="m_category",
188
+ )
189
+
190
+ @forced_validator
191
+ @classmethod
192
+ def validate_extramedullary_organ_cr(cls, data, info) -> None:
193
+ solely_extramedullary_disease = data.get("solely_extramedullary_disease", None)
194
+ extramedullary_organ = data.get("extramedullary_organ", None)
195
+
196
+ if solely_extramedullary_disease in ["No", "Unknown"] and extramedullary_organ:
197
+ raise ValueLocError(
198
+ "If solely_extramedullary_disease indicates no disease, please leave extramedullary_organ blank.",
199
+ loc="extramedullary_organ",
200
+ )
@@ -0,0 +1,38 @@
1
+ from cidc_api.models.pydantic.base import forced_validator, forced_validators
2
+
3
+ from cidc_api.models.errors import ValueLocError
4
+ from cidc_api.models.pydantic.base import Base
5
+ from cidc_api.models.types import YNU, ExposureType
6
+
7
+
8
+ @forced_validators
9
+ class Exposure(Base):
10
+ __data_category__ = "exposure"
11
+ __cardinality__ = "many"
12
+
13
+ # A unique internal identifier for the exposure
14
+ exposure_id: int | None = None
15
+
16
+ # The unique identifier for the associated participant
17
+ participant_id: str | None = None
18
+
19
+ # An indication of whether the subject was exposed to any chemical, biological or physical agents
20
+ # that increase the risk of neoplasms in humans or animals.
21
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=5205578%20and%20ver_nr=3
22
+ carcinogen_exposure: YNU
23
+
24
+ # The type of potentially harmful environmental agents to which an individual was exposed.
25
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15753203%20and%20ver_nr=1
26
+ exposure_type: ExposureType | None = None
27
+
28
+ @forced_validator
29
+ @classmethod
30
+ def validate_exposure_type_cr(cls, data, info) -> None:
31
+ carcinogen_exposure = data.get("carcinogen_exposure", None)
32
+ exposure_type = data.get("exposure_type", None)
33
+
34
+ if carcinogen_exposure in ["No", "Unknown"] and exposure_type:
35
+ raise ValueLocError(
36
+ "If carcinogen_exposure indicates non exposure, please leave exposure_type blank.",
37
+ loc="exposure_type",
38
+ )
@@ -0,0 +1,33 @@
1
+ from cidc_api.models.pydantic.base import Base
2
+ from cidc_api.models.types import (
3
+ GVHDDiagnosisAcuteAssessmentSystem,
4
+ GVHDDiagnosisAcuteAssessmentSystemVersion,
5
+ GVHDDiagnosisAcuteGrade,
6
+ PreOrPostEnrollment,
7
+ )
8
+
9
+
10
+ class GVHDDiagnosisAcute(Base):
11
+ __data_category__ = "gvhd_diagnosis_acute"
12
+ __cardinality__ = "many"
13
+
14
+ # The unique internal identifier for the GVHD Diagnosis Acute Record
15
+ gvhd_diagnosis_acute_id: int | None = None
16
+
17
+ # The unique internal identifier for the associated participant
18
+ participant_id: str | None = None
19
+
20
+ # The clinical grading system used to stage involvement of affected organs (skin, liver, GI tract)
21
+ # in acute GVHD and assign an overall severity grade (I–IV) based on predefined criteria.
22
+ acute_assessment_system: GVHDDiagnosisAcuteAssessmentSystem
23
+
24
+ # Release version of the clinical grading system used in the evaluation of acute GVHD.
25
+ system_version: GVHDDiagnosisAcuteAssessmentSystemVersion
26
+
27
+ # The overall severity grade (I–IV) assigned to a patient with acute GVHD based on the extent of
28
+ # involvement in affected organs (skin, liver, and GI tract), determined using a standardized
29
+ # assessment system.
30
+ acute_grade: GVHDDiagnosisAcuteGrade
31
+
32
+ # Indicator for whether the acute GVHD diagnosis was made before or after trial enrollment.
33
+ pre_or_post_enrollment: PreOrPostEnrollment
@@ -0,0 +1,32 @@
1
+ from cidc_api.models.pydantic.base import Base
2
+ from cidc_api.models.types import (
3
+ GVHDDiagnosisChronicAssessmentSystem,
4
+ GVHDDiagnosisChronicAssessmentSystemVersion,
5
+ GVHDDiagnosisChronicGlobalSeverity,
6
+ PreOrPostEnrollment,
7
+ )
8
+
9
+
10
+ class GVHDDiagnosisChronic(Base):
11
+ __data_category__ = "gvhd_diagnosis_chronic"
12
+ __cardinality__ = "many"
13
+
14
+ # The unique internal identifier for the GVHD chronic diagnosis
15
+ gvhd_diagnosis_chronic_id: int | None = None
16
+
17
+ # The unique internal identifier for the associated participant
18
+ participant_id: str | None = None
19
+
20
+ # The standardized clinical system used to evaluate and grade the extent and severity
21
+ # of organ involvement in chronic GVHD, resulting in an overall disease severity score.
22
+ chronic_assessment_system: GVHDDiagnosisChronicAssessmentSystem
23
+
24
+ # Release version of the clinical grading system used in the evaluation of chronic GVHD.
25
+ system_version: GVHDDiagnosisChronicAssessmentSystemVersion
26
+
27
+ # An overall score reflecting the combined severity of chronic graft-versus-host disease
28
+ # across all affected organs, summarizing the participant’s total disease burden.
29
+ chronic_global_severity: GVHDDiagnosisChronicGlobalSeverity
30
+
31
+ # Indicator for whether the chronic GVHD diagnosis was made before or after trial enrollment.
32
+ pre_or_post_enrollment: PreOrPostEnrollment
@@ -0,0 +1,22 @@
1
+ from cidc_api.models.pydantic.base import Base
2
+ from cidc_api.models.types import (
3
+ GVHDOrgan,
4
+ GVHDOrganAcuteStage,
5
+ )
6
+
7
+
8
+ class GVHDOrganAcute(Base):
9
+ __data_category__ = "gvhd_organ_acute"
10
+ __cardinality__ = "many"
11
+
12
+ # The unique internal identifier for the GVHD Organ Acute Record
13
+ gvhd_organ_acute_id: int | None = None
14
+
15
+ # The unique internal identifier for the associated GVHD Diagnosis Acute record
16
+ gvhd_diagnosis_acute_id: int | None = None
17
+
18
+ # An organ affected by acute GVHD for which the stage is assessed as part of the overall acute GVHD evaluation.
19
+ organ: GVHDOrgan
20
+
21
+ # The severity level of an individual organ’s involvement in acute GVHD, usually scored from 0 (none) to 4 (severe).
22
+ acute_stage: GVHDOrganAcuteStage
@@ -0,0 +1,23 @@
1
+ from cidc_api.models.pydantic.base import Base
2
+ from cidc_api.models.types import (
3
+ GVHDOrgan,
4
+ GVHDOrganChronicScore,
5
+ )
6
+
7
+
8
+ class GVHDOrganChronic(Base):
9
+ __data_category__ = "gvhd_organ_chronic"
10
+ __cardinality__ = "many"
11
+
12
+ # The unique internal identifier for the GVHD Organ Chronic Record
13
+ gvhd_organ_chronic_id: int | None = None
14
+
15
+ # The unique internal identifier for the associated GVHD Diagnosis Chronic record
16
+ gvhd_diagnosis_chronic_id: int | None = None
17
+
18
+ # An organ affected by chronic GVHD identified by its Uberon ontology ID
19
+ # and evaluated for severity as part of the overall chronic GVHD assessment.
20
+ organ: GVHDOrgan
21
+
22
+ # The severity score for an individual organ affected by chronic GVHD based on clinical criteria.
23
+ chronic_score: GVHDOrganChronicScore
@@ -0,0 +1,43 @@
1
+ from pydantic import NonNegativeInt, PositiveFloat
2
+ from cidc_api.models.pydantic.base import forced_validator, forced_validators
3
+
4
+ from cidc_api.models.errors import ValueLocError
5
+ from cidc_api.models.pydantic.base import Base
6
+ from cidc_api.models.types import TobaccoSmokingStatus
7
+
8
+
9
+ @forced_validators
10
+ class MedicalHistory(Base):
11
+ __data_category__ = "medical_history"
12
+ __cardinality__ = "one"
13
+
14
+ # A unique internal identifier for the medical history
15
+ medical_history_id: int | None = None
16
+
17
+ # The unique identifier for the associated participant
18
+ participant_id: str | None = None
19
+
20
+ # Text representation of a person's status relative to smoking tobacco in the form of cigarettes,
21
+ # based on questions about current and former use of cigarettes.
22
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=16333929%20and%20ver_nr=1
23
+ tobacco_smoking_status: TobaccoSmokingStatus | None = None
24
+
25
+ # Average number of packs of cigarettes smoked per day multiplied by number of years the participant has smoked.
26
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6841869%20and%20ver_nr=1
27
+ pack_years_smoked: PositiveFloat | None = None
28
+
29
+ # Number of prior systemic therapies.
30
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=16089302%20and%20ver_nr=1
31
+ num_prior_systemic_therapies: NonNegativeInt | None = None
32
+
33
+ @forced_validator
34
+ @classmethod
35
+ def validate_pack_years_smoked_cr(cls, data, info) -> None:
36
+ tobacco_smoking_status = data.get("tobacco_smoking_status", None)
37
+ pack_years_smoked = data.get("pack_years_smoked", None)
38
+
39
+ if tobacco_smoking_status in ["Never Smoker", "Unknown", "Not reported"] and pack_years_smoked:
40
+ raise ValueLocError(
41
+ "If tobacco_smoking_status indicates non-smoker, please leave pack_years_smoked blank.",
42
+ loc="pack_years_smoked",
43
+ )
@@ -0,0 +1,55 @@
1
+ from pydantic import NonPositiveInt
2
+ from cidc_api.models.pydantic.base import forced_validator, forced_validators
3
+
4
+ from cidc_api.models.errors import ValueLocError
5
+ from cidc_api.models.pydantic.base import Base
6
+ from cidc_api.models.types import UberonAnatomicalTerm, ICDO3MorphologicalCode, ICDO3MorphologicalTerm, MalignancyStatus
7
+
8
+
9
+ @forced_validators
10
+ class OtherMalignancy(Base):
11
+ __data_category__ = "other_malignancy"
12
+ __cardinality__ = "many"
13
+
14
+ # The unique internal identifier for the OtherMalignancy record
15
+ other_malignancy_id: int | None = None
16
+
17
+ # The unique internal identifier for the associated MedicalHistory record
18
+ medical_history_id: int | None = None
19
+
20
+ # The location within the body from where the prior malignancy originated as captured in the Uberon anatomical term.
21
+ other_malignancy_primary_disease_site: UberonAnatomicalTerm
22
+
23
+ # The ICD-O-3 code which identifies the specific appearance of cells and tissues (normal and abnormal) used
24
+ # to define the presence and nature of disease.
25
+ other_malignancy_morphological_code: ICDO3MorphologicalCode | None = None
26
+
27
+ # The ICD-O-3 textual label which identifies the specific appearance of cells and tissues (normal and abnormal) used
28
+ # to define the presence and nature of disease.
29
+ other_malignancy_morphological_term: ICDO3MorphologicalTerm | None = None
30
+
31
+ # Description of the cancer type as recorded in the trial.
32
+ other_malignancy_description: str | None = None
33
+
34
+ # Number of days since original diagnosis from the enrollment date. This may be a negative number.
35
+ other_malignancy_days_since_diagnosis: NonPositiveInt | None = None
36
+
37
+ # Indicates the participant’s current clinical state regarding the cancer diagnosis.
38
+ other_malignancy_status: MalignancyStatus | None = None
39
+
40
+ @forced_validator
41
+ @classmethod
42
+ def validate_code_or_term_or_description_cr(cls, data, info) -> None:
43
+ other_malignancy_morphological_term = data.get("other_malignancy_morphological_term", None)
44
+ other_malignancy_description = data.get("other_malignancy_description", None)
45
+ other_malignancy_morphological_code = data.get("other_malignancy_morphological_code", None)
46
+
47
+ if (
48
+ not other_malignancy_morphological_code
49
+ and not other_malignancy_morphological_term
50
+ and not other_malignancy_description
51
+ ):
52
+ raise ValueLocError(
53
+ 'Please provide at least one of "morphological_code", "morphological_term" or "malignancy_description".',
54
+ loc="other_malignancy_morphological_code",
55
+ )