nci-cidc-api-modules 1.2.23__py3-none-any.whl → 1.2.24__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 (81) hide show
  1. cidc_api/models/db/stage2/__init__.py +78 -0
  2. cidc_api/models/db/stage2/additional_treatment_orm.py +22 -0
  3. cidc_api/models/db/stage2/administrative_person_orm.py +25 -0
  4. cidc_api/models/db/stage2/administrative_role_assignment_orm.py +28 -0
  5. cidc_api/models/db/stage2/adverse_event_orm.py +47 -0
  6. cidc_api/models/db/stage2/arm_orm.py +23 -0
  7. cidc_api/models/db/stage2/baseline_clinical_assessment_orm.py +23 -0
  8. cidc_api/models/db/stage2/cohort_orm.py +23 -0
  9. cidc_api/models/db/stage2/comorbidity_orm.py +24 -0
  10. cidc_api/models/db/stage2/consent_group_orm.py +31 -0
  11. cidc_api/models/db/stage2/contact_orm.py +32 -0
  12. cidc_api/models/db/stage2/demographic_orm.py +44 -0
  13. cidc_api/models/db/stage2/disease_orm.py +53 -0
  14. cidc_api/models/db/stage2/exposure_orm.py +21 -0
  15. cidc_api/models/db/stage2/file_orm.py +38 -0
  16. cidc_api/models/db/stage2/gvhd_diagnosis_acute_orm.py +33 -0
  17. cidc_api/models/db/stage2/gvhd_diagnosis_chronic_orm.py +37 -0
  18. cidc_api/models/db/stage2/gvhd_organ_acute_orm.py +20 -0
  19. cidc_api/models/db/stage2/gvhd_organ_chronic_orm.py +20 -0
  20. cidc_api/models/db/stage2/institution_orm.py +33 -0
  21. cidc_api/models/db/stage2/medical_history_orm.py +29 -0
  22. cidc_api/models/db/stage2/other_clinical_endpoint_orm.py +28 -0
  23. cidc_api/models/db/stage2/other_malignancy_orm.py +30 -0
  24. cidc_api/models/db/stage2/participant_orm.py +79 -0
  25. cidc_api/models/db/stage2/prior_treatment_orm.py +28 -0
  26. cidc_api/models/db/stage2/publication_orm.py +31 -0
  27. cidc_api/models/db/stage2/radiotherapy_dose_orm.py +39 -0
  28. cidc_api/models/db/stage2/response_by_system_orm.py +28 -0
  29. cidc_api/models/db/stage2/response_orm.py +27 -0
  30. cidc_api/models/db/stage2/shipment_orm.py +47 -0
  31. cidc_api/models/db/stage2/shipment_specimen_orm.py +24 -0
  32. cidc_api/models/db/stage2/specimen_orm.py +100 -0
  33. cidc_api/models/db/stage2/stem_cell_transplant_orm.py +25 -0
  34. cidc_api/models/db/stage2/surgery_orm.py +27 -0
  35. cidc_api/models/db/stage2/therapy_agent_dose_orm.py +31 -0
  36. cidc_api/models/db/stage2/treatment_orm.py +39 -0
  37. cidc_api/models/db/stage2/trial_orm.py +60 -0
  38. cidc_api/models/pydantic/stage2/__init__.py +78 -0
  39. cidc_api/models/pydantic/stage2/additional_treatment.py +23 -0
  40. cidc_api/models/pydantic/stage2/administrative_person.py +30 -0
  41. cidc_api/models/pydantic/stage2/administrative_role_assignment.py +16 -0
  42. cidc_api/models/pydantic/stage2/adverse_event.py +100 -0
  43. cidc_api/models/pydantic/stage2/arm.py +16 -0
  44. cidc_api/models/pydantic/stage2/base.py +30 -0
  45. cidc_api/models/pydantic/stage2/baseline_clinical_assessment.py +23 -0
  46. cidc_api/models/pydantic/stage2/cohort.py +16 -0
  47. cidc_api/models/pydantic/stage2/comorbidity.py +36 -0
  48. cidc_api/models/pydantic/stage2/consent_group.py +30 -0
  49. cidc_api/models/pydantic/stage2/contact.py +35 -0
  50. cidc_api/models/pydantic/stage2/demographic.py +114 -0
  51. cidc_api/models/pydantic/stage2/disease.py +144 -0
  52. cidc_api/models/pydantic/stage2/exposure.py +32 -0
  53. cidc_api/models/pydantic/stage2/file.py +44 -0
  54. cidc_api/models/pydantic/stage2/gvhd_diagnosis_acute.py +33 -0
  55. cidc_api/models/pydantic/stage2/gvhd_diagnosis_chronic.py +32 -0
  56. cidc_api/models/pydantic/stage2/gvhd_organ_acute.py +22 -0
  57. cidc_api/models/pydantic/stage2/gvhd_organ_chronic.py +23 -0
  58. cidc_api/models/pydantic/stage2/institution.py +10 -0
  59. cidc_api/models/pydantic/stage2/medical_history.py +36 -0
  60. cidc_api/models/pydantic/stage2/other_clinical_endpoint.py +32 -0
  61. cidc_api/models/pydantic/stage2/other_malignancy.py +45 -0
  62. cidc_api/models/pydantic/stage2/participant.py +47 -0
  63. cidc_api/models/pydantic/stage2/prior_treatment.py +52 -0
  64. cidc_api/models/pydantic/stage2/publication.py +37 -0
  65. cidc_api/models/pydantic/stage2/radiotherapy_dose.py +79 -0
  66. cidc_api/models/pydantic/stage2/response.py +71 -0
  67. cidc_api/models/pydantic/stage2/response_by_system.py +109 -0
  68. cidc_api/models/pydantic/stage2/shipment.py +48 -0
  69. cidc_api/models/pydantic/stage2/shipment_specimen.py +15 -0
  70. cidc_api/models/pydantic/stage2/specimen.py +211 -0
  71. cidc_api/models/pydantic/stage2/stem_cell_transplant.py +35 -0
  72. cidc_api/models/pydantic/stage2/surgery.py +49 -0
  73. cidc_api/models/pydantic/stage2/therapy_agent_dose.py +67 -0
  74. cidc_api/models/pydantic/stage2/treatment.py +50 -0
  75. cidc_api/models/pydantic/stage2/trial.py +85 -0
  76. {nci_cidc_api_modules-1.2.23.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/METADATA +1 -1
  77. nci_cidc_api_modules-1.2.24.dist-info/RECORD +104 -0
  78. nci_cidc_api_modules-1.2.23.dist-info/RECORD +0 -29
  79. {nci_cidc_api_modules-1.2.23.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/WHEEL +0 -0
  80. {nci_cidc_api_modules-1.2.23.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/licenses/LICENSE +0 -0
  81. {nci_cidc_api_modules-1.2.23.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,33 @@
1
+ from typing import List
2
+
3
+ from sqlalchemy import ForeignKeyConstraint
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+
8
+
9
+ class InstitutionORM(BaseORM):
10
+ __tablename__ = "institution"
11
+ __repr_attrs__ = ["name"]
12
+ __table_args__ = (
13
+ ForeignKeyConstraint(
14
+ ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
15
+ ),
16
+ {"schema": "stage2"},
17
+ )
18
+
19
+ institution_id: Mapped[int] = mapped_column(primary_key=True)
20
+ trial_id: Mapped[str]
21
+ version: Mapped[str]
22
+
23
+ name: Mapped[str]
24
+
25
+ trial: Mapped["TrialORM"] = relationship(back_populates="biobank", cascade="all, delete")
26
+ administrative_people: Mapped[List["AdministrativePersonORM"]] = relationship(
27
+ back_populates="institution", cascade="all, delete", passive_deletes=True
28
+ )
29
+ shipments: Mapped[List["ShipmentORM"]] = relationship(
30
+ back_populates="institution", cascade="all, delete", passive_deletes=True
31
+ )
32
+ files: Mapped[List["FileORM"]] = relationship(back_populates="creator", cascade="all, delete", passive_deletes=True)
33
+ contacts: Mapped[List["ContactORM"]] = relationship(back_populates="institution")
@@ -0,0 +1,29 @@
1
+ from typing import Optional, List
2
+
3
+ from pydantic import NonNegativeInt, PositiveFloat
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import TobaccoSmokingStatus
9
+
10
+
11
+ class MedicalHistoryORM(BaseORM):
12
+ __tablename__ = "medical_history"
13
+ __repr_attrs__ = ["medical_history_id"]
14
+ __table_args__ = {"schema": "stage2"}
15
+
16
+ medical_history_id: Mapped[int] = mapped_column(primary_key=True)
17
+ participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
18
+
19
+ tobacco_smoking_status: Mapped[Optional[TobaccoSmokingStatus]]
20
+ pack_years_smoked: Mapped[Optional[PositiveFloat]]
21
+ num_prior_systemic_therapies: Mapped[Optional[NonNegativeInt]]
22
+
23
+ participant: Mapped["ParticipantORM"] = relationship(back_populates="medical_history", cascade="all, delete")
24
+ other_malignancies: Mapped[List["OtherMalignancyORM"]] = relationship(
25
+ back_populates="medical_history", cascade="all, delete", passive_deletes=True
26
+ )
27
+ comorbidities: Mapped[List["ComorbidityORM"]] = relationship(
28
+ back_populates="medical_history", cascade="all, delete", passive_deletes=True
29
+ )
@@ -0,0 +1,28 @@
1
+ from typing import Optional
2
+
3
+ from sqlalchemy import ForeignKey, String
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.types import YNU, ResponseSystem, ResponseSystemVersion
8
+
9
+
10
+ class OtherClinicalEndpointORM(BaseORM):
11
+ __tablename__ = "other_clinical_endpoint"
12
+ __repr_attrs__ = ["other_clinical_endpoint_id", "name", "event"]
13
+ __table_args__ = {"schema": "stage2"}
14
+
15
+ other_clinical_endpoint_id: Mapped[int] = mapped_column(primary_key=True)
16
+ participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
17
+
18
+ name: Mapped[str]
19
+ event: Mapped[YNU]
20
+ days: Mapped[Optional[int]]
21
+ description: Mapped[Optional[str]]
22
+ calculation: Mapped[Optional[str]]
23
+ response_system: Mapped[Optional[ResponseSystem]] = mapped_column(String, nullable=True)
24
+ response_system_version: Mapped[Optional[ResponseSystemVersion]] = mapped_column(String, nullable=True)
25
+
26
+ participant: Mapped["ParticipantORM"] = relationship(
27
+ back_populates="other_clinical_endpoints", cascade="all, delete"
28
+ )
@@ -0,0 +1,30 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import NonPositiveInt
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import UberonAnatomicalTerm, ICDO3MorphologicalCode, ICDO3MorphologicalTerm, MalignancyStatus
9
+
10
+
11
+ class OtherMalignancyORM(BaseORM):
12
+ __tablename__ = "other_malignancy"
13
+ __repr_attrs__ = ["other_malignancy_id", "primary_disease_site"]
14
+ __table_args__ = {"schema": "stage2"}
15
+
16
+ other_malignancy_id: Mapped[int] = mapped_column(primary_key=True)
17
+ medical_history_id: Mapped[int] = mapped_column(
18
+ ForeignKey("stage2.medical_history.medical_history_id", ondelete="CASCADE")
19
+ )
20
+
21
+ primary_disease_site: Mapped[UberonAnatomicalTerm]
22
+ morphological_code: Mapped[Optional[ICDO3MorphologicalCode]]
23
+ morphological_term: Mapped[Optional[ICDO3MorphologicalTerm]]
24
+ malignancy_description: Mapped[Optional[str]]
25
+ days_since_diagnosis: Mapped[Optional[NonPositiveInt]]
26
+ malignancy_status: Mapped[Optional[MalignancyStatus]]
27
+
28
+ medical_history: Mapped["MedicalHistoryORM"] = relationship(
29
+ back_populates="other_malignancies", cascade="all, delete"
30
+ )
@@ -0,0 +1,79 @@
1
+ from typing import List, Optional
2
+
3
+ from sqlalchemy import ForeignKey, ForeignKeyConstraint
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.types import OffStudyReason
8
+
9
+
10
+ class ParticipantORM(BaseORM):
11
+ __tablename__ = "participant"
12
+ __repr_attrs__ = ["native_participant_id", "cimac_participant_id"]
13
+ __table_args__ = (
14
+ ForeignKeyConstraint(
15
+ ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
16
+ ),
17
+ {"schema": "stage2"},
18
+ )
19
+
20
+ participant_id: Mapped[int] = mapped_column(primary_key=True)
21
+ trial_id: Mapped[str]
22
+ version: Mapped[str]
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(
27
+ ForeignKey("stage2.consent_group.consent_group_id", ondelete="CASCADE")
28
+ )
29
+ off_study: Mapped[bool]
30
+ off_study_reason: Mapped[Optional[OffStudyReason]]
31
+ off_study_reason_other: Mapped[Optional[str]]
32
+
33
+ trial: Mapped["TrialORM"] = relationship(back_populates="participants", cascade="all, delete")
34
+ demographic: Mapped["DemographicORM"] = relationship(
35
+ back_populates="participant", cascade="all, delete", passive_deletes=True
36
+ )
37
+ prior_treatments: Mapped[List["PriorTreatmentORM"]] = relationship(
38
+ back_populates="participant", cascade="all, delete", passive_deletes=True
39
+ )
40
+ treatments: Mapped[List["TreatmentORM"]] = relationship(
41
+ back_populates="participant", cascade="all, delete", passive_deletes=True
42
+ )
43
+ diseases: Mapped[List["DiseaseORM"]] = relationship(
44
+ back_populates="participant", cascade="all, delete", passive_deletes=True
45
+ )
46
+ response_by_systems: Mapped[List["ResponseBySystemORM"]] = relationship(
47
+ back_populates="participant", cascade="all, delete", passive_deletes=True
48
+ )
49
+ response: Mapped[Optional["ResponseORM"]] = relationship(
50
+ back_populates="participant", cascade="all, delete", passive_deletes=True
51
+ )
52
+ adverse_events: Mapped[List["AdverseEventORM"]] = relationship(
53
+ back_populates="participant", cascade="all, delete", passive_deletes=True
54
+ )
55
+ baseline_clinical_assessment: Mapped[Optional["BaselineClinicalAssessmentORM"]] = relationship(
56
+ back_populates="participant", cascade="all, delete", passive_deletes=True
57
+ )
58
+ medical_history: Mapped[Optional["MedicalHistoryORM"]] = relationship(
59
+ back_populates="participant", cascade="all, delete", passive_deletes=True
60
+ )
61
+ exposures: Mapped[List["ExposureORM"]] = relationship(
62
+ back_populates="participant", cascade="all, delete", passive_deletes=True
63
+ )
64
+ gvhd_diagnosis_acutes: Mapped[List["GVHDDiagnosisAcuteORM"]] = relationship(
65
+ back_populates="participant", cascade="all, delete", passive_deletes=True
66
+ )
67
+ gvhd_diagnosis_chronics: Mapped[List["GVHDDiagnosisChronicORM"]] = relationship(
68
+ back_populates="participant", cascade="all, delete", passive_deletes=True
69
+ )
70
+ specimens: Mapped[List["SpecimenORM"]] = relationship(
71
+ back_populates="participant", cascade="all, delete", passive_deletes=True
72
+ )
73
+ other_clinical_endpoints: Mapped[List["OtherClinicalEndpointORM"]] = relationship(
74
+ back_populates="participant", cascade="all, delete", passive_deletes=True
75
+ )
76
+ additional_treatments: Mapped[List["AdditionalTreatmentORM"]] = relationship(
77
+ back_populates="participant", cascade="all, delete", passive_deletes=True
78
+ )
79
+ consent_group: Mapped["ConsentGroupORM"] = relationship(back_populates="participants", cascade="all, delete")
@@ -0,0 +1,28 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import NonPositiveInt, NonNegativeInt
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import PriorTreatmentType, ConditioningRegimenType, StemCellDonorType
9
+
10
+
11
+ class PriorTreatmentORM(BaseORM):
12
+ __tablename__ = "prior_treatment"
13
+ __repr_attrs__ = ["prior_treatment_id", "type"]
14
+ __table_args__ = {"schema": "stage2"}
15
+
16
+ prior_treatment_id: Mapped[int] = mapped_column(primary_key=True)
17
+ participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
18
+
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]]
27
+
28
+ participant: Mapped["ParticipantORM"] = relationship(back_populates="prior_treatments", cascade="all, delete")
@@ -0,0 +1,31 @@
1
+ from typing import Optional, List
2
+
3
+ from sqlalchemy import ForeignKeyConstraint, ForeignKey
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.types import PriorTreatmentType, ConditioningRegimenType, StemCellDonorType
8
+
9
+
10
+ class PublicationORM(BaseORM):
11
+ __tablename__ = "publication"
12
+ __repr_attrs__ = ["publication_id", "publication_title"]
13
+ __table_args__ = (
14
+ ForeignKeyConstraint(
15
+ ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
16
+ ),
17
+ {"schema": "stage2"},
18
+ )
19
+
20
+ publication_id: Mapped[int] = mapped_column(primary_key=True)
21
+ trial_id: Mapped[str]
22
+ version: Mapped[str]
23
+
24
+ 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]]
30
+
31
+ trial: Mapped["TrialORM"] = relationship(back_populates="publications", cascade="all, delete")
@@ -0,0 +1,39 @@
1
+ from pydantic import NonNegativeInt, NonNegativeFloat, PositiveFloat
2
+ from typing import Optional
3
+
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import (
9
+ RadiotherapyProcedure,
10
+ UberonAnatomicalTerm,
11
+ RadiotherapyDoseUnits,
12
+ YNU,
13
+ RadiationExtent,
14
+ )
15
+
16
+
17
+ class RadiotherapyDoseORM(BaseORM):
18
+ __tablename__ = "radiotherapy_dose"
19
+ __repr_attrs__ = ["radiotherapy_dose_id", "procedure"]
20
+ __table_args__ = {"schema": "stage2"}
21
+
22
+ radiotherapy_dose_id: Mapped[int] = mapped_column(primary_key=True)
23
+ treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
24
+
25
+ days_to_start: Mapped[NonNegativeInt]
26
+ days_to_end: Mapped[NonNegativeInt]
27
+ procedure: Mapped[RadiotherapyProcedure]
28
+ anatomical_location: Mapped[Optional[UberonAnatomicalTerm]]
29
+ is_total_dose: Mapped[bool]
30
+ number_of_fractions: Mapped[Optional[NonNegativeInt]]
31
+ received_dose: Mapped[NonNegativeFloat]
32
+ received_dose_units: Mapped[RadiotherapyDoseUnits]
33
+ planned_dose: Mapped[Optional[PositiveFloat]]
34
+ planned_dose_units: Mapped[Optional[RadiotherapyDoseUnits]]
35
+ dose_changes_delays: Mapped[YNU]
36
+ changes_delays_description: Mapped[Optional[str]]
37
+ radiation_extent: Mapped[RadiationExtent]
38
+
39
+ treatment: Mapped["TreatmentORM"] = relationship(back_populates="radiotherapy_doses", cascade="all, delete")
@@ -0,0 +1,28 @@
1
+ from pydantic import PositiveInt
2
+ from sqlalchemy import ForeignKey, String
3
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
4
+
5
+ from cidc_api.models.db.base_orm import BaseORM
6
+ from cidc_api.models.types import ResponseSystem, ResponseSystemVersion, BestOverallResponse, YNUNA
7
+
8
+
9
+ class ResponseBySystemORM(BaseORM):
10
+ __tablename__ = "response_by_system"
11
+ __repr_attrs__ = ["response_by_system_id", "participant_id"]
12
+ __table_args__ = {"schema": "stage2"}
13
+
14
+ response_by_system_id: Mapped[int] = mapped_column(primary_key=True)
15
+ participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
16
+ response_system: Mapped[ResponseSystem] = mapped_column(String)
17
+ response_system_version: Mapped[ResponseSystemVersion] = mapped_column(String)
18
+ best_overall_response: Mapped[BestOverallResponse] = mapped_column(String)
19
+ response_duration: Mapped[PositiveInt | None]
20
+ durable_clinical_benefit: Mapped[bool | None]
21
+ days_to_first_response: Mapped[PositiveInt | None]
22
+ days_to_best_response: Mapped[PositiveInt | None]
23
+ progression: Mapped[YNUNA]
24
+ days_to_disease_progression: Mapped[PositiveInt | None]
25
+ progression_free_survival_event: Mapped[YNUNA]
26
+ progression_free_survival: Mapped[PositiveInt | None]
27
+
28
+ participant: Mapped["ParticipantORM"] = relationship(back_populates="response_by_systems", cascade="all, delete")
@@ -0,0 +1,27 @@
1
+ from pydantic import NonNegativeInt
2
+
3
+ from sqlalchemy import ForeignKey
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.types import SurvivalStatus, YNUNA, CauseOfDeath
8
+
9
+
10
+ class ResponseORM(BaseORM):
11
+ __tablename__ = "response"
12
+ __repr_attrs__ = ["response_id", "participant_id"]
13
+ __table_args__ = {"schema": "stage2"}
14
+
15
+ response_id: Mapped[int] = mapped_column(primary_key=True)
16
+ participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
17
+ survival_status: Mapped[SurvivalStatus]
18
+ overall_survival: Mapped[NonNegativeInt | None]
19
+ abscopal_response: Mapped[YNUNA | None]
20
+ pathological_complete_response: Mapped[YNUNA | None]
21
+ days_to_death: Mapped[NonNegativeInt | None]
22
+ cause_of_death: Mapped[CauseOfDeath | None]
23
+ evaluable_for_toxicity: Mapped[bool]
24
+ evaluable_for_efficacy: Mapped[bool]
25
+ days_to_last_follow_up: Mapped[NonNegativeInt | None]
26
+
27
+ participant: Mapped["ParticipantORM"] = relationship(back_populates="response", cascade="all, delete")
@@ -0,0 +1,47 @@
1
+ from datetime import datetime
2
+ from typing import Optional, List
3
+
4
+ from sqlalchemy import ForeignKey, ForeignKeyConstraint
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import AssayPriority, AssayType, Courier, ShipmentCondition, ShipmentQuality
9
+
10
+
11
+ class ShipmentORM(BaseORM):
12
+ __tablename__ = "shipment"
13
+ __repr_attrs__ = ["shipment_id", "institution_id", "trial_id"]
14
+ __table_args__ = (
15
+ ForeignKeyConstraint(
16
+ ["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
17
+ ),
18
+ {"schema": "stage2"},
19
+ )
20
+
21
+ shipment_id: Mapped[int] = mapped_column(primary_key=True)
22
+ institution_id: Mapped[int] = mapped_column(ForeignKey("stage2.institution.institution_id", ondelete="CASCADE"))
23
+ trial_id: Mapped[str]
24
+ version: Mapped[str]
25
+
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]]
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(
40
+ back_populates="shipment_from", cascade="all, delete", foreign_keys="[ContactORM.shipment_from_id]"
41
+ )
42
+ shipped_to: Mapped["ContactORM"] = relationship(
43
+ back_populates="shipment_to", cascade="all, delete", foreign_keys="[ContactORM.shipment_to_id]"
44
+ )
45
+ shipment_specimens: Mapped[List["ShipmentSpecimenORM"]] = relationship(
46
+ back_populates="shipment", cascade="all, delete", passive_deletes=True
47
+ )
@@ -0,0 +1,24 @@
1
+ from datetime import datetime
2
+
3
+ from sqlalchemy import ForeignKey
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+
8
+
9
+ class ShipmentSpecimenORM(BaseORM):
10
+ __tablename__ = "shipment_specimen"
11
+ __repr_attrs__ = ["specimen_id", "shipment_id"]
12
+ __table_args__ = {"schema": "stage2"}
13
+
14
+ specimen_id: Mapped[int] = mapped_column(
15
+ ForeignKey("stage2.specimen.specimen_id", ondelete="CASCADE"), primary_key=True
16
+ )
17
+ shipment_id: Mapped[int] = mapped_column(
18
+ ForeignKey("stage2.shipment.shipment_id", ondelete="CASCADE"), primary_key=True
19
+ )
20
+ box_number: Mapped[str]
21
+ sample_location: Mapped[str]
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")
@@ -0,0 +1,100 @@
1
+ from datetime import datetime
2
+ from typing import List
3
+
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import (
9
+ UberonAnatomicalTerm,
10
+ ICDO3MorphologicalCode,
11
+ SpecimenType,
12
+ SpecimenDescription,
13
+ TumorType,
14
+ CollectionProcedure,
15
+ FixationStabilizationType,
16
+ PrimaryContainerType,
17
+ VolumeUnits,
18
+ ProcessedType,
19
+ ConcentrationUnits,
20
+ DerivativeType,
21
+ PBMCRestingPeriodUsed,
22
+ MaterialUnits,
23
+ MaterialStorageCondition,
24
+ QCCondition,
25
+ ReplacementRequested,
26
+ ResidualUse,
27
+ DiagnosisVerification,
28
+ AssayType,
29
+ )
30
+
31
+
32
+ class SpecimenORM(BaseORM):
33
+ __tablename__ = "specimen"
34
+ __repr_attrs__ = ["specimen_id", "participant_id", "cimac_id"]
35
+ __table_args__ = {"schema": "stage2"}
36
+
37
+ specimen_id: Mapped[int] = mapped_column(primary_key=True)
38
+ participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
39
+
40
+ cimac_id: Mapped[str]
41
+ surgical_pathology_report_id: Mapped[str | None]
42
+ clinical_report_id: Mapped[str | None]
43
+ parent_specimen_id: Mapped[str | None]
44
+ processed_specimen_id: Mapped[str | None]
45
+ organ_site_of_collection: Mapped[UberonAnatomicalTerm | None]
46
+ histology_behavior: Mapped[ICDO3MorphologicalCode | None]
47
+ histology_behavior_description: Mapped[str | None]
48
+ collection_event_name: Mapped[str | None]
49
+ specimen_type: Mapped[SpecimenType | None]
50
+ specimen_type_other: Mapped[str | None]
51
+ specimen_description: Mapped[SpecimenDescription | None]
52
+ tumor_type: Mapped[TumorType | None]
53
+ collection_procedure: Mapped[CollectionProcedure | None]
54
+ collection_procedure_other: Mapped[str | None]
55
+ core_number: Mapped[str | None]
56
+ fixation_stabilization_type: Mapped[FixationStabilizationType | None]
57
+ primary_container_type: Mapped[PrimaryContainerType | None]
58
+ primary_container_type_other: Mapped[str | None]
59
+ volume: Mapped[float | None]
60
+ volume_units: Mapped[VolumeUnits | None]
61
+ processed_type: Mapped[ProcessedType | None]
62
+ processed_volume: Mapped[float | None]
63
+ processed_volume_units: Mapped[VolumeUnits | None]
64
+ processed_concentration: Mapped[float | None]
65
+ processed_concentration_units: Mapped[ConcentrationUnits | None]
66
+ processed_quantity: Mapped[float | None]
67
+ derivative_type: Mapped[DerivativeType | None]
68
+ derivative_volume: Mapped[float | None]
69
+ derivative_volume_units: Mapped[VolumeUnits | None]
70
+ derivative_concentration: Mapped[float | None]
71
+ derivative_concentration_units: Mapped[ConcentrationUnits | None]
72
+ tumor_tissue_total_area_percentage: Mapped[float | None]
73
+ viable_tumor_area_percentage: Mapped[float | None]
74
+ viable_stroma_area_percentage: Mapped[float | None]
75
+ necrosis_area_percentage: Mapped[float | None]
76
+ fibrosis_area_percentage: Mapped[float | None]
77
+ din: Mapped[float | None]
78
+ a260_a280: Mapped[float | None]
79
+ a260_a230: Mapped[float | None]
80
+ pbmc_viability: Mapped[float | None]
81
+ pbmc_recovery: Mapped[float | None]
82
+ pbmc_resting_period_used: Mapped[PBMCRestingPeriodUsed | None]
83
+ material_used: Mapped[float | None]
84
+ material_used_units: Mapped[MaterialUnits | None]
85
+ material_remaining: Mapped[float | None]
86
+ material_remaining_units: Mapped[MaterialUnits | None]
87
+ material_storage_condition: Mapped[MaterialStorageCondition | None]
88
+ qc_condition: Mapped[QCCondition | None]
89
+ replacement_requested: Mapped[ReplacementRequested | None]
90
+ residual_use: Mapped[ResidualUse | None]
91
+ comments: Mapped[str | None]
92
+ diagnosis_verification: Mapped[DiagnosisVerification | None]
93
+ intended_assay: Mapped[AssayType | None]
94
+ date_ingested: Mapped[datetime | None]
95
+ days_to_specimen_collection: Mapped[int | None]
96
+
97
+ participant: Mapped["ParticipantORM"] = relationship(back_populates="specimens", cascade="all, delete")
98
+ shipment_specimen: Mapped["ShipmentSpecimenORM"] = relationship(
99
+ back_populates="specimen", cascade="all, delete", passive_deletes=True
100
+ )
@@ -0,0 +1,25 @@
1
+ from pydantic import NonNegativeInt
2
+ from typing import Optional
3
+
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import StemCellDonorType, AllogeneicDonorType, StemCellSource, ConditioningRegimenType
9
+
10
+
11
+ class StemCellTransplantORM(BaseORM):
12
+ __tablename__ = "stem_cell_transplant"
13
+ __repr_attrs__ = ["stem_cell_transplant_id"]
14
+ __table_args__ = {"schema": "stage2"}
15
+
16
+ stem_cell_transplant_id: Mapped[int] = mapped_column(primary_key=True)
17
+ treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
18
+
19
+ stem_cell_donor_type: Mapped[StemCellDonorType]
20
+ allogeneic_donor_type: Mapped[AllogeneicDonorType]
21
+ stem_cells_source: Mapped[StemCellSource]
22
+ days_to_transplant: Mapped[NonNegativeInt]
23
+ conditioning_regimen_type: Mapped[Optional[ConditioningRegimenType]]
24
+
25
+ treatment: Mapped["TreatmentORM"] = relationship(back_populates="stem_cell_transplants", cascade="all, delete")
@@ -0,0 +1,27 @@
1
+ from pydantic import NonNegativeInt
2
+ from typing import Optional
3
+
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import SurgicalProcedure, UberonAnatomicalTerm, YNU
9
+
10
+
11
+ class SurgeryORM(BaseORM):
12
+ __tablename__ = "surgery"
13
+ __repr_attrs__ = ["surgery_id", "procedure"]
14
+ __table_args__ = {"schema": "stage2"}
15
+
16
+ surgery_id: Mapped[int] = mapped_column(primary_key=True)
17
+ treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
18
+
19
+ procedure: Mapped[SurgicalProcedure]
20
+ procedure_other: Mapped[Optional[str]]
21
+ days_to_procedure: Mapped[NonNegativeInt]
22
+ anatomical_location: Mapped[UberonAnatomicalTerm]
23
+ therapeutic: Mapped[YNU]
24
+ findings: Mapped[Optional[str]]
25
+ extent_of_residual_disease: Mapped[Optional[str]]
26
+
27
+ treatment: Mapped["TreatmentORM"] = relationship(back_populates="surgeries", cascade="all, delete")
@@ -0,0 +1,31 @@
1
+ from pydantic import NonNegativeInt, NonNegativeFloat, PositiveFloat
2
+ from typing import Optional
3
+
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+
7
+ from cidc_api.models.db.base_orm import BaseORM
8
+ from cidc_api.models.types import TherapyAgentDoseUnits, YNU
9
+
10
+
11
+ class TherapyAgentDoseORM(BaseORM):
12
+ __tablename__ = "therapy_agent_dose"
13
+ __repr_attrs__ = ["therapy_agent_dose_id", "therapy_agent_name"]
14
+ __table_args__ = {"schema": "stage2"}
15
+
16
+ therapy_agent_dose_id: Mapped[int] = mapped_column(primary_key=True)
17
+ treatment_id: Mapped[int] = mapped_column(ForeignKey("stage2.treatment.treatment_id", ondelete="CASCADE"))
18
+
19
+ course_number: Mapped[Optional[str]]
20
+ therapy_agent_name: Mapped[str]
21
+ days_to_start: Mapped[NonNegativeInt]
22
+ days_to_end: Mapped[NonNegativeInt]
23
+ number_of_doses: Mapped[NonNegativeInt]
24
+ received_dose: Mapped[NonNegativeFloat]
25
+ received_dose_units: Mapped[TherapyAgentDoseUnits]
26
+ planned_dose: Mapped[Optional[PositiveFloat]]
27
+ planned_dose_units: Mapped[Optional[TherapyAgentDoseUnits]]
28
+ dose_changes_delays: Mapped[YNU]
29
+ changes_delays_description: Mapped[Optional[str]]
30
+
31
+ treatment: Mapped["TreatmentORM"] = relationship(back_populates="therapy_agent_doses", cascade="all, delete")
@@ -0,0 +1,39 @@
1
+ from typing import List, Optional
2
+
3
+ from sqlalchemy import ForeignKey
4
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
+
6
+ from cidc_api.models.db.base_orm import BaseORM
7
+ from cidc_api.models.types import YNU, OffTreatmentReason
8
+
9
+
10
+ class TreatmentORM(BaseORM):
11
+ __tablename__ = "treatment"
12
+ __repr_attrs__ = ["treatment_id", "participant_id", "treatment_description"]
13
+ __table_args__ = {"schema": "stage2"}
14
+
15
+ treatment_id: Mapped[int] = mapped_column(primary_key=True)
16
+ 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"))
19
+
20
+ treatment_description: Mapped[str]
21
+ off_treatment: Mapped[YNU]
22
+ off_treatment_reason: Mapped[Optional[OffTreatmentReason]]
23
+ off_treatment_reason_other: Mapped[Optional[str]]
24
+
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")
29
+
30
+ therapy_agent_doses: Mapped[List["TherapyAgentDoseORM"]] = relationship(
31
+ back_populates="treatment", cascade="all, delete"
32
+ )
33
+ radiotherapy_doses: Mapped[List["RadiotherapyDoseORM"]] = relationship(
34
+ back_populates="treatment", cascade="all, delete"
35
+ )
36
+ surgeries: Mapped[List["SurgeryORM"]] = relationship(back_populates="treatment", cascade="all, delete")
37
+ stem_cell_transplants: Mapped[List["StemCellTransplantORM"]] = relationship(
38
+ back_populates="treatment", cascade="all, delete"
39
+ )