nci-cidc-api-modules 1.2.29__py3-none-any.whl → 1.2.45__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 (148) hide show
  1. cidc_api/__init__.py +1 -0
  2. cidc_api/config/db.py +21 -1
  3. cidc_api/config/settings.py +1 -0
  4. cidc_api/models/__init__.py +0 -2
  5. cidc_api/models/data.py +17 -4
  6. cidc_api/models/db/stage1/__init__.py +56 -0
  7. cidc_api/models/db/stage1/additional_treatment_orm.py +22 -0
  8. cidc_api/models/db/stage1/adverse_event_orm.py +46 -0
  9. cidc_api/models/db/stage1/base_orm.py +7 -0
  10. cidc_api/models/db/stage1/baseline_clinical_assessment_orm.py +22 -0
  11. cidc_api/models/db/stage1/comorbidity_orm.py +23 -0
  12. cidc_api/models/db/stage1/consent_group_orm.py +32 -0
  13. cidc_api/models/db/stage1/demographic_orm.py +47 -0
  14. cidc_api/models/db/stage1/disease_orm.py +52 -0
  15. cidc_api/models/db/stage1/exposure_orm.py +22 -0
  16. cidc_api/models/db/stage1/gvhd_diagnosis_acute_orm.py +34 -0
  17. cidc_api/models/db/stage1/gvhd_diagnosis_chronic_orm.py +36 -0
  18. cidc_api/models/db/stage1/gvhd_organ_acute_orm.py +21 -0
  19. cidc_api/models/db/stage1/gvhd_organ_chronic_orm.py +21 -0
  20. cidc_api/models/db/stage1/medical_history_orm.py +30 -0
  21. cidc_api/models/db/stage1/other_malignancy_orm.py +29 -0
  22. cidc_api/models/db/stage1/participant_orm.py +77 -0
  23. cidc_api/models/db/stage1/prior_treatment_orm.py +29 -0
  24. cidc_api/models/db/stage1/radiotherapy_dose_orm.py +39 -0
  25. cidc_api/models/db/stage1/response_by_system_orm.py +30 -0
  26. cidc_api/models/db/stage1/response_orm.py +28 -0
  27. cidc_api/models/db/stage1/specimen_orm.py +46 -0
  28. cidc_api/models/db/stage1/stem_cell_transplant_orm.py +25 -0
  29. cidc_api/models/db/stage1/surgery_orm.py +27 -0
  30. cidc_api/models/db/stage1/therapy_agent_dose_orm.py +31 -0
  31. cidc_api/models/db/stage1/treatment_orm.py +38 -0
  32. cidc_api/models/db/stage1/trial_orm.py +35 -0
  33. cidc_api/models/db/stage2/additional_treatment_orm.py +8 -8
  34. cidc_api/models/db/stage2/administrative_person_orm.py +4 -4
  35. cidc_api/models/db/stage2/administrative_role_assignment_orm.py +4 -4
  36. cidc_api/models/db/stage2/adverse_event_orm.py +12 -13
  37. cidc_api/models/db/stage2/arm_orm.py +3 -3
  38. cidc_api/models/db/stage2/base_orm.py +7 -0
  39. cidc_api/models/db/stage2/baseline_clinical_assessment_orm.py +6 -7
  40. cidc_api/models/db/stage2/cohort_orm.py +3 -3
  41. cidc_api/models/db/stage2/comorbidity_orm.py +7 -8
  42. cidc_api/models/db/stage2/consent_group_orm.py +5 -4
  43. cidc_api/models/db/stage2/contact_orm.py +16 -20
  44. cidc_api/models/db/stage2/demographic_orm.py +11 -8
  45. cidc_api/models/db/stage2/disease_orm.py +13 -14
  46. cidc_api/models/db/stage2/exposure_orm.py +5 -4
  47. cidc_api/models/db/stage2/file_orm.py +6 -9
  48. cidc_api/models/db/stage2/gvhd_diagnosis_acute_orm.py +5 -4
  49. cidc_api/models/db/stage2/gvhd_diagnosis_chronic_orm.py +5 -6
  50. cidc_api/models/db/stage2/gvhd_organ_acute_orm.py +4 -3
  51. cidc_api/models/db/stage2/gvhd_organ_chronic_orm.py +4 -3
  52. cidc_api/models/db/stage2/institution_orm.py +7 -7
  53. cidc_api/models/db/stage2/medical_history_orm.py +10 -9
  54. cidc_api/models/db/stage2/other_clinical_endpoint_orm.py +8 -12
  55. cidc_api/models/db/stage2/other_malignancy_orm.py +10 -11
  56. cidc_api/models/db/stage2/participant_orm.py +28 -28
  57. cidc_api/models/db/stage2/prior_treatment_orm.py +15 -14
  58. cidc_api/models/db/stage2/publication_orm.py +9 -11
  59. cidc_api/models/db/stage2/radiotherapy_dose_orm.py +9 -9
  60. cidc_api/models/db/stage2/response_by_system_orm.py +5 -3
  61. cidc_api/models/db/stage2/response_orm.py +6 -5
  62. cidc_api/models/db/stage2/shipment_orm.py +17 -17
  63. cidc_api/models/db/stage2/shipment_specimen_orm.py +4 -4
  64. cidc_api/models/db/stage2/specimen_orm.py +7 -6
  65. cidc_api/models/db/stage2/stem_cell_transplant_orm.py +7 -7
  66. cidc_api/models/db/stage2/surgery_orm.py +7 -7
  67. cidc_api/models/db/stage2/therapy_agent_dose_orm.py +8 -8
  68. cidc_api/models/db/stage2/treatment_orm.py +16 -15
  69. cidc_api/models/db/stage2/trial_orm.py +34 -33
  70. cidc_api/models/files/facets.py +4 -0
  71. cidc_api/models/models.py +154 -9
  72. cidc_api/models/pydantic/{stage2/base.py → base.py} +19 -1
  73. cidc_api/models/pydantic/stage1/__init__.py +56 -0
  74. cidc_api/models/pydantic/stage1/additional_treatment.py +23 -0
  75. cidc_api/models/pydantic/stage1/adverse_event.py +100 -0
  76. cidc_api/models/pydantic/stage1/baseline_clinical_assessment.py +23 -0
  77. cidc_api/models/pydantic/stage1/comorbidity.py +36 -0
  78. cidc_api/models/pydantic/stage1/consent_group.py +30 -0
  79. cidc_api/models/pydantic/stage1/demographic.py +123 -0
  80. cidc_api/models/pydantic/stage1/disease.py +158 -0
  81. cidc_api/models/pydantic/stage1/exposure.py +32 -0
  82. cidc_api/models/pydantic/stage1/gvhd_diagnosis_acute.py +33 -0
  83. cidc_api/models/pydantic/stage1/gvhd_diagnosis_chronic.py +32 -0
  84. cidc_api/models/pydantic/stage1/gvhd_organ_acute.py +22 -0
  85. cidc_api/models/pydantic/stage1/gvhd_organ_chronic.py +23 -0
  86. cidc_api/models/pydantic/stage1/medical_history.py +36 -0
  87. cidc_api/models/pydantic/stage1/other_malignancy.py +49 -0
  88. cidc_api/models/pydantic/stage1/participant.py +51 -0
  89. cidc_api/models/pydantic/stage1/prior_treatment.py +45 -0
  90. cidc_api/models/pydantic/stage1/radiotherapy_dose.py +79 -0
  91. cidc_api/models/pydantic/stage1/response.py +65 -0
  92. cidc_api/models/pydantic/stage1/response_by_system.py +112 -0
  93. cidc_api/models/pydantic/stage1/specimen.py +31 -0
  94. cidc_api/models/pydantic/stage1/stem_cell_transplant.py +35 -0
  95. cidc_api/models/pydantic/stage1/surgery.py +49 -0
  96. cidc_api/models/pydantic/stage1/therapy_agent_dose.py +67 -0
  97. cidc_api/models/pydantic/stage1/treatment.py +50 -0
  98. cidc_api/models/pydantic/stage1/trial.py +45 -0
  99. cidc_api/models/pydantic/stage2/additional_treatment.py +5 -5
  100. cidc_api/models/pydantic/stage2/administrative_person.py +1 -1
  101. cidc_api/models/pydantic/stage2/administrative_role_assignment.py +2 -2
  102. cidc_api/models/pydantic/stage2/adverse_event.py +2 -2
  103. cidc_api/models/pydantic/stage2/arm.py +2 -2
  104. cidc_api/models/pydantic/stage2/baseline_clinical_assessment.py +2 -2
  105. cidc_api/models/pydantic/stage2/cohort.py +1 -1
  106. cidc_api/models/pydantic/stage2/comorbidity.py +1 -1
  107. cidc_api/models/pydantic/stage2/consent_group.py +2 -2
  108. cidc_api/models/pydantic/stage2/contact.py +1 -1
  109. cidc_api/models/pydantic/stage2/demographic.py +27 -18
  110. cidc_api/models/pydantic/stage2/disease.py +33 -19
  111. cidc_api/models/pydantic/stage2/exposure.py +3 -3
  112. cidc_api/models/pydantic/stage2/file.py +2 -2
  113. cidc_api/models/pydantic/stage2/gvhd_diagnosis_acute.py +2 -2
  114. cidc_api/models/pydantic/stage2/gvhd_diagnosis_chronic.py +2 -2
  115. cidc_api/models/pydantic/stage2/gvhd_organ_acute.py +1 -1
  116. cidc_api/models/pydantic/stage2/gvhd_organ_chronic.py +1 -1
  117. cidc_api/models/pydantic/stage2/institution.py +1 -1
  118. cidc_api/models/pydantic/stage2/medical_history.py +2 -2
  119. cidc_api/models/pydantic/stage2/other_clinical_endpoint.py +1 -1
  120. cidc_api/models/pydantic/stage2/other_malignancy.py +12 -8
  121. cidc_api/models/pydantic/stage2/participant.py +10 -6
  122. cidc_api/models/pydantic/stage2/prior_treatment.py +14 -23
  123. cidc_api/models/pydantic/stage2/publication.py +2 -2
  124. cidc_api/models/pydantic/stage2/radiotherapy_dose.py +2 -2
  125. cidc_api/models/pydantic/stage2/response.py +5 -11
  126. cidc_api/models/pydantic/stage2/response_by_system.py +10 -7
  127. cidc_api/models/pydantic/stage2/shipment.py +2 -2
  128. cidc_api/models/pydantic/stage2/shipment_specimen.py +1 -1
  129. cidc_api/models/pydantic/stage2/specimen.py +8 -5
  130. cidc_api/models/pydantic/stage2/stem_cell_transplant.py +2 -2
  131. cidc_api/models/pydantic/stage2/surgery.py +1 -1
  132. cidc_api/models/pydantic/stage2/therapy_agent_dose.py +1 -1
  133. cidc_api/models/pydantic/stage2/treatment.py +2 -2
  134. cidc_api/models/pydantic/stage2/trial.py +19 -15
  135. cidc_api/models/types.py +45 -42
  136. cidc_api/shared/assay_handling.py +68 -0
  137. cidc_api/shared/auth.py +5 -5
  138. cidc_api/shared/file_handling.py +16 -4
  139. cidc_api/shared/gcloud_client.py +78 -16
  140. cidc_api/shared/utils.py +18 -9
  141. cidc_api/telemetry.py +101 -0
  142. {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/METADATA +25 -14
  143. nci_cidc_api_modules-1.2.45.dist-info/RECORD +165 -0
  144. cidc_api/models/db/base_orm.py +0 -25
  145. nci_cidc_api_modules-1.2.29.dist-info/RECORD +0 -109
  146. {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/WHEEL +0 -0
  147. {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/licenses/LICENSE +0 -0
  148. {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  from pydantic import NonNegativeInt
2
2
 
3
- from .base import Base
3
+ from cidc_api.models.pydantic.base import Base
4
4
 
5
5
 
6
6
  class ConsentGroup(Base):
@@ -11,7 +11,7 @@ class ConsentGroup(Base):
11
11
  consent_group_id: int | None = None
12
12
 
13
13
  # The unique internal identifier for the associated Trial record
14
- trial_id: int | None = None
14
+ trial_id: str | None = None
15
15
 
16
16
  # The version number of the trial dataset
17
17
  version: str | None = None
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
 
3
3
 
4
4
  class Contact(Base):
@@ -1,8 +1,8 @@
1
- from typing import Self
1
+ from typing import Self, Annotated, List
2
2
 
3
- from pydantic import PositiveInt, NonNegativeFloat, PositiveFloat, model_validator, field_validator
3
+ from pydantic import PositiveInt, NonNegativeFloat, PositiveFloat, model_validator, field_validator, BeforeValidator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
6
  from cidc_api.models.types import (
7
7
  Sex,
8
8
  Race,
@@ -25,7 +25,7 @@ class Demographic(Base):
25
25
 
26
26
  # The unique internal identifier for the associated participant
27
27
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
28
- participant_id: int | None = None
28
+ participant_id: str | None = None
29
29
 
30
30
  # The age of the subject when the subject enrolled in the study.
31
31
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15742605%20and%20ver_nr=1
@@ -34,9 +34,9 @@ class Demographic(Base):
34
34
  # Unit of measurement for the age of the participant. e.g. "Years"
35
35
  age_at_enrollment_units: AgeAtEnrollmentUnits | None = None
36
36
 
37
- # Indicates whether the participant is 90 years old or older. (for PHI purposes)
37
+ # Indicates whether the participant is 90 years old or over. (for PHI purposes)
38
38
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15354920%20and%20ver_nr=1
39
- age_90_or_older: bool
39
+ age_90_or_over: bool
40
40
 
41
41
  # A textual description of a person's sex at birth. e.g. "Male"
42
42
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=7572817%20and%20ver_nr=3
@@ -44,7 +44,7 @@ class Demographic(Base):
44
44
 
45
45
  # The race of the participant. e.g. "White"
46
46
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2192199%20and%20ver_nr=1
47
- race: Race
47
+ race: Annotated[List[Race], BeforeValidator(Base.split_list)]
48
48
 
49
49
  # The ethnicity of the participant. e.g. "Hispanic or Latino"
50
50
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2192217%20and%20ver_nr=2
@@ -68,15 +68,15 @@ class Demographic(Base):
68
68
 
69
69
  # The body mass index of the participant at the enrollment date.
70
70
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2006410%20and%20ver_nr=3
71
- body_mass_index: PositiveFloat
71
+ body_mass_index: PositiveFloat | None = None
72
72
 
73
73
  # 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.
74
74
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6606197%20and%20ver_nr=1
75
- body_surface_area: PositiveFloat
75
+ body_surface_area: PositiveFloat | None = None
76
76
 
77
77
  # Unit of measurement for body surface area of the participant at the enrollment date. e.g. "m2"
78
78
  # https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15114329%20and%20ver_nr=1
79
- body_surface_area_units: BodySurfaceAreaUnits
79
+ body_surface_area_units: BodySurfaceAreaUnits | None = None
80
80
 
81
81
  # The occupation/job category of the participant. e.g. "Manager"
82
82
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6617540%20and%20ver_nr=1
@@ -92,23 +92,32 @@ class Demographic(Base):
92
92
 
93
93
  @model_validator(mode="after")
94
94
  def validate_age_at_enrollment_cr(self) -> Self:
95
- if self.age_90_or_older:
95
+ if self.age_90_or_over:
96
96
  if self.age_at_enrollment or self.age_at_enrollment_units:
97
97
  raise ValueError(
98
- 'If "age_90_or_older" is "Yes" then "age_at_enrollment" and "age_at_enrollment_units" must be blank.'
98
+ 'If "age_90_or_over" is "Yes" then "age_at_enrollment" and "age_at_enrollment_units" must be blank.'
99
99
  )
100
100
  else:
101
101
  if not self.age_at_enrollment or not self.age_at_enrollment_units:
102
102
  raise ValueError(
103
- 'If "age_90_or_older" is "No" then "age_at_enrollment" and "age_at_enrollment_units" are required.'
103
+ 'If "age_90_or_over" is "No" then "age_at_enrollment" and "age_at_enrollment_units" are required.'
104
104
  )
105
105
  return self
106
106
 
107
107
  @model_validator(mode="after")
108
108
  def validate_age_at_enrollment_value(self) -> Self:
109
- age_in_years = (
110
- self.age_at_enrollment if self.age_at_enrollment_units == "Years" else self.age_at_enrollment / 365.25
111
- )
112
- if age_in_years >= 90:
113
- raise ValueError('"age_at_enrollment" cannot represent a value greater than 90 years of age.')
109
+ if not self.age_90_or_over:
110
+ age_in_years = (
111
+ self.age_at_enrollment if self.age_at_enrollment_units == "Years" else self.age_at_enrollment / 365.25
112
+ )
113
+ if age_in_years >= 90:
114
+ raise ValueError('"age_at_enrollment" cannot represent a value greater than 90 years of age.')
115
+ return self
116
+
117
+ @model_validator(mode="after")
118
+ def validate_body_surface_area_units_cr(self) -> Self:
119
+ if self.body_surface_area and not self.body_surface_area_units:
120
+ raise ValueError(
121
+ 'If "body_surface_area" is provided then "body_surface_area_units_other" must also be provided.'
122
+ )
114
123
  return self
@@ -1,12 +1,14 @@
1
- from pydantic import NonPositiveInt, model_validator
2
- from typing import List, Self
1
+ from pydantic import NonPositiveInt, model_validator, BeforeValidator
2
+ from typing import List, Self, Annotated, get_args
3
3
 
4
- from .base import Base
4
+ from cidc_api.models.pydantic.base import Base
5
5
  from cidc_api.models.types import (
6
- PrimaryDiagnosisDiseaseGroup,
7
6
  TumorGrade,
8
7
  CancerStageSystem,
9
8
  CancerStageSystemVersion,
9
+ CancerStageSystemVersionAJCC,
10
+ CancerStageSystemVersionRISS,
11
+ CancerStageSystemVersionFIGO,
10
12
  CancerStage,
11
13
  TCategory,
12
14
  NCategory,
@@ -27,12 +29,7 @@ class Disease(Base):
27
29
 
28
30
  # The unique internal identifier for the associated participant
29
31
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
30
- participant_id: int | None = None
31
-
32
- # A term describing the main condition for evaluation and treatment as captured in the Disease or Diagnosis (C2991)
33
- # branch of the National Cancer Institute Thesaurus (NCIt) hierarchy tree. e.g. "Melanoma"
34
- # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14905532%20and%20ver_nr=1
35
- primary_diagnosis_disease_group: PrimaryDiagnosisDiseaseGroup
32
+ participant_id: str | None = None
36
33
 
37
34
  # The location within the body from where the disease of interest originated as captured in the Uberon identifier. e.g. "lung"
38
35
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14883047%20and%20ver_nr=1
@@ -40,18 +37,18 @@ class Disease(Base):
40
37
 
41
38
  # The ICD-O-3 morphology code that describes the tumor's histology, behavior, and grade-differentiation. e.g. "8480/6"
42
39
  # CDE: TBD
43
- morphological_code: ICDO3MorphologicalCode
40
+ morphological_code: ICDO3MorphologicalCode | None
44
41
 
45
42
  # The ICD-O-3 morphology term that describes the tumor's type. e.g. "Mucinous adenoma"
46
43
  # CDE: TBD
47
- morphological_term: ICDO3MorphologicalTerm
44
+ morphological_term: ICDO3MorphologicalTerm | None
48
45
 
49
46
  # Words that broadly describe the cancer's characteristics and type. e.g. "Inflitrating Ductal Carcinoma"
50
47
  # CDE: TBD
51
48
  cancer_type_description: str | None = None
52
49
 
53
50
  # The number of days elapsed since the participant was first diagnosed with this condition.
54
- days_since_original_diagnosis: NonPositiveInt
51
+ days_since_original_diagnosis: NonPositiveInt | None
55
52
 
56
53
  # Words that express the degree of abnormality of cancer cells as a measure of differentiation and aggressiveness. e.g. "G1 Low Grade"
57
54
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=11325685%20and%20ver_nr=2
@@ -68,32 +65,32 @@ class Disease(Base):
68
65
  # CDE(AJCC): https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=3440332%20and%20ver_nr=1
69
66
  # CDE(FIGO): TBD
70
67
  # CDE(RISS): TBD
71
- cancer_stage: CancerStage
68
+ cancer_stage: CancerStage | None = None
72
69
 
73
70
  # Extent of the primary cancer based on evidence obtained from clinical assessment parameters determined prior to treatment. e.g. "T0"
74
71
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=3440328%20and%20ver_nr=1
75
72
  # TODO: Verify this CDE
76
- t_category: TCategory
73
+ t_category: TCategory | None = None
77
74
 
78
75
  # Extent of the regional lymph node involvement for the cancer based on evidence obtained from clinical assessment parameters
79
76
  # determined prior to treatment. e.g. "N0"
80
77
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=3440330%20and%20ver_nr=1
81
78
  # TODO: Verify this CDE
82
- n_category: NCategory
79
+ n_category: NCategory | None = None
83
80
 
84
81
  # Extent of the distant metastasis for the cancer based on evidence obtained from clinical assessment parameters determined
85
82
  # prior to treatment. e.g. "M0"
86
83
  # 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
87
84
  # TODO: Verify this CDE
88
- m_category: MCategory
85
+ m_category: MCategory | None = None
89
86
 
90
87
  # The organ site where a tumor develops outside of the bone marrow as specified in the Uberon antatomical term.
91
- metastatic_organ: List[UberonAnatomicalTerm] = []
88
+ metastatic_organ: Annotated[List[UberonAnatomicalTerm] | None, BeforeValidator(Base.split_list)] = []
92
89
 
93
90
  # Indicates if participant has a hematological malignancy that is only extramedullary. e.g. "Yes"
94
91
  solely_extramedullary_disease: YNU
95
92
 
96
- extramedullary_organ: List[UberonAnatomicalTerm] = []
93
+ extramedullary_organ: Annotated[List[UberonAnatomicalTerm] | None, BeforeValidator(Base.split_list)] = []
97
94
 
98
95
  @model_validator(mode="after")
99
96
  def validate_code_or_term_or_description_cr(self) -> Self:
@@ -103,6 +100,23 @@ class Disease(Base):
103
100
  )
104
101
  return self
105
102
 
103
+ @model_validator(mode="after")
104
+ def validate_cancer_stage_system_version(self) -> Self:
105
+ msg = f"{self.cancer_stage_system_version} is not applicable to {self.cancer_stage_system}"
106
+ if self.cancer_stage_system == "AJCC" and self.cancer_stage_system_version not in get_args(
107
+ CancerStageSystemVersionAJCC
108
+ ):
109
+ raise ValueError(msg)
110
+ elif self.cancer_stage_system == "RISS" and self.cancer_stage_system_version not in get_args(
111
+ CancerStageSystemVersionRISS
112
+ ):
113
+ raise ValueError(msg)
114
+ elif self.cancer_stage_system == "FIGO" and self.cancer_stage_system_version not in get_args(
115
+ CancerStageSystemVersionFIGO
116
+ ):
117
+ raise ValueError(msg)
118
+ return self
119
+
106
120
  @model_validator(mode="after")
107
121
  def validate_cancer_stage_system_version_cr(self) -> Self:
108
122
  if self.cancer_stage_system != "Not Applicable" and not self.cancer_stage_system_version:
@@ -2,7 +2,7 @@ from typing import Self
2
2
 
3
3
  from pydantic import model_validator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
6
  from cidc_api.models.types import YNU, ExposureType
7
7
 
8
8
 
@@ -14,7 +14,7 @@ class Exposure(Base):
14
14
  exposure_id: int | None = None
15
15
 
16
16
  # The unique identifier for the associated participant
17
- participant_id: int | None = None
17
+ participant_id: str | None = None
18
18
 
19
19
  # An indication of whether the subject was exposed to any chemical, biological or physical agents
20
20
  # that increase the risk of neoplasms in humans or animals.
@@ -23,7 +23,7 @@ class Exposure(Base):
23
23
 
24
24
  # The type of potentially harmful environmental agents to which an individual was exposed.
25
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
26
+ exposure_type: ExposureType | None = None
27
27
 
28
28
  @model_validator(mode="after")
29
29
  def validate_exposure_type_cr(self) -> Self:
@@ -1,5 +1,5 @@
1
1
  from datetime import datetime
2
- from .base import Base
2
+ from cidc_api.models.pydantic.base import Base
3
3
  from cidc_api.models.types import ChecksumType, FileFormat
4
4
 
5
5
 
@@ -8,7 +8,7 @@ class File(Base):
8
8
  file_id: int | None = None
9
9
 
10
10
  # The unique identifier for the associated trial
11
- trial_id: int | None = None
11
+ trial_id: str | None = None
12
12
 
13
13
  # The version number of the trial dataset
14
14
  version: str | None = None
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
  from cidc_api.models.types import (
3
3
  GVHDDiagnosisAcuteAssessmentSystem,
4
4
  GVHDDiagnosisAcuteAssessmentSystemVersion,
@@ -15,7 +15,7 @@ class GVHDDiagnosisAcute(Base):
15
15
  gvhd_diagnosis_acute_id: int | None = None
16
16
 
17
17
  # The unique internal identifier for the associated participant
18
- participant_id: int | None = None
18
+ participant_id: str | None = None
19
19
 
20
20
  # The clinical grading system used to stage involvement of affected organs (skin, liver, GI tract)
21
21
  # in acute GVHD and assign an overall severity grade (I–IV) based on predefined criteria.
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
  from cidc_api.models.types import (
3
3
  GVHDDiagnosisChronicAssessmentSystem,
4
4
  GVHDDiagnosisChronicAssessmentSystemVersion,
@@ -15,7 +15,7 @@ class GVHDDiagnosisChronic(Base):
15
15
  gvhd_diagnosis_chronic_id: int | None = None
16
16
 
17
17
  # The unique internal identifier for the associated participant
18
- participant_id: int | None = None
18
+ participant_id: str | None = None
19
19
 
20
20
  # The standardized clinical system used to evaluate and grade the extent and severity
21
21
  # of organ involvement in chronic GVHD, resulting in an overall disease severity score.
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
  from cidc_api.models.types import (
3
3
  GVHDOrgan,
4
4
  GVHDOrganAcuteStage,
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
  from cidc_api.models.types import (
3
3
  GVHDOrgan,
4
4
  GVHDOrganChronicScore,
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
 
3
3
 
4
4
  class Institution(Base):
@@ -2,7 +2,7 @@ from typing import Self
2
2
 
3
3
  from pydantic import NonNegativeInt, PositiveFloat, model_validator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
6
  from cidc_api.models.types import TobaccoSmokingStatus
7
7
 
8
8
 
@@ -14,7 +14,7 @@ class MedicalHistory(Base):
14
14
  medical_history_id: int | None = None
15
15
 
16
16
  # The unique identifier for the associated participant
17
- participant_id: int | None = None
17
+ participant_id: str | None = None
18
18
 
19
19
  # Text representation of a person's status relative to smoking tobacco in the form of cigarettes,
20
20
  # based on questions about current and former use of cigarettes.
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
  from cidc_api.models.types import YNU, ResponseSystem, ResponseSystemVersion
3
3
 
4
4
 
@@ -2,7 +2,7 @@ from typing import Self
2
2
 
3
3
  from pydantic import NonPositiveInt, model_validator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
6
  from cidc_api.models.types import UberonAnatomicalTerm, ICDO3MorphologicalCode, ICDO3MorphologicalTerm, MalignancyStatus
7
7
 
8
8
 
@@ -17,28 +17,32 @@ class OtherMalignancy(Base):
17
17
  medical_history_id: int | None = None
18
18
 
19
19
  # The location within the body from where the prior malignancy originated as captured in the Uberon anatomical term.
20
- primary_disease_site: UberonAnatomicalTerm
20
+ other_malignancy_primary_disease_site: UberonAnatomicalTerm
21
21
 
22
22
  # The ICD-O-3 code which identifies the specific appearance of cells and tissues (normal and abnormal) used
23
23
  # to define the presence and nature of disease.
24
- morphological_code: ICDO3MorphologicalCode | None = None
24
+ other_malignancy_morphological_code: ICDO3MorphologicalCode | None = None
25
25
 
26
26
  # The ICD-O-3 textual label which identifies the specific appearance of cells and tissues (normal and abnormal) used
27
27
  # to define the presence and nature of disease.
28
- morphological_term: ICDO3MorphologicalTerm | None = None
28
+ other_malignancy_morphological_term: ICDO3MorphologicalTerm | None = None
29
29
 
30
30
  # Description of the cancer type as recorded in the trial.
31
- malignancy_description: str | None = None
31
+ other_malignancy_description: str | None = None
32
32
 
33
33
  # Number of days since original diagnosis from the enrollment date. This may be a negative number.
34
- days_since_diagnosis: NonPositiveInt | None = None
34
+ other_malignancy_days_since_diagnosis: NonPositiveInt | None = None
35
35
 
36
36
  # Indicates the participant’s current clinical state regarding the cancer diagnosis.
37
- malignancy_status: MalignancyStatus | None = None
37
+ other_malignancy_status: MalignancyStatus | None = None
38
38
 
39
39
  @model_validator(mode="after")
40
40
  def validate_code_or_term_or_description_cr(self) -> Self:
41
- if not self.morphological_code and not self.morphological_term and not self.malignancy_description:
41
+ if (
42
+ not self.other_malignancy_morphological_code
43
+ and not self.other_malignancy_morphological_term
44
+ and not self.other_malignancy_description
45
+ ):
42
46
  raise ValueError(
43
47
  'Please provide at least one of "morphological_code", "morphological_term" or "malignancy_description".'
44
48
  )
@@ -2,7 +2,8 @@ from typing import Self
2
2
 
3
3
  from pydantic import model_validator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
+ from cidc_api.models.types import YNU
6
7
  from cidc_api.models.types import OffStudyReason
7
8
 
8
9
 
@@ -12,20 +13,23 @@ class Participant(Base):
12
13
 
13
14
  # The unique internal identifier for the participant
14
15
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
15
- participant_id: int | None = None
16
+ participant_id: str | None = None
16
17
 
17
18
  # The participant identifier assigned by the clinical trial team overseeing the study
18
19
  native_participant_id: str
19
20
 
20
21
  # The globally unique participant identifier assigned by the CIMAC network. e.g. C8P29A7
21
- cimac_participant_id: str
22
+ cimac_participant_id: str | None = None
22
23
 
23
24
  # The unique identifier for the associated trial that the participant is participating in
24
- trial_id: int | None = None
25
+ trial_id: str | None = None
26
+
27
+ # The version number of the trial dataset. e.g. "1.0"
28
+ version: str | None = None
25
29
 
26
30
  # Indicates if the individual is no longer actively participating in the clinical trial.
27
31
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14834973%20and%20ver_nr=1
28
- off_study: bool
32
+ off_study: YNU
29
33
 
30
34
  # An explanation describing why an individual is no longer participating in the clinical trial.
31
35
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=13362265%20and%20ver_nr=1
@@ -36,7 +40,7 @@ class Participant(Base):
36
40
 
37
41
  @model_validator(mode="after")
38
42
  def off_study_reason_cr(self) -> Self:
39
- if self.off_study and not self.off_study_reason:
43
+ if self.off_study == "Yes" and not self.off_study_reason:
40
44
  raise ValueError('If "off_study" is "Yes" then "off_study_reason" is required.')
41
45
  return self
42
46
 
@@ -1,9 +1,9 @@
1
- from typing import Self
1
+ from typing import Self, Annotated, List
2
2
 
3
- from pydantic import NonPositiveInt, NonNegativeInt, model_validator
3
+ from pydantic import NonPositiveInt, NegativeInt, model_validator, BeforeValidator
4
4
 
5
- from .base import Base
6
- from cidc_api.models.types import PriorTreatmentType, ConditioningRegimenType, StemCellDonorType
5
+ from cidc_api.models.pydantic.base import Base
6
+ from cidc_api.models.types import ConditioningRegimenType, StemCellDonorType
7
7
 
8
8
 
9
9
  class PriorTreatment(Base):
@@ -14,39 +14,30 @@ class PriorTreatment(Base):
14
14
  prior_treatment_id: int | None = None
15
15
 
16
16
  # A unique internal identifier for the associated participant record
17
- participant_id: int | None = None
17
+ participant_id: str | None = None
18
18
 
19
19
  # Number of days from the enrollment date to the first recorded administration or occurrence of
20
20
  # the treatment modality.
21
- days_to_start: NonPositiveInt | None = None
21
+ prior_treatment_days_to_start: NonPositiveInt | None = None
22
22
 
23
23
  # Number of days from the enrollment date to the last recorded administration or occurrence of
24
24
  # the treatment modality.
25
- days_to_end: NonPositiveInt | None = None
26
-
27
- # Specifies the category or kind of prior treatment modality a participant received.
28
- type: PriorTreatmentType
25
+ prior_treatment_days_to_end: NonPositiveInt | None = None
29
26
 
30
27
  # Description of the prior treatment such as its full generic name if it is a type of therapy agent,
31
28
  # radiotherapy procedure name and location, or surgical procedure name and location.
32
- description: str | None = None
29
+ prior_treatment_description: str
33
30
 
34
31
  # Best response from any response assessment system to the prior treatment if available or applicable.
35
- best_response: str | None = None
32
+ prior_treatment_best_response: str | None = None
36
33
 
37
34
  # If the prior treatment is "Conditioning therapy" received before a stem cell transplant, specifies what
38
35
  # type of conditioning regimen used.
39
- conditioning_regimen_type: ConditioningRegimenType | None = None
36
+ prior_treatment_conditioning_regimen_type: ConditioningRegimenType | None = None
40
37
 
41
38
  # If prior treatment is "Stem cell transplant", indicates what stem cell donor type used.
42
- stem_cell_donor_type: StemCellDonorType | None = None
43
-
44
- # If prior treatment is "Stem cell transplant", indicates the number of days from the transplant
45
- # date to the start of the current treatment.
46
- days_from_transplant_to_treatment_initiation: NonNegativeInt | None = None
39
+ prior_treatment_stem_cell_donor_type: StemCellDonorType | None = None
47
40
 
48
- @model_validator(mode="after")
49
- def validate_description_cr(self) -> Self:
50
- if self.type == "Other therapy" and not self.description:
51
- raise ValueError('If type is "Other therapy", please provide description.')
52
- return self
41
+ # If prior treatment is "Stem cell transplant", indicates the number of days from enrollment
42
+ # to the prior transplant. This must be a negative number.
43
+ prior_treatment_days_from_transplant_to_treatment_initiation: NegativeInt | None = None
@@ -1,4 +1,4 @@
1
- from .base import Base
1
+ from cidc_api.models.pydantic.base import Base
2
2
 
3
3
 
4
4
  class Publication(Base):
@@ -6,7 +6,7 @@ class Publication(Base):
6
6
  publication_id: int | None = None
7
7
 
8
8
  # The unique internal identifier for the associated Trial record
9
- trial_id: int | None = None
9
+ trial_id: str | None = None
10
10
 
11
11
  # The version number of the trial dataset
12
12
  version: str | None = None
@@ -2,7 +2,7 @@ from typing import Self
2
2
 
3
3
  from pydantic import NonNegativeInt, NonNegativeFloat, model_validator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
6
  from cidc_api.models.types import (
7
7
  YNU,
8
8
  RadiotherapyProcedure,
@@ -17,7 +17,7 @@ class RadiotherapyDose(Base):
17
17
  __cardinality__ = "many"
18
18
 
19
19
  # The unique internal identifier for the radiotherapy dose record
20
- therapy_agent_dose_id: int | None = None
20
+ radiotherapy_dose_id: int | None = None
21
21
 
22
22
  # The unique internal identifier for the associated treatment record
23
23
  treatment_id: int | None = None
@@ -2,7 +2,7 @@ from typing import Self
2
2
 
3
3
  from pydantic import NonNegativeInt, model_validator
4
4
 
5
- from .base import Base
5
+ from cidc_api.models.pydantic.base import Base
6
6
  from cidc_api.models.types import SurvivalStatus, YNUNA, CauseOfDeath
7
7
 
8
8
 
@@ -15,14 +15,14 @@ class Response(Base):
15
15
 
16
16
  # The unique internal identifier for the associated participant
17
17
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
18
- participant_id: int | None = None
18
+ participant_id: str | None = None
19
19
 
20
20
  # The response to a question that describes a participant's survival status.
21
21
  # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2847330%20and%20ver_nr=1
22
22
  survival_status: SurvivalStatus
23
23
 
24
24
  # Number of days from enrollment date to death date.
25
- overall_survival: NonNegativeInt | None = None
25
+ overall_survival: NonNegativeInt
26
26
 
27
27
  # Indicator for whether there was an abscopal effect on disease after local therapy.
28
28
  abscopal_response: YNUNA | None = None
@@ -43,14 +43,8 @@ class Response(Base):
43
43
  # Indicates whether participant was evaluable for efficacy (for example, response, PFS, OS, etc.) overall.
44
44
  evaluable_for_efficacy: bool
45
45
 
46
- # Days from enrollment date to the last time patient had follow-up.
47
- days_to_last_follow_up: NonNegativeInt | None = None
48
-
49
- @model_validator(mode="after")
50
- def validate_overall_survival_cr(self) -> Self:
51
- if self.survival_status != "Unknown" and not self.overall_survival:
52
- raise ValueError('If survival_status is not "Unknown" then overall_survival is required.')
53
- return self
46
+ # Days from enrollment date to the last time the patient's vital status was verified.
47
+ days_to_last_vital_status: NonNegativeInt | None = None # TODO: Needs CR check
54
48
 
55
49
  @model_validator(mode="after")
56
50
  def validate_cause_of_death_cr(self) -> Self: