nci-cidc-api-modules 1.2.39__py3-none-any.whl → 1.2.40__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 (141) hide show
  1. cidc_api/__init__.py +1 -1
  2. cidc_api/config/db.py +21 -1
  3. cidc_api/models/__init__.py +0 -2
  4. cidc_api/models/db/stage1/__init__.py +56 -0
  5. cidc_api/models/db/stage1/additional_treatment_orm.py +23 -0
  6. cidc_api/models/db/stage1/adverse_event_orm.py +47 -0
  7. cidc_api/models/db/stage1/base_orm.py +7 -0
  8. cidc_api/models/db/stage1/baseline_clinical_assessment_orm.py +23 -0
  9. cidc_api/models/db/stage1/comorbidity_orm.py +24 -0
  10. cidc_api/models/db/stage1/consent_group_orm.py +33 -0
  11. cidc_api/models/db/stage1/demographic_orm.py +48 -0
  12. cidc_api/models/db/stage1/disease_orm.py +53 -0
  13. cidc_api/models/db/stage1/exposure_orm.py +23 -0
  14. cidc_api/models/db/stage1/gvhd_diagnosis_acute_orm.py +35 -0
  15. cidc_api/models/db/stage1/gvhd_diagnosis_chronic_orm.py +37 -0
  16. cidc_api/models/db/stage1/gvhd_organ_acute_orm.py +22 -0
  17. cidc_api/models/db/stage1/gvhd_organ_chronic_orm.py +22 -0
  18. cidc_api/models/db/stage1/medical_history_orm.py +31 -0
  19. cidc_api/models/db/stage1/other_malignancy_orm.py +30 -0
  20. cidc_api/models/db/stage1/participant_orm.py +78 -0
  21. cidc_api/models/db/stage1/prior_treatment_orm.py +31 -0
  22. cidc_api/models/db/stage1/radiotherapy_dose_orm.py +40 -0
  23. cidc_api/models/db/stage1/response_by_system_orm.py +31 -0
  24. cidc_api/models/db/stage1/response_orm.py +29 -0
  25. cidc_api/models/db/stage1/specimen_orm.py +46 -0
  26. cidc_api/models/db/stage1/stem_cell_transplant_orm.py +26 -0
  27. cidc_api/models/db/stage1/surgery_orm.py +28 -0
  28. cidc_api/models/db/stage1/therapy_agent_dose_orm.py +32 -0
  29. cidc_api/models/db/stage1/treatment_orm.py +39 -0
  30. cidc_api/models/db/stage1/trial_orm.py +36 -0
  31. cidc_api/models/db/stage2/additional_treatment_orm.py +5 -5
  32. cidc_api/models/db/stage2/administrative_person_orm.py +4 -3
  33. cidc_api/models/db/stage2/administrative_role_assignment_orm.py +4 -3
  34. cidc_api/models/db/stage2/adverse_event_orm.py +11 -12
  35. cidc_api/models/db/stage2/arm_orm.py +3 -2
  36. cidc_api/models/db/stage2/base_orm.py +7 -0
  37. cidc_api/models/db/stage2/baseline_clinical_assessment_orm.py +5 -6
  38. cidc_api/models/db/stage2/cohort_orm.py +3 -2
  39. cidc_api/models/db/stage2/comorbidity_orm.py +6 -7
  40. cidc_api/models/db/stage2/consent_group_orm.py +4 -3
  41. cidc_api/models/db/stage2/contact_orm.py +16 -19
  42. cidc_api/models/db/stage2/demographic_orm.py +3 -2
  43. cidc_api/models/db/stage2/disease_orm.py +4 -3
  44. cidc_api/models/db/stage2/exposure_orm.py +3 -2
  45. cidc_api/models/db/stage2/file_orm.py +6 -8
  46. cidc_api/models/db/stage2/gvhd_diagnosis_acute_orm.py +4 -3
  47. cidc_api/models/db/stage2/gvhd_diagnosis_chronic_orm.py +4 -5
  48. cidc_api/models/db/stage2/gvhd_organ_acute_orm.py +3 -2
  49. cidc_api/models/db/stage2/gvhd_organ_chronic_orm.py +3 -2
  50. cidc_api/models/db/stage2/institution_orm.py +7 -6
  51. cidc_api/models/db/stage2/medical_history_orm.py +9 -8
  52. cidc_api/models/db/stage2/other_clinical_endpoint_orm.py +8 -11
  53. cidc_api/models/db/stage2/other_malignancy_orm.py +8 -9
  54. cidc_api/models/db/stage2/participant_orm.py +23 -23
  55. cidc_api/models/db/stage2/prior_treatment_orm.py +11 -10
  56. cidc_api/models/db/stage2/publication_orm.py +8 -9
  57. cidc_api/models/db/stage2/radiotherapy_dose_orm.py +8 -8
  58. cidc_api/models/db/stage2/response_by_system_orm.py +3 -2
  59. cidc_api/models/db/stage2/response_orm.py +3 -2
  60. cidc_api/models/db/stage2/shipment_orm.py +17 -16
  61. cidc_api/models/db/stage2/shipment_specimen_orm.py +4 -3
  62. cidc_api/models/db/stage2/specimen_orm.py +7 -5
  63. cidc_api/models/db/stage2/stem_cell_transplant_orm.py +5 -5
  64. cidc_api/models/db/stage2/surgery_orm.py +6 -6
  65. cidc_api/models/db/stage2/therapy_agent_dose_orm.py +7 -7
  66. cidc_api/models/db/stage2/treatment_orm.py +15 -14
  67. cidc_api/models/db/stage2/trial_orm.py +15 -16
  68. cidc_api/models/models.py +1 -0
  69. cidc_api/models/pydantic/{stage2/base.py → base.py} +1 -1
  70. cidc_api/models/pydantic/stage1/__init__.py +56 -0
  71. cidc_api/models/pydantic/stage1/additional_treatment.py +23 -0
  72. cidc_api/models/pydantic/stage1/adverse_event.py +100 -0
  73. cidc_api/models/pydantic/stage1/baseline_clinical_assessment.py +23 -0
  74. cidc_api/models/pydantic/stage1/comorbidity.py +36 -0
  75. cidc_api/models/pydantic/stage1/consent_group.py +30 -0
  76. cidc_api/models/pydantic/stage1/demographic.py +123 -0
  77. cidc_api/models/pydantic/stage1/disease.py +158 -0
  78. cidc_api/models/pydantic/stage1/exposure.py +32 -0
  79. cidc_api/models/pydantic/stage1/gvhd_diagnosis_acute.py +33 -0
  80. cidc_api/models/pydantic/stage1/gvhd_diagnosis_chronic.py +32 -0
  81. cidc_api/models/pydantic/stage1/gvhd_organ_acute.py +22 -0
  82. cidc_api/models/pydantic/stage1/gvhd_organ_chronic.py +23 -0
  83. cidc_api/models/pydantic/stage1/medical_history.py +36 -0
  84. cidc_api/models/pydantic/stage1/other_malignancy.py +49 -0
  85. cidc_api/models/pydantic/stage1/participant.py +51 -0
  86. cidc_api/models/pydantic/stage1/prior_treatment.py +52 -0
  87. cidc_api/models/pydantic/stage1/radiotherapy_dose.py +79 -0
  88. cidc_api/models/pydantic/stage1/response.py +65 -0
  89. cidc_api/models/pydantic/stage1/response_by_system.py +112 -0
  90. cidc_api/models/pydantic/stage1/specimen.py +52 -0
  91. cidc_api/models/pydantic/stage1/stem_cell_transplant.py +35 -0
  92. cidc_api/models/pydantic/stage1/surgery.py +49 -0
  93. cidc_api/models/pydantic/stage1/therapy_agent_dose.py +67 -0
  94. cidc_api/models/pydantic/stage1/treatment.py +50 -0
  95. cidc_api/models/pydantic/stage1/trial.py +45 -0
  96. cidc_api/models/pydantic/stage2/additional_treatment.py +2 -4
  97. cidc_api/models/pydantic/stage2/administrative_person.py +1 -1
  98. cidc_api/models/pydantic/stage2/administrative_role_assignment.py +2 -2
  99. cidc_api/models/pydantic/stage2/adverse_event.py +1 -1
  100. cidc_api/models/pydantic/stage2/arm.py +2 -2
  101. cidc_api/models/pydantic/stage2/baseline_clinical_assessment.py +1 -1
  102. cidc_api/models/pydantic/stage2/cohort.py +1 -1
  103. cidc_api/models/pydantic/stage2/comorbidity.py +1 -1
  104. cidc_api/models/pydantic/stage2/consent_group.py +2 -2
  105. cidc_api/models/pydantic/stage2/contact.py +1 -1
  106. cidc_api/models/pydantic/stage2/demographic.py +1 -1
  107. cidc_api/models/pydantic/stage2/disease.py +1 -1
  108. cidc_api/models/pydantic/stage2/exposure.py +1 -1
  109. cidc_api/models/pydantic/stage2/file.py +2 -2
  110. cidc_api/models/pydantic/stage2/gvhd_diagnosis_acute.py +1 -1
  111. cidc_api/models/pydantic/stage2/gvhd_diagnosis_chronic.py +1 -1
  112. cidc_api/models/pydantic/stage2/gvhd_organ_acute.py +1 -1
  113. cidc_api/models/pydantic/stage2/gvhd_organ_chronic.py +1 -1
  114. cidc_api/models/pydantic/stage2/institution.py +1 -1
  115. cidc_api/models/pydantic/stage2/medical_history.py +1 -1
  116. cidc_api/models/pydantic/stage2/other_clinical_endpoint.py +1 -1
  117. cidc_api/models/pydantic/stage2/other_malignancy.py +1 -1
  118. cidc_api/models/pydantic/stage2/participant.py +6 -3
  119. cidc_api/models/pydantic/stage2/prior_treatment.py +4 -4
  120. cidc_api/models/pydantic/stage2/publication.py +2 -2
  121. cidc_api/models/pydantic/stage2/radiotherapy_dose.py +1 -1
  122. cidc_api/models/pydantic/stage2/response.py +2 -2
  123. cidc_api/models/pydantic/stage2/response_by_system.py +1 -1
  124. cidc_api/models/pydantic/stage2/shipment.py +2 -2
  125. cidc_api/models/pydantic/stage2/shipment_specimen.py +1 -1
  126. cidc_api/models/pydantic/stage2/specimen.py +6 -3
  127. cidc_api/models/pydantic/stage2/stem_cell_transplant.py +2 -2
  128. cidc_api/models/pydantic/stage2/surgery.py +1 -1
  129. cidc_api/models/pydantic/stage2/therapy_agent_dose.py +1 -1
  130. cidc_api/models/pydantic/stage2/treatment.py +1 -1
  131. cidc_api/models/pydantic/stage2/trial.py +8 -10
  132. cidc_api/models/types.py +29 -1
  133. cidc_api/shared/gcloud_client.py +2 -2
  134. cidc_api/shared/utils.py +1 -0
  135. {nci_cidc_api_modules-1.2.39.dist-info → nci_cidc_api_modules-1.2.40.dist-info}/METADATA +1 -1
  136. nci_cidc_api_modules-1.2.40.dist-info/RECORD +165 -0
  137. cidc_api/models/db/base_orm.py +0 -25
  138. nci_cidc_api_modules-1.2.39.dist-info/RECORD +0 -112
  139. {nci_cidc_api_modules-1.2.39.dist-info → nci_cidc_api_modules-1.2.40.dist-info}/WHEEL +0 -0
  140. {nci_cidc_api_modules-1.2.39.dist-info → nci_cidc_api_modules-1.2.40.dist-info}/licenses/LICENSE +0 -0
  141. {nci_cidc_api_modules-1.2.39.dist-info → nci_cidc_api_modules-1.2.40.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,10 @@
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):
@@ -20,5 +21,5 @@ class ShipmentSpecimenORM(BaseORM):
20
21
  box_number: Mapped[str]
21
22
  sample_location: Mapped[str]
22
23
 
23
- specimen: Mapped["SpecimenORM"] = relationship(back_populates="shipment_specimen", cascade="all, delete")
24
- shipment: Mapped["ShipmentORM"] = relationship(back_populates="shipment_specimens", cascade="all, delete")
24
+ specimen: Mapped[SpecimenORM] = relationship(back_populates="shipment_specimen", cascade="all, delete")
25
+ 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,
@@ -45,7 +46,7 @@ class SpecimenORM(BaseORM):
45
46
  organ_site_of_collection: Mapped[UberonAnatomicalTerm | None]
46
47
  histology_behavior: Mapped[ICDO3MorphologicalCode | None]
47
48
  histology_behavior_description: Mapped[str | None]
48
- collection_event_name: Mapped[str | None]
49
+ collection_event_name: Mapped[str]
49
50
  specimen_type: Mapped[SpecimenType | None]
50
51
  specimen_type_other: Mapped[str | None]
51
52
  specimen_description: Mapped[SpecimenDescription | None]
@@ -92,9 +93,10 @@ class SpecimenORM(BaseORM):
92
93
  diagnosis_verification: Mapped[DiagnosisVerification | None]
93
94
  intended_assay: Mapped[AssayType | None]
94
95
  date_ingested: Mapped[datetime | None]
95
- days_to_specimen_collection: Mapped[int | None]
96
+ days_to_specimen_collection: Mapped[int]
97
+ organ_site_of_collection: Mapped[UberonAnatomicalTerm]
96
98
 
97
- participant: Mapped["ParticipantORM"] = relationship(back_populates="specimens", cascade="all, delete")
98
- shipment_specimen: Mapped["ShipmentSpecimenORM"] = relationship(
99
+ participant: Mapped[ParticipantORM] = relationship(back_populates="specimens", cascade="all, delete")
100
+ shipment_specimen: Mapped[ShipmentSpecimenORM] = relationship(
99
101
  back_populates="specimen", cascade="all, delete", passive_deletes=True
100
102
  )
@@ -1,10 +1,10 @@
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
 
@@ -19,8 +19,8 @@ class StemCellTransplantORM(BaseORM):
19
19
 
20
20
  stem_cell_donor_type: Mapped[StemCellDonorType]
21
21
  allogeneic_donor_type: Mapped[AllogeneicDonorType]
22
- stem_cells_source: Mapped[StemCellSource]
22
+ stem_cell_source: Mapped[StemCellSource]
23
23
  days_to_transplant: Mapped[NonNegativeInt]
24
- conditioning_regimen_type: Mapped[Optional[ConditioningRegimenType]]
24
+ conditioning_regimen_type: Mapped[ConditioningRegimenType | None]
25
25
 
26
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="stem_cell_transplants", cascade="all, delete")
26
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="stem_cell_transplants", cascade="all, delete")
@@ -1,10 +1,10 @@
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
 
@@ -18,11 +18,11 @@ class SurgeryORM(BaseORM):
18
18
  treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
19
19
 
20
20
  procedure: Mapped[SurgicalProcedure]
21
- procedure_other: Mapped[Optional[str]]
21
+ procedure_other: Mapped[str | None]
22
22
  days_to_procedure: Mapped[NonNegativeInt]
23
23
  anatomical_location: Mapped[UberonAnatomicalTerm]
24
24
  therapeutic: Mapped[YNU]
25
- findings: Mapped[Optional[str]]
26
- extent_of_residual_disease: Mapped[Optional[str]]
25
+ findings: Mapped[str | None]
26
+ extent_of_residual_disease: Mapped[str | None]
27
27
 
28
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="surgeries", cascade="all, delete")
28
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="surgeries", 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 TherapyAgentDoseUnits, YNU
9
9
 
10
10
 
@@ -17,16 +17,16 @@ class TherapyAgentDoseORM(BaseORM):
17
17
  therapy_agent_dose_id: Mapped[int] = mapped_column(primary_key=True)
18
18
  treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
19
19
 
20
- course_number: Mapped[Optional[str]]
20
+ course_number: Mapped[str | None]
21
21
  therapy_agent_name: Mapped[str]
22
22
  days_to_start: Mapped[NonNegativeInt]
23
23
  days_to_end: Mapped[NonNegativeInt]
24
24
  number_of_doses: Mapped[NonNegativeInt]
25
25
  received_dose: Mapped[NonNegativeFloat]
26
26
  received_dose_units: Mapped[TherapyAgentDoseUnits]
27
- planned_dose: Mapped[Optional[PositiveFloat]]
28
- planned_dose_units: Mapped[Optional[TherapyAgentDoseUnits]]
27
+ planned_dose: Mapped[PositiveFloat | None]
28
+ planned_dose_units: Mapped[TherapyAgentDoseUnits | None]
29
29
  dose_changes_delays: Mapped[YNU]
30
- changes_delays_description: Mapped[Optional[str]]
30
+ changes_delays_description: Mapped[str | None]
31
31
 
32
- treatment: Mapped["TreatmentORM"] = relationship(back_populates="therapy_agent_doses", cascade="all, delete")
32
+ treatment: Mapped[TreatmentORM] = relationship(back_populates="therapy_agent_doses", cascade="all, delete")
@@ -1,9 +1,10 @@
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
 
@@ -15,26 +16,26 @@ class TreatmentORM(BaseORM):
15
16
 
16
17
  treatment_id: Mapped[int] = mapped_column(primary_key=True)
17
18
  participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
18
- arm_id: Mapped[Optional[int]] = mapped_column(ForeignKey("stage2.arm.arm_id", ondelete="CASCADE"))
19
- cohort_id: Mapped[Optional[int]] = mapped_column(ForeignKey("stage2.cohort.cohort_id", ondelete="CASCADE"))
19
+ arm_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.arm.arm_id", ondelete="CASCADE"))
20
+ cohort_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.cohort.cohort_id", ondelete="CASCADE"))
20
21
 
21
22
  treatment_description: Mapped[str]
22
23
  off_treatment: Mapped[YNU]
23
- off_treatment_reason: Mapped[Optional[OffTreatmentReason]]
24
- off_treatment_reason_other: Mapped[Optional[str]]
24
+ off_treatment_reason: Mapped[OffTreatmentReason | None]
25
+ off_treatment_reason_other: Mapped[str | None]
25
26
 
26
- participant: Mapped["ParticipantORM"] = relationship(back_populates="treatments", cascade="all, delete")
27
- arm: Mapped[Optional["ArmORM"]] = relationship(cascade="all, delete")
28
- cohort: Mapped[Optional["CohortORM"]] = relationship(cascade="all, delete")
29
- adverse_events: Mapped[List["AdverseEventORM"]] = relationship(back_populates="treatment", cascade="all, delete")
27
+ participant: Mapped[ParticipantORM] = relationship(back_populates="treatments", cascade="all, delete")
28
+ arm: Mapped[ArmORM | None] = relationship(cascade="all, delete")
29
+ cohort: Mapped[CohortORM | None] = relationship(cascade="all, delete")
30
+ adverse_events: Mapped[List[AdverseEventORM]] = relationship(back_populates="treatment", cascade="all, delete")
30
31
 
31
- therapy_agent_doses: Mapped[List["TherapyAgentDoseORM"]] = relationship(
32
+ therapy_agent_doses: Mapped[List[TherapyAgentDoseORM]] = relationship(
32
33
  back_populates="treatment", cascade="all, delete"
33
34
  )
34
- radiotherapy_doses: Mapped[List["RadiotherapyDoseORM"]] = relationship(
35
+ radiotherapy_doses: Mapped[List[RadiotherapyDoseORM]] = relationship(
35
36
  back_populates="treatment", cascade="all, delete"
36
37
  )
37
- surgeries: Mapped[List["SurgeryORM"]] = relationship(back_populates="treatment", cascade="all, delete")
38
- stem_cell_transplants: Mapped[List["StemCellTransplantORM"]] = relationship(
38
+ surgeries: Mapped[List[SurgeryORM]] = relationship(back_populates="treatment", cascade="all, delete")
39
+ stem_cell_transplants: Mapped[List[StemCellTransplantORM]] = relationship(
39
40
  back_populates="treatment", cascade="all, delete"
40
41
  )
@@ -1,12 +1,13 @@
1
+ from __future__ import annotations
1
2
  from datetime import datetime
2
- from typing import List, Optional
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
  from sqlalchemy.types import JSON
7
8
 
8
- from cidc_api.models.db.base_orm import BaseORM
9
- from cidc_api.models.types import AssayType, TrialOrganization, TrialFundingAgency, AgeGroup
9
+ from cidc_api.models.db.stage2.base_orm import BaseORM
10
+ from cidc_api.models.types import AssayType, TrialOrganization, TrialFundingAgency, AgeGroup, PrimaryPurposeType
10
11
 
11
12
 
12
13
  class TrialORM(BaseORM):
@@ -36,28 +37,26 @@ class TrialORM(BaseORM):
36
37
  biomarker_plan: Mapped[str | None]
37
38
  data_sharing_plan: Mapped[str | None]
38
39
  expected_assays: Mapped[List[AssayType]] = mapped_column(JSON, nullable=True)
39
- is_liquid_tumor_trial: Mapped[bool]
40
+ primary_purpose_type: Mapped[PrimaryPurposeType]
40
41
  dbgap_study_accession: Mapped[str | None]
41
42
 
42
- biobank: Mapped["InstitutionORM"] = relationship(back_populates="trial")
43
- schema: Mapped[Optional["FileORM"]] = relationship(back_populates="trial", viewonly=True)
44
- administrative_role_assignments: Mapped[List["AdministrativeRoleAssignmentORM"]] = relationship(
43
+ biobank: Mapped[InstitutionORM] = relationship(back_populates="trial")
44
+ schema: Mapped[FileORM | None] = relationship(back_populates="trial", viewonly=True)
45
+ administrative_role_assignments: Mapped[List[AdministrativeRoleAssignmentORM]] = relationship(
45
46
  back_populates="trial", cascade="all, delete", passive_deletes=True
46
47
  )
47
- arms: Mapped[List["ArmORM"]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
48
- cohorts: Mapped[List["CohortORM"]] = relationship(
48
+ arms: Mapped[List[ArmORM]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
49
+ cohorts: Mapped[List[CohortORM]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
50
+ participants: Mapped[List[ParticipantORM]] = relationship(
49
51
  back_populates="trial", cascade="all, delete", passive_deletes=True
50
52
  )
51
- participants: Mapped[List["ParticipantORM"]] = relationship(
53
+ shipments: Mapped[List[ShipmentORM]] = relationship(
52
54
  back_populates="trial", cascade="all, delete", passive_deletes=True
53
55
  )
54
- shipments: Mapped[List["ShipmentORM"]] = relationship(
56
+ files: Mapped[List[FileORM]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
57
+ publications: Mapped[List[PublicationORM]] = relationship(
55
58
  back_populates="trial", cascade="all, delete", passive_deletes=True
56
59
  )
57
- files: Mapped[List["FileORM"]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
58
- publications: Mapped[List["PublicationORM"]] = relationship(
59
- back_populates="trial", cascade="all, delete", passive_deletes=True
60
- )
61
- consent_groups: Mapped[List["ConsentGroupORM"]] = relationship(
60
+ consent_groups: Mapped[List[ConsentGroupORM]] = relationship(
62
61
  back_populates="trial", cascade="all, delete", passive_deletes=True
63
62
  )
cidc_api/models/models.py CHANGED
@@ -3479,6 +3479,7 @@ class IngestionJobs(CommonColumns):
3479
3479
  submission_id = Column(String, nullable=True)
3480
3480
  intake_path = Column(String, nullable=True)
3481
3481
  uploader_email = Column(String, nullable=True)
3482
+ is_template_downloaded = Column(Boolean, nullable=True)
3482
3483
 
3483
3484
  @staticmethod
3484
3485
  @with_default_session
@@ -9,7 +9,7 @@ class Base(BaseModel):
9
9
  model_config = ConfigDict(
10
10
  validate_assignment=True,
11
11
  from_attributes=True,
12
- # extra="forbid" # TODO: enable me one stage1 models are implemented
12
+ extra="forbid",
13
13
  )
14
14
 
15
15
  # Validates the new state and updates the object if valid
@@ -0,0 +1,56 @@
1
+ from .additional_treatment import AdditionalTreatment
2
+ from .adverse_event import AdverseEvent
3
+ from .baseline_clinical_assessment import BaselineClinicalAssessment
4
+ from .comorbidity import Comorbidity
5
+ from .consent_group import ConsentGroup
6
+ from .demographic import Demographic
7
+ from .disease import Disease
8
+ from .exposure import Exposure
9
+ from .gvhd_diagnosis_acute import GVHDDiagnosisAcute
10
+ from .gvhd_diagnosis_chronic import GVHDDiagnosisChronic
11
+ from .gvhd_organ_acute import GVHDOrganAcute
12
+ from .gvhd_organ_chronic import GVHDOrganChronic
13
+ from .medical_history import MedicalHistory
14
+ from .other_malignancy import OtherMalignancy
15
+ from .participant import Participant
16
+ from .prior_treatment import PriorTreatment
17
+ from .radiotherapy_dose import RadiotherapyDose
18
+ from .response import Response
19
+ from .response_by_system import ResponseBySystem
20
+ from .specimen import Specimen
21
+ from .stem_cell_transplant import StemCellTransplant
22
+ from .surgery import Surgery
23
+ from .therapy_agent_dose import TherapyAgentDose
24
+ from .treatment import Treatment
25
+ from .trial import Trial
26
+
27
+
28
+ __all__ = [
29
+ "AdditionalTreatment",
30
+ "AdverseEvent",
31
+ "BaselineClinicalAssessment",
32
+ "Comorbidity",
33
+ "ConsentGroup",
34
+ "Demographic",
35
+ "Disease",
36
+ "Exposure",
37
+ "GVHDDiagnosisAcute",
38
+ "GVHDOrganAcute",
39
+ "GVHDDiagnosisChronic",
40
+ "GVHDOrganChronic",
41
+ "MedicalHistory",
42
+ "OtherMalignancy",
43
+ "Participant",
44
+ "PriorTreatment",
45
+ "RadiotherapyDose",
46
+ "Response",
47
+ "ResponseBySystem",
48
+ "Specimen",
49
+ "StemCellTransplant",
50
+ "Surgery",
51
+ "TherapyAgentDose",
52
+ "Treatment",
53
+ "Trial",
54
+ ]
55
+
56
+ all_models = [globals()[cls_name] for cls_name in __all__]
@@ -0,0 +1,23 @@
1
+ from pydantic import NonNegativeInt
2
+ from cidc_api.models.pydantic.base import Base
3
+
4
+
5
+ class AdditionalTreatment(Base):
6
+ __data_category__ = "additional_treatment"
7
+ __cardinality__ = "many"
8
+
9
+ # The unique internal identifier for the AdditionalTreatment record
10
+ additional_treatment_id: int | None = None
11
+
12
+ # The unique internal identifier for the associated Participant record
13
+ participant_id: str | None = None
14
+
15
+ # Number of days from the enrollment date to the first recorded administration or occurrence of the treatment modality.
16
+ additional_treatment_days_to_start: NonNegativeInt | None = None
17
+
18
+ # Number of days from the enrollment date to the last recorded administration or occurrence of the treatment modality.
19
+ additional_treatment_days_to_end: NonNegativeInt | None = None
20
+
21
+ # Description of the prior treatment such as its full generic name if it is a type of therapy agent, radiotherapy procedure
22
+ # name and location, or surgical procedure name and location.
23
+ additional_treatment_description: str
@@ -0,0 +1,100 @@
1
+ from typing import Self
2
+
3
+ from pydantic import NonNegativeInt, model_validator
4
+
5
+ from cidc_api.models.pydantic.base import Base
6
+ from cidc_api.reference.ctcae import is_ctcae_other_term
7
+ from cidc_api.models.types import (
8
+ CTCAEEventTerm,
9
+ CTCAEEventCode,
10
+ SeverityGradeSystem,
11
+ SeverityGradeSystemVersion,
12
+ SeverityGrade,
13
+ SystemOrganClass,
14
+ AttributionCause,
15
+ AttributionLikelihood,
16
+ YNU,
17
+ )
18
+
19
+
20
+ class AdverseEvent(Base):
21
+ __data_category__ = "adverse_event"
22
+ __cardinality__ = "many"
23
+
24
+ # The unique internal identifier of the adverse event
25
+ adverse_event_id: int | None = None
26
+
27
+ # The unique internal identifier of the associated participant
28
+ participant_id: str | None = None
29
+
30
+ # The unique internal identifier of the attributed treatment, if any
31
+ treatment_id: int | None = None
32
+
33
+ # Text that represents the Common Terminology Criteria for Adverse Events low level term name for an adverse event.
34
+ event_term: CTCAEEventTerm | None = None
35
+
36
+ # A MedDRA code mapped to a CTCAE low level name for an adverse event.
37
+ event_code: CTCAEEventCode | None = None
38
+
39
+ # System used to define and report adverse event severity grade.
40
+ severity_grade_system: SeverityGradeSystem
41
+
42
+ # The version of the adverse event grading system.
43
+ severity_grade_system_version: SeverityGradeSystemVersion
44
+
45
+ # Numerical grade indicating the severity of an adverse event.
46
+ severity_grade: SeverityGrade
47
+
48
+ # A brief description that sufficiently details the event.
49
+ event_other_specify: str | None = None
50
+
51
+ # The highest level of the MedDRA hierarchy, distinguished by anatomical or physiological system, etiology (disease origin) or purpose.
52
+ system_organ_class: SystemOrganClass | None = None
53
+
54
+ # Indicator to identify whether a participant exited the study prematurely due to the adverse event being described.
55
+ discontinuation_due_to_event: bool
56
+
57
+ # Days from enrollment date to date of onset of the adverse event.
58
+ days_to_onset_of_event: NonNegativeInt
59
+
60
+ # Days from enrollment date to date of resolution of the adverse event.
61
+ days_to_resolution_of_event: NonNegativeInt | None = None
62
+
63
+ # Indicates whether the adverse event was a serious adverse event (SAE).
64
+ serious_adverse_event: YNU
65
+
66
+ # Indicates whether the adverse event was a dose-limiting toxicity (DLT).
67
+ dose_limiting_toxicity: YNU
68
+
69
+ # Indicates if the adverse was attributable to the protocol as a whole or to an individual treatment.
70
+ attribution_cause: AttributionCause
71
+
72
+ # The code that indicates whether the adverse event is related to the treatment/intervention.
73
+ attribution_likelihood: AttributionLikelihood
74
+
75
+ # The individual therapy (therapy agent, radiotherapy, surgery, stem cell transplant) in the treatment that is attributed to the adverse event.
76
+ individual_therapy: str | None = None
77
+
78
+ @model_validator(mode="after")
79
+ def validate_term_and_code_cr(self) -> Self:
80
+ if not self.event_term and not self.event_code:
81
+ raise ValueError("Please provide event_term or event_code or both")
82
+ return self
83
+
84
+ @model_validator(mode="after")
85
+ def validate_event_other_specify_cr(self) -> Self:
86
+ if (
87
+ self.severity_grade_system == "CTCAE"
88
+ and is_ctcae_other_term(self.event_term)
89
+ and not self.event_other_specify
90
+ ):
91
+ raise ValueError(
92
+ 'If severity_grade_system is "CTCAE" and the event_code or event_term are of type "Other, specify", please provide event_other_specify'
93
+ )
94
+ return self
95
+
96
+ @model_validator(mode="after")
97
+ def validate_system_organ_class_cr(self) -> Self:
98
+ if self.event_other_specify and not self.system_organ_class:
99
+ raise ValueError("If event_other_specify is provided, please provide system_organ_class.")
100
+ return self
@@ -0,0 +1,23 @@
1
+ from cidc_api.models.pydantic.base import Base
2
+ from cidc_api.models.types import ECOGScore, KarnofskyScore
3
+
4
+
5
+ class BaselineClinicalAssessment(Base):
6
+ __data_category__ = "baseline_clinical_assessment"
7
+ __cardinality__ = "one"
8
+
9
+ # A unique internal identifier for the baseline clinical assessment
10
+ baseline_clinical_assessment_id: int | None = None
11
+
12
+ # The unique identifier for the associated participant
13
+ participant_id: str | None = None
14
+
15
+ # The numerical score that represents the functional capabilities of a participant at the
16
+ # enrollment date using the Eastern Cooperative Oncology Group Performance Status assessment.
17
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=88%20and%20ver_nr=5.1
18
+ ecog_score: ECOGScore | None = None
19
+
20
+ # Score from the Karnofsky Performance status scale, representing the functional capabilities of a participant
21
+ # at the enrollment date.
22
+ # CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2003853%20and%20ver_nr=4.2
23
+ karnofsky_score: KarnofskyScore | None = None
@@ -0,0 +1,36 @@
1
+ from typing import Self
2
+
3
+ from pydantic import model_validator
4
+
5
+ from cidc_api.models.pydantic.base import Base
6
+ from cidc_api.models.types import ICD10CMCode, ICD10CMTerm
7
+
8
+
9
+ class Comorbidity(Base):
10
+ __data_category__ = "comorbidity"
11
+ __cardinality__ = "many"
12
+
13
+ # The unique internal identifier for the comorbidity record
14
+ comorbidity_id: int | None = None
15
+
16
+ # The unique internal identifier for the associated MedicalHistory record
17
+ medical_history_id: int | None = None
18
+
19
+ # The diagnosis, in humans, as captured in the tenth version of the
20
+ # International Classification of Disease (ICD-10-CM, the disease code subset of ICD-10).
21
+ comorbidity_code: ICD10CMCode | None = None
22
+
23
+ # The words from the tenth version of the International Classification of Disease (ICD-10-CM,
24
+ # the disease subset of ICD-10) used to identify the diagnosis in humans.
25
+ comorbidity_term: ICD10CMTerm | None = None
26
+
27
+ # A descriptive string that names or briefly describes the comorbidity.
28
+ comorbidity_other: str | None = None
29
+
30
+ @model_validator(mode="after")
31
+ def validate_code_or_term_or_other_cr(self) -> Self:
32
+ if not self.comorbidity_code and not self.comorbidity_term and not self.comorbidity_other:
33
+ raise ValueError(
34
+ 'Please provide at least one of "comorbidity_code", "comorbidity_term" or "comorbidity_other".'
35
+ )
36
+ return self
@@ -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