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,10 +1,10 @@
1
- from typing import List, Optional
2
-
1
+ from __future__ import annotations
2
+ from typing import List
3
3
  from sqlalchemy import ForeignKey, ForeignKeyConstraint
4
4
  from sqlalchemy.orm import Mapped, mapped_column, relationship
5
5
 
6
- from cidc_api.models.db.base_orm import BaseORM
7
- from cidc_api.models.types import OffStudyReason
6
+ from cidc_api.models.db.stage2.base_orm import BaseORM
7
+ from cidc_api.models.types import OffStudyReason, YNU
8
8
 
9
9
 
10
10
  class ParticipantORM(BaseORM):
@@ -14,66 +14,66 @@ class ParticipantORM(BaseORM):
14
14
  ForeignKeyConstraint(
15
15
  ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
16
16
  ),
17
- {"schema": "stage2"},
18
17
  )
18
+ __data_category__ = "participant"
19
19
 
20
20
  participant_id: Mapped[int] = mapped_column(primary_key=True)
21
21
  trial_id: Mapped[str]
22
22
  version: Mapped[str]
23
23
 
24
- native_participant_id: Mapped[str]
25
- cimac_participant_id: Mapped[str] = mapped_column(unique=True)
26
- consent_group_id: Mapped[Optional[int]] = mapped_column(
24
+ native_participant_id: Mapped[str | None]
25
+ cimac_participant_id: Mapped[str | None]
26
+ consent_group_id: Mapped[int | None] = mapped_column(
27
27
  ForeignKey("stage2.consent_group.consent_group_id", ondelete="CASCADE")
28
28
  )
29
- off_study: Mapped[bool]
30
- off_study_reason: Mapped[Optional[OffStudyReason]]
31
- off_study_reason_other: Mapped[Optional[str]]
29
+ off_study: Mapped[YNU]
30
+ off_study_reason: Mapped[OffStudyReason | None]
31
+ off_study_reason_other: Mapped[str | None]
32
32
 
33
- trial: Mapped["TrialORM"] = relationship(back_populates="participants", cascade="all, delete")
34
- demographic: Mapped["DemographicORM"] = relationship(
33
+ trial: Mapped[TrialORM] = relationship(back_populates="participants", cascade="all, delete")
34
+ demographic: Mapped[DemographicORM] = relationship(
35
35
  back_populates="participant", cascade="all, delete", passive_deletes=True
36
36
  )
37
- prior_treatments: Mapped[List["PriorTreatmentORM"]] = relationship(
37
+ prior_treatments: Mapped[List[PriorTreatmentORM]] = relationship(
38
38
  back_populates="participant", cascade="all, delete", passive_deletes=True
39
39
  )
40
- treatments: Mapped[List["TreatmentORM"]] = relationship(
40
+ treatments: Mapped[List[TreatmentORM]] = relationship(
41
41
  back_populates="participant", cascade="all, delete", passive_deletes=True
42
42
  )
43
- diseases: Mapped[List["DiseaseORM"]] = relationship(
43
+ diseases: Mapped[List[DiseaseORM]] = relationship(
44
44
  back_populates="participant", cascade="all, delete", passive_deletes=True
45
45
  )
46
- response_by_systems: Mapped[List["ResponseBySystemORM"]] = relationship(
46
+ response_by_systems: Mapped[List[ResponseBySystemORM]] = relationship(
47
47
  back_populates="participant", cascade="all, delete", passive_deletes=True
48
48
  )
49
- response: Mapped[Optional["ResponseORM"]] = relationship(
49
+ response: Mapped[ResponseORM | None] = relationship(
50
50
  back_populates="participant", cascade="all, delete", passive_deletes=True
51
51
  )
52
- adverse_events: Mapped[List["AdverseEventORM"]] = relationship(
52
+ adverse_events: Mapped[List[AdverseEventORM]] = relationship(
53
53
  back_populates="participant", cascade="all, delete", passive_deletes=True
54
54
  )
55
- baseline_clinical_assessment: Mapped[Optional["BaselineClinicalAssessmentORM"]] = relationship(
55
+ baseline_clinical_assessment: Mapped[BaselineClinicalAssessmentORM | None] = relationship(
56
56
  back_populates="participant", cascade="all, delete", passive_deletes=True
57
57
  )
58
- medical_history: Mapped[Optional["MedicalHistoryORM"]] = relationship(
58
+ medical_history: Mapped[MedicalHistoryORM | None] = relationship(
59
59
  back_populates="participant", cascade="all, delete", passive_deletes=True
60
60
  )
61
- exposures: Mapped[List["ExposureORM"]] = relationship(
61
+ exposures: Mapped[List[ExposureORM]] = relationship(
62
62
  back_populates="participant", cascade="all, delete", passive_deletes=True
63
63
  )
64
- gvhd_diagnosis_acutes: Mapped[List["GVHDDiagnosisAcuteORM"]] = relationship(
64
+ gvhd_diagnosis_acutes: Mapped[List[GVHDDiagnosisAcuteORM]] = relationship(
65
65
  back_populates="participant", cascade="all, delete", passive_deletes=True
66
66
  )
67
- gvhd_diagnosis_chronics: Mapped[List["GVHDDiagnosisChronicORM"]] = relationship(
67
+ gvhd_diagnosis_chronics: Mapped[List[GVHDDiagnosisChronicORM]] = relationship(
68
68
  back_populates="participant", cascade="all, delete", passive_deletes=True
69
69
  )
70
- specimens: Mapped[List["SpecimenORM"]] = relationship(
70
+ specimens: Mapped[List[SpecimenORM]] = relationship(
71
71
  back_populates="participant", cascade="all, delete", passive_deletes=True
72
72
  )
73
- other_clinical_endpoints: Mapped[List["OtherClinicalEndpointORM"]] = relationship(
73
+ other_clinical_endpoints: Mapped[List[OtherClinicalEndpointORM]] = relationship(
74
74
  back_populates="participant", cascade="all, delete", passive_deletes=True
75
75
  )
76
- additional_treatments: Mapped[List["AdditionalTreatmentORM"]] = relationship(
76
+ additional_treatments: Mapped[List[AdditionalTreatmentORM]] = relationship(
77
77
  back_populates="participant", cascade="all, delete", passive_deletes=True
78
78
  )
79
- consent_group: Mapped["ConsentGroupORM"] = relationship(back_populates="participants", cascade="all, delete")
79
+ consent_group: Mapped[ConsentGroupORM] = relationship(back_populates="participants", cascade="all, delete")
@@ -1,28 +1,29 @@
1
- from typing import Optional
1
+ from __future__ import annotations
2
+ from typing import List
2
3
 
3
- from pydantic import NonPositiveInt, NonNegativeInt
4
+ from pydantic import NonPositiveInt, NegativeInt
4
5
  from sqlalchemy import ForeignKey
5
6
  from sqlalchemy.orm import Mapped, mapped_column, relationship
7
+ from sqlalchemy.types import JSON
6
8
 
7
- from cidc_api.models.db.base_orm import BaseORM
8
- from cidc_api.models.types import PriorTreatmentType, ConditioningRegimenType, StemCellDonorType
9
+ from cidc_api.models.db.stage2.base_orm import BaseORM
10
+ from cidc_api.models.types import ConditioningRegimenType, StemCellDonorType
9
11
 
10
12
 
11
13
  class PriorTreatmentORM(BaseORM):
12
14
  __tablename__ = "prior_treatment"
13
15
  __repr_attrs__ = ["prior_treatment_id", "type"]
14
- __table_args__ = {"schema": "stage2"}
16
+ __data_category__ = "prior_treatment"
15
17
 
16
18
  prior_treatment_id: Mapped[int] = mapped_column(primary_key=True)
17
19
  participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
18
20
 
19
- days_to_start: Mapped[Optional[NonPositiveInt]]
20
- days_to_end: Mapped[Optional[NonPositiveInt]]
21
- type: Mapped[PriorTreatmentType]
22
- description: Mapped[Optional[str]]
23
- best_response: Mapped[Optional[str]]
24
- conditioning_regimen_type: Mapped[Optional[ConditioningRegimenType]]
25
- stem_cell_donor_type: Mapped[Optional[StemCellDonorType]]
26
- days_from_transplant_to_treatment_initiation: Mapped[Optional[NonNegativeInt]]
21
+ prior_treatment_days_to_start: Mapped[NonPositiveInt | None]
22
+ prior_treatment_days_to_end: Mapped[NonPositiveInt | None]
23
+ prior_treatment_description: Mapped[str]
24
+ prior_treatment_best_response: Mapped[str | None]
25
+ prior_treatment_conditioning_regimen_type: Mapped[ConditioningRegimenType | None]
26
+ prior_treatment_stem_cell_donor_type: Mapped[StemCellDonorType | None]
27
+ prior_treatment_days_to_prior_transplant: Mapped[NegativeInt | None]
27
28
 
28
- participant: Mapped["ParticipantORM"] = relationship(back_populates="prior_treatments", cascade="all, delete")
29
+ participant: Mapped[ParticipantORM] = relationship(back_populates="prior_treatments", cascade="all, delete")
@@ -1,10 +1,9 @@
1
- from typing import Optional, List
2
-
1
+ from __future__ import annotations
3
2
  from sqlalchemy import ForeignKeyConstraint, ForeignKey
4
3
  from sqlalchemy.orm import Mapped, mapped_column, relationship
5
4
 
6
- from cidc_api.models.db.base_orm import BaseORM
7
- from cidc_api.models.types import PriorTreatmentType, ConditioningRegimenType, StemCellDonorType
5
+ from cidc_api.models.db.stage2.base_orm import BaseORM
6
+ from cidc_api.models.types import ConditioningRegimenType, StemCellDonorType
8
7
 
9
8
 
10
9
  class PublicationORM(BaseORM):
@@ -14,7 +13,6 @@ class PublicationORM(BaseORM):
14
13
  ForeignKeyConstraint(
15
14
  ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
16
15
  ),
17
- {"schema": "stage2"},
18
16
  )
19
17
 
20
18
  publication_id: Mapped[int] = mapped_column(primary_key=True)
@@ -22,10 +20,10 @@ class PublicationORM(BaseORM):
22
20
  version: Mapped[str]
23
21
 
24
22
  digital_object_id: Mapped[str]
25
- pubmed_id: Mapped[Optional[str]]
26
- publication_title: Mapped[Optional[str]]
27
- authorship: Mapped[Optional[str]]
28
- year_of_publication: Mapped[Optional[str]]
29
- journal_citation: Mapped[Optional[str]]
23
+ pubmed_id: Mapped[str | None]
24
+ publication_title: Mapped[str | None]
25
+ authorship: Mapped[str | None]
26
+ year_of_publication: Mapped[str | None]
27
+ journal_citation: Mapped[str | None]
30
28
 
31
- trial: Mapped["TrialORM"] = relationship(back_populates="publications", cascade="all, delete")
29
+ trial: Mapped[TrialORM] = relationship(back_populates="publications", cascade="all, delete")
@@ -1,10 +1,10 @@
1
+ from __future__ import annotations
1
2
  from pydantic import NonNegativeInt, NonNegativeFloat, PositiveFloat
2
- from typing import Optional
3
3
 
4
4
  from sqlalchemy import ForeignKey
5
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
6
6
 
7
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
8
8
  from cidc_api.models.types import (
9
9
  RadiotherapyProcedure,
10
10
  UberonAnatomicalTerm,
@@ -17,7 +17,7 @@ from cidc_api.models.types import (
17
17
  class RadiotherapyDoseORM(BaseORM):
18
18
  __tablename__ = "radiotherapy_dose"
19
19
  __repr_attrs__ = ["radiotherapy_dose_id", "procedure"]
20
- __table_args__ = {"schema": "stage2"}
20
+ __data_category__ = "radiotherapy_dose"
21
21
 
22
22
  radiotherapy_dose_id: Mapped[int] = mapped_column(primary_key=True)
23
23
  treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
@@ -25,15 +25,15 @@ class RadiotherapyDoseORM(BaseORM):
25
25
  days_to_start: Mapped[NonNegativeInt]
26
26
  days_to_end: Mapped[NonNegativeInt]
27
27
  procedure: Mapped[RadiotherapyProcedure]
28
- anatomical_location: Mapped[Optional[UberonAnatomicalTerm]]
28
+ anatomical_location: Mapped[UberonAnatomicalTerm | None]
29
29
  is_total_dose: Mapped[bool]
30
- number_of_fractions: Mapped[Optional[NonNegativeInt]]
30
+ number_of_fractions: Mapped[NonNegativeInt | None]
31
31
  received_dose: Mapped[NonNegativeFloat]
32
32
  received_dose_units: Mapped[RadiotherapyDoseUnits]
33
- planned_dose: Mapped[Optional[PositiveFloat]]
34
- planned_dose_units: Mapped[Optional[RadiotherapyDoseUnits]]
33
+ planned_dose: Mapped[PositiveFloat | None]
34
+ planned_dose_units: Mapped[RadiotherapyDoseUnits | None]
35
35
  dose_changes_delays: Mapped[YNU]
36
- changes_delays_description: Mapped[Optional[str]]
36
+ changes_delays_description: Mapped[str | None]
37
37
  radiation_extent: Mapped[RadiationExtent]
38
38
 
39
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="radiotherapy_doses", cascade="all, delete")
39
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="radiotherapy_doses", cascade="all, delete")
@@ -1,15 +1,16 @@
1
+ from __future__ import annotations
1
2
  from pydantic import PositiveInt
2
3
  from sqlalchemy import ForeignKey, String
3
4
  from sqlalchemy.orm import Mapped, mapped_column, relationship
4
5
 
5
- from cidc_api.models.db.base_orm import BaseORM
6
+ from cidc_api.models.db.stage2.base_orm import BaseORM
6
7
  from cidc_api.models.types import ResponseSystem, ResponseSystemVersion, BestOverallResponse, YNUNA
7
8
 
8
9
 
9
10
  class ResponseBySystemORM(BaseORM):
10
11
  __tablename__ = "response_by_system"
11
12
  __repr_attrs__ = ["response_by_system_id", "participant_id"]
12
- __table_args__ = {"schema": "stage2"}
13
+ __data_category__ = "response_by_system"
13
14
 
14
15
  response_by_system_id: Mapped[int] = mapped_column(primary_key=True)
15
16
  participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
@@ -17,6 +18,7 @@ class ResponseBySystemORM(BaseORM):
17
18
  response_system_version: Mapped[ResponseSystemVersion] = mapped_column(String)
18
19
  best_overall_response: Mapped[BestOverallResponse] = mapped_column(String)
19
20
  response_duration: Mapped[PositiveInt | None]
21
+ duration_of_stable_disease: Mapped[PositiveInt | None]
20
22
  durable_clinical_benefit: Mapped[bool | None]
21
23
  days_to_first_response: Mapped[PositiveInt | None]
22
24
  days_to_best_response: Mapped[PositiveInt | None]
@@ -25,4 +27,4 @@ class ResponseBySystemORM(BaseORM):
25
27
  progression_free_survival_event: Mapped[YNUNA]
26
28
  progression_free_survival: Mapped[PositiveInt | None]
27
29
 
28
- participant: Mapped["ParticipantORM"] = relationship(back_populates="response_by_systems", cascade="all, delete")
30
+ participant: Mapped[ParticipantORM] = relationship(back_populates="response_by_systems", cascade="all, delete")
@@ -1,27 +1,28 @@
1
+ from __future__ import annotations
1
2
  from pydantic import NonNegativeInt
2
3
 
3
4
  from sqlalchemy import ForeignKey
4
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
5
6
 
6
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
7
8
  from cidc_api.models.types import SurvivalStatus, YNUNA, CauseOfDeath
8
9
 
9
10
 
10
11
  class ResponseORM(BaseORM):
11
12
  __tablename__ = "response"
12
13
  __repr_attrs__ = ["response_id", "participant_id"]
13
- __table_args__ = {"schema": "stage2"}
14
+ __data_category__ = "response"
14
15
 
15
16
  response_id: Mapped[int] = mapped_column(primary_key=True)
16
17
  participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
17
18
  survival_status: Mapped[SurvivalStatus]
18
- overall_survival: Mapped[NonNegativeInt | None]
19
+ overall_survival: Mapped[NonNegativeInt]
19
20
  abscopal_response: Mapped[YNUNA | None]
20
21
  pathological_complete_response: Mapped[YNUNA | None]
21
22
  days_to_death: Mapped[NonNegativeInt | None]
22
23
  cause_of_death: Mapped[CauseOfDeath | None]
23
24
  evaluable_for_toxicity: Mapped[bool]
24
25
  evaluable_for_efficacy: Mapped[bool]
25
- days_to_last_follow_up: Mapped[NonNegativeInt | None]
26
+ days_to_last_vital_status: Mapped[NonNegativeInt | None]
26
27
 
27
- participant: Mapped["ParticipantORM"] = relationship(back_populates="response", cascade="all, delete")
28
+ participant: Mapped[ParticipantORM] = relationship(back_populates="response", cascade="all, delete")
@@ -1,10 +1,11 @@
1
+ from __future__ import annotations
1
2
  from datetime import datetime
2
- from typing import Optional, List
3
+ from typing import List
3
4
 
4
5
  from sqlalchemy import ForeignKey, ForeignKeyConstraint
5
6
  from sqlalchemy.orm import Mapped, mapped_column, relationship
6
7
 
7
- from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.db.stage2.base_orm import BaseORM
8
9
  from cidc_api.models.types import AssayPriority, AssayType, Courier, ShipmentCondition, ShipmentQuality
9
10
 
10
11
 
@@ -15,7 +16,6 @@ class ShipmentORM(BaseORM):
15
16
  ForeignKeyConstraint(
16
17
  ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
17
18
  ),
18
- {"schema": "stage2"},
19
19
  )
20
20
 
21
21
  shipment_id: Mapped[int] = mapped_column(primary_key=True)
@@ -24,24 +24,24 @@ class ShipmentORM(BaseORM):
24
24
  version: Mapped[str]
25
25
 
26
26
  manifest_id: Mapped[str]
27
- assay_priority: Mapped[Optional[AssayPriority]]
28
- assay_type: Mapped[Optional[AssayType]]
29
- courier: Mapped[Optional[Courier]]
30
- tracking_number: Mapped[Optional[str]]
31
- condition: Mapped[Optional[ShipmentCondition]]
32
- condition_other: Mapped[Optional[str]]
33
- date_shipped: Mapped[Optional[datetime]]
34
- date_received: Mapped[Optional[datetime]]
35
- quality: Mapped[Optional[ShipmentQuality]]
27
+ assay_priority: Mapped[AssayPriority | None]
28
+ assay_type: Mapped[AssayType | None]
29
+ courier: Mapped[Courier | None]
30
+ tracking_number: Mapped[str | None]
31
+ condition: Mapped[ShipmentCondition | None]
32
+ condition_other: Mapped[str | None]
33
+ date_shipped: Mapped[datetime | None]
34
+ date_received: Mapped[datetime | None]
35
+ quality: Mapped[ShipmentQuality | None]
36
36
 
37
- trial: Mapped["TrialORM"] = relationship(back_populates="shipments", cascade="all, delete")
38
- institution: Mapped["InstitutionORM"] = relationship(back_populates="shipments", cascade="all, delete")
39
- shipped_from: Mapped["ContactORM"] = relationship(
37
+ trial: Mapped[TrialORM] = relationship(back_populates="shipments", cascade="all, delete")
38
+ institution: Mapped[InstitutionORM] = relationship(back_populates="shipments", cascade="all, delete")
39
+ shipped_from: Mapped[ContactORM] = relationship(
40
40
  back_populates="shipment_from", cascade="all, delete", foreign_keys="[ContactORM.shipment_from_id]"
41
41
  )
42
- shipped_to: Mapped["ContactORM"] = relationship(
42
+ shipped_to: Mapped[ContactORM] = relationship(
43
43
  back_populates="shipment_to", cascade="all, delete", foreign_keys="[ContactORM.shipment_to_id]"
44
44
  )
45
- shipment_specimens: Mapped[List["ShipmentSpecimenORM"]] = relationship(
45
+ shipment_specimens: Mapped[List[ShipmentSpecimenORM]] = relationship(
46
46
  back_populates="shipment", cascade="all, delete", passive_deletes=True
47
47
  )
@@ -1,15 +1,15 @@
1
+ from __future__ import annotations
1
2
  from datetime import datetime
2
3
 
3
4
  from sqlalchemy import ForeignKey
4
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
5
6
 
6
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
7
8
 
8
9
 
9
10
  class ShipmentSpecimenORM(BaseORM):
10
11
  __tablename__ = "shipment_specimen"
11
12
  __repr_attrs__ = ["specimen_id", "shipment_id"]
12
- __table_args__ = {"schema": "stage2"}
13
13
 
14
14
  specimen_id: Mapped[int] = mapped_column(
15
15
  ForeignKey("stage2.specimen.specimen_id", ondelete="CASCADE"), primary_key=True
@@ -20,5 +20,5 @@ class ShipmentSpecimenORM(BaseORM):
20
20
  box_number: Mapped[str]
21
21
  sample_location: Mapped[str]
22
22
 
23
- specimen: Mapped["SpecimenORM"] = relationship(back_populates="shipment_specimen", cascade="all, delete")
24
- shipment: Mapped["ShipmentORM"] = relationship(back_populates="shipment_specimens", cascade="all, delete")
23
+ specimen: Mapped[SpecimenORM] = relationship(back_populates="shipment_specimen", cascade="all, delete")
24
+ shipment: Mapped[ShipmentORM] = relationship(back_populates="shipment_specimens", cascade="all, delete")
@@ -1,10 +1,11 @@
1
+ from __future__ import annotations
1
2
  from datetime import datetime
2
3
  from typing import List
3
4
 
4
5
  from sqlalchemy import ForeignKey
5
6
  from sqlalchemy.orm import Mapped, mapped_column, relationship
6
7
 
7
- from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.db.stage2.base_orm import BaseORM
8
9
  from cidc_api.models.types import (
9
10
  UberonAnatomicalTerm,
10
11
  ICDO3MorphologicalCode,
@@ -32,7 +33,6 @@ from cidc_api.models.types import (
32
33
  class SpecimenORM(BaseORM):
33
34
  __tablename__ = "specimen"
34
35
  __repr_attrs__ = ["specimen_id", "participant_id", "cimac_id"]
35
- __table_args__ = {"schema": "stage2"}
36
36
 
37
37
  specimen_id: Mapped[int] = mapped_column(primary_key=True)
38
38
  participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
@@ -45,7 +45,7 @@ class SpecimenORM(BaseORM):
45
45
  organ_site_of_collection: Mapped[UberonAnatomicalTerm | None]
46
46
  histology_behavior: Mapped[ICDO3MorphologicalCode | None]
47
47
  histology_behavior_description: Mapped[str | None]
48
- collection_event_name: Mapped[str | None]
48
+ collection_event_name: Mapped[str]
49
49
  specimen_type: Mapped[SpecimenType | None]
50
50
  specimen_type_other: Mapped[str | None]
51
51
  specimen_description: Mapped[SpecimenDescription | None]
@@ -92,9 +92,10 @@ class SpecimenORM(BaseORM):
92
92
  diagnosis_verification: Mapped[DiagnosisVerification | None]
93
93
  intended_assay: Mapped[AssayType | None]
94
94
  date_ingested: Mapped[datetime | None]
95
- days_to_specimen_collection: Mapped[int | None]
95
+ days_to_specimen_collection: Mapped[int]
96
+ organ_site_of_collection: Mapped[UberonAnatomicalTerm]
96
97
 
97
- participant: Mapped["ParticipantORM"] = relationship(back_populates="specimens", cascade="all, delete")
98
- shipment_specimen: Mapped["ShipmentSpecimenORM"] = relationship(
98
+ participant: Mapped[ParticipantORM] = relationship(back_populates="specimens", cascade="all, delete")
99
+ shipment_specimen: Mapped[ShipmentSpecimenORM] = relationship(
99
100
  back_populates="specimen", cascade="all, delete", passive_deletes=True
100
101
  )
@@ -1,25 +1,25 @@
1
+ from __future__ import annotations
1
2
  from pydantic import NonNegativeInt
2
- from typing import Optional
3
3
 
4
4
  from sqlalchemy import ForeignKey
5
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
6
6
 
7
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
8
8
  from cidc_api.models.types import StemCellDonorType, AllogeneicDonorType, StemCellSource, ConditioningRegimenType
9
9
 
10
10
 
11
11
  class StemCellTransplantORM(BaseORM):
12
12
  __tablename__ = "stem_cell_transplant"
13
13
  __repr_attrs__ = ["stem_cell_transplant_id"]
14
- __table_args__ = {"schema": "stage2"}
14
+ __data_category__ = "stem_cell_transplant"
15
15
 
16
16
  stem_cell_transplant_id: Mapped[int] = mapped_column(primary_key=True)
17
17
  treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
18
18
 
19
19
  stem_cell_donor_type: Mapped[StemCellDonorType]
20
- allogeneic_donor_type: Mapped[AllogeneicDonorType]
21
- stem_cells_source: Mapped[StemCellSource]
20
+ allogeneic_donor_type: Mapped[AllogeneicDonorType | None]
21
+ stem_cell_source: Mapped[StemCellSource]
22
22
  days_to_transplant: Mapped[NonNegativeInt]
23
- conditioning_regimen_type: Mapped[Optional[ConditioningRegimenType]]
23
+ conditioning_regimen_type: Mapped[ConditioningRegimenType | None]
24
24
 
25
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="stem_cell_transplants", cascade="all, delete")
25
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="stem_cell_transplants", cascade="all, delete")
@@ -1,27 +1,27 @@
1
+ from __future__ import annotations
1
2
  from pydantic import NonNegativeInt
2
- from typing import Optional
3
3
 
4
4
  from sqlalchemy import ForeignKey
5
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
6
6
 
7
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
8
8
  from cidc_api.models.types import SurgicalProcedure, UberonAnatomicalTerm, YNU
9
9
 
10
10
 
11
11
  class SurgeryORM(BaseORM):
12
12
  __tablename__ = "surgery"
13
13
  __repr_attrs__ = ["surgery_id", "procedure"]
14
- __table_args__ = {"schema": "stage2"}
14
+ __data_category__ = "surgery"
15
15
 
16
16
  surgery_id: Mapped[int] = mapped_column(primary_key=True)
17
17
  treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
18
18
 
19
19
  procedure: Mapped[SurgicalProcedure]
20
- procedure_other: Mapped[Optional[str]]
20
+ procedure_other: Mapped[str | None]
21
21
  days_to_procedure: Mapped[NonNegativeInt]
22
22
  anatomical_location: Mapped[UberonAnatomicalTerm]
23
23
  therapeutic: Mapped[YNU]
24
- findings: Mapped[Optional[str]]
25
- extent_of_residual_disease: Mapped[Optional[str]]
24
+ findings: Mapped[str | None]
25
+ extent_of_residual_disease: Mapped[str | None]
26
26
 
27
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="surgeries", cascade="all, delete")
27
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="surgeries", cascade="all, delete")
@@ -1,31 +1,31 @@
1
+ from __future__ import annotations
1
2
  from pydantic import NonNegativeInt, NonNegativeFloat, PositiveFloat
2
- from typing import Optional
3
3
 
4
4
  from sqlalchemy import ForeignKey
5
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
6
6
 
7
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
8
8
  from cidc_api.models.types import TherapyAgentDoseUnits, YNU
9
9
 
10
10
 
11
11
  class TherapyAgentDoseORM(BaseORM):
12
12
  __tablename__ = "therapy_agent_dose"
13
13
  __repr_attrs__ = ["therapy_agent_dose_id", "therapy_agent_name"]
14
- __table_args__ = {"schema": "stage2"}
14
+ __data_category__ = "therapy_agent_dose"
15
15
 
16
16
  therapy_agent_dose_id: Mapped[int] = mapped_column(primary_key=True)
17
17
  treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
18
18
 
19
- course_number: Mapped[Optional[str]]
19
+ course_number: Mapped[str | None]
20
20
  therapy_agent_name: Mapped[str]
21
21
  days_to_start: Mapped[NonNegativeInt]
22
22
  days_to_end: Mapped[NonNegativeInt]
23
23
  number_of_doses: Mapped[NonNegativeInt]
24
24
  received_dose: Mapped[NonNegativeFloat]
25
25
  received_dose_units: Mapped[TherapyAgentDoseUnits]
26
- planned_dose: Mapped[Optional[PositiveFloat]]
27
- planned_dose_units: Mapped[Optional[TherapyAgentDoseUnits]]
26
+ planned_dose: Mapped[PositiveFloat | None]
27
+ planned_dose_units: Mapped[TherapyAgentDoseUnits | None]
28
28
  dose_changes_delays: Mapped[YNU]
29
- changes_delays_description: Mapped[Optional[str]]
29
+ changes_delays_description: Mapped[str | None]
30
30
 
31
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="therapy_agent_doses", cascade="all, delete")
31
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="therapy_agent_doses", cascade="all, delete")
@@ -1,39 +1,40 @@
1
- from typing import List, Optional
1
+ from __future__ import annotations
2
+ from typing import List
2
3
 
3
4
  from sqlalchemy import ForeignKey
4
5
  from sqlalchemy.orm import Mapped, mapped_column, relationship
5
6
 
6
- from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.db.stage2.base_orm import BaseORM
7
8
  from cidc_api.models.types import YNU, OffTreatmentReason
8
9
 
9
10
 
10
11
  class TreatmentORM(BaseORM):
11
12
  __tablename__ = "treatment"
12
13
  __repr_attrs__ = ["treatment_id", "participant_id", "treatment_description"]
13
- __table_args__ = {"schema": "stage2"}
14
+ __data_category__ = "treatment"
14
15
 
15
16
  treatment_id: Mapped[int] = mapped_column(primary_key=True)
16
17
  participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
17
- arm_id: Mapped[Optional[int]] = mapped_column(ForeignKey("stage2.arm.arm_id", ondelete="CASCADE"))
18
- cohort_id: Mapped[Optional[int]] = mapped_column(ForeignKey("stage2.cohort.cohort_id", ondelete="CASCADE"))
18
+ arm_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.arm.arm_id", ondelete="CASCADE"))
19
+ cohort_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.cohort.cohort_id", ondelete="CASCADE"))
19
20
 
20
21
  treatment_description: Mapped[str]
21
22
  off_treatment: Mapped[YNU]
22
- off_treatment_reason: Mapped[Optional[OffTreatmentReason]]
23
- off_treatment_reason_other: Mapped[Optional[str]]
23
+ off_treatment_reason: Mapped[OffTreatmentReason | None]
24
+ off_treatment_reason_other: Mapped[str | None]
24
25
 
25
- participant: Mapped["ParticipantORM"] = relationship(back_populates="treatments", cascade="all, delete")
26
- arm: Mapped[Optional["ArmORM"]] = relationship(cascade="all, delete")
27
- cohort: Mapped[Optional["CohortORM"]] = relationship(cascade="all, delete")
28
- adverse_events: Mapped[List["AdverseEventORM"]] = relationship(back_populates="treatment", cascade="all, delete")
26
+ participant: Mapped[ParticipantORM] = relationship(back_populates="treatments", cascade="all, delete")
27
+ arm: Mapped[ArmORM | None] = relationship(cascade="all, delete")
28
+ cohort: Mapped[CohortORM | None] = relationship(cascade="all, delete")
29
+ adverse_events: Mapped[List[AdverseEventORM]] = relationship(back_populates="treatment", cascade="all, delete")
29
30
 
30
- therapy_agent_doses: Mapped[List["TherapyAgentDoseORM"]] = relationship(
31
+ therapy_agent_doses: Mapped[List[TherapyAgentDoseORM]] = relationship(
31
32
  back_populates="treatment", cascade="all, delete"
32
33
  )
33
- radiotherapy_doses: Mapped[List["RadiotherapyDoseORM"]] = relationship(
34
+ radiotherapy_doses: Mapped[List[RadiotherapyDoseORM]] = relationship(
34
35
  back_populates="treatment", cascade="all, delete"
35
36
  )
36
- surgeries: Mapped[List["SurgeryORM"]] = relationship(back_populates="treatment", cascade="all, delete")
37
- stem_cell_transplants: Mapped[List["StemCellTransplantORM"]] = relationship(
37
+ surgeries: Mapped[List[SurgeryORM]] = relationship(back_populates="treatment", cascade="all, delete")
38
+ stem_cell_transplants: Mapped[List[StemCellTransplantORM]] = relationship(
38
39
  back_populates="treatment", cascade="all, delete"
39
40
  )