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.
- cidc_api/__init__.py +1 -0
- cidc_api/config/db.py +21 -1
- cidc_api/config/settings.py +1 -0
- cidc_api/models/__init__.py +0 -2
- cidc_api/models/data.py +17 -4
- cidc_api/models/db/stage1/__init__.py +56 -0
- cidc_api/models/db/stage1/additional_treatment_orm.py +22 -0
- cidc_api/models/db/stage1/adverse_event_orm.py +46 -0
- cidc_api/models/db/stage1/base_orm.py +7 -0
- cidc_api/models/db/stage1/baseline_clinical_assessment_orm.py +22 -0
- cidc_api/models/db/stage1/comorbidity_orm.py +23 -0
- cidc_api/models/db/stage1/consent_group_orm.py +32 -0
- cidc_api/models/db/stage1/demographic_orm.py +47 -0
- cidc_api/models/db/stage1/disease_orm.py +52 -0
- cidc_api/models/db/stage1/exposure_orm.py +22 -0
- cidc_api/models/db/stage1/gvhd_diagnosis_acute_orm.py +34 -0
- cidc_api/models/db/stage1/gvhd_diagnosis_chronic_orm.py +36 -0
- cidc_api/models/db/stage1/gvhd_organ_acute_orm.py +21 -0
- cidc_api/models/db/stage1/gvhd_organ_chronic_orm.py +21 -0
- cidc_api/models/db/stage1/medical_history_orm.py +30 -0
- cidc_api/models/db/stage1/other_malignancy_orm.py +29 -0
- cidc_api/models/db/stage1/participant_orm.py +77 -0
- cidc_api/models/db/stage1/prior_treatment_orm.py +29 -0
- cidc_api/models/db/stage1/radiotherapy_dose_orm.py +39 -0
- cidc_api/models/db/stage1/response_by_system_orm.py +30 -0
- cidc_api/models/db/stage1/response_orm.py +28 -0
- cidc_api/models/db/stage1/specimen_orm.py +46 -0
- cidc_api/models/db/stage1/stem_cell_transplant_orm.py +25 -0
- cidc_api/models/db/stage1/surgery_orm.py +27 -0
- cidc_api/models/db/stage1/therapy_agent_dose_orm.py +31 -0
- cidc_api/models/db/stage1/treatment_orm.py +38 -0
- cidc_api/models/db/stage1/trial_orm.py +35 -0
- cidc_api/models/db/stage2/additional_treatment_orm.py +8 -8
- cidc_api/models/db/stage2/administrative_person_orm.py +4 -4
- cidc_api/models/db/stage2/administrative_role_assignment_orm.py +4 -4
- cidc_api/models/db/stage2/adverse_event_orm.py +12 -13
- cidc_api/models/db/stage2/arm_orm.py +3 -3
- cidc_api/models/db/stage2/base_orm.py +7 -0
- cidc_api/models/db/stage2/baseline_clinical_assessment_orm.py +6 -7
- cidc_api/models/db/stage2/cohort_orm.py +3 -3
- cidc_api/models/db/stage2/comorbidity_orm.py +7 -8
- cidc_api/models/db/stage2/consent_group_orm.py +5 -4
- cidc_api/models/db/stage2/contact_orm.py +16 -20
- cidc_api/models/db/stage2/demographic_orm.py +11 -8
- cidc_api/models/db/stage2/disease_orm.py +13 -14
- cidc_api/models/db/stage2/exposure_orm.py +5 -4
- cidc_api/models/db/stage2/file_orm.py +6 -9
- cidc_api/models/db/stage2/gvhd_diagnosis_acute_orm.py +5 -4
- cidc_api/models/db/stage2/gvhd_diagnosis_chronic_orm.py +5 -6
- cidc_api/models/db/stage2/gvhd_organ_acute_orm.py +4 -3
- cidc_api/models/db/stage2/gvhd_organ_chronic_orm.py +4 -3
- cidc_api/models/db/stage2/institution_orm.py +7 -7
- cidc_api/models/db/stage2/medical_history_orm.py +10 -9
- cidc_api/models/db/stage2/other_clinical_endpoint_orm.py +8 -12
- cidc_api/models/db/stage2/other_malignancy_orm.py +10 -11
- cidc_api/models/db/stage2/participant_orm.py +28 -28
- cidc_api/models/db/stage2/prior_treatment_orm.py +15 -14
- cidc_api/models/db/stage2/publication_orm.py +9 -11
- cidc_api/models/db/stage2/radiotherapy_dose_orm.py +9 -9
- cidc_api/models/db/stage2/response_by_system_orm.py +5 -3
- cidc_api/models/db/stage2/response_orm.py +6 -5
- cidc_api/models/db/stage2/shipment_orm.py +17 -17
- cidc_api/models/db/stage2/shipment_specimen_orm.py +4 -4
- cidc_api/models/db/stage2/specimen_orm.py +7 -6
- cidc_api/models/db/stage2/stem_cell_transplant_orm.py +7 -7
- cidc_api/models/db/stage2/surgery_orm.py +7 -7
- cidc_api/models/db/stage2/therapy_agent_dose_orm.py +8 -8
- cidc_api/models/db/stage2/treatment_orm.py +16 -15
- cidc_api/models/db/stage2/trial_orm.py +34 -33
- cidc_api/models/files/facets.py +4 -0
- cidc_api/models/models.py +154 -9
- cidc_api/models/pydantic/{stage2/base.py → base.py} +19 -1
- cidc_api/models/pydantic/stage1/__init__.py +56 -0
- cidc_api/models/pydantic/stage1/additional_treatment.py +23 -0
- cidc_api/models/pydantic/stage1/adverse_event.py +100 -0
- cidc_api/models/pydantic/stage1/baseline_clinical_assessment.py +23 -0
- cidc_api/models/pydantic/stage1/comorbidity.py +36 -0
- cidc_api/models/pydantic/stage1/consent_group.py +30 -0
- cidc_api/models/pydantic/stage1/demographic.py +123 -0
- cidc_api/models/pydantic/stage1/disease.py +158 -0
- cidc_api/models/pydantic/stage1/exposure.py +32 -0
- cidc_api/models/pydantic/stage1/gvhd_diagnosis_acute.py +33 -0
- cidc_api/models/pydantic/stage1/gvhd_diagnosis_chronic.py +32 -0
- cidc_api/models/pydantic/stage1/gvhd_organ_acute.py +22 -0
- cidc_api/models/pydantic/stage1/gvhd_organ_chronic.py +23 -0
- cidc_api/models/pydantic/stage1/medical_history.py +36 -0
- cidc_api/models/pydantic/stage1/other_malignancy.py +49 -0
- cidc_api/models/pydantic/stage1/participant.py +51 -0
- cidc_api/models/pydantic/stage1/prior_treatment.py +45 -0
- cidc_api/models/pydantic/stage1/radiotherapy_dose.py +79 -0
- cidc_api/models/pydantic/stage1/response.py +65 -0
- cidc_api/models/pydantic/stage1/response_by_system.py +112 -0
- cidc_api/models/pydantic/stage1/specimen.py +31 -0
- cidc_api/models/pydantic/stage1/stem_cell_transplant.py +35 -0
- cidc_api/models/pydantic/stage1/surgery.py +49 -0
- cidc_api/models/pydantic/stage1/therapy_agent_dose.py +67 -0
- cidc_api/models/pydantic/stage1/treatment.py +50 -0
- cidc_api/models/pydantic/stage1/trial.py +45 -0
- cidc_api/models/pydantic/stage2/additional_treatment.py +5 -5
- cidc_api/models/pydantic/stage2/administrative_person.py +1 -1
- cidc_api/models/pydantic/stage2/administrative_role_assignment.py +2 -2
- cidc_api/models/pydantic/stage2/adverse_event.py +2 -2
- cidc_api/models/pydantic/stage2/arm.py +2 -2
- cidc_api/models/pydantic/stage2/baseline_clinical_assessment.py +2 -2
- cidc_api/models/pydantic/stage2/cohort.py +1 -1
- cidc_api/models/pydantic/stage2/comorbidity.py +1 -1
- cidc_api/models/pydantic/stage2/consent_group.py +2 -2
- cidc_api/models/pydantic/stage2/contact.py +1 -1
- cidc_api/models/pydantic/stage2/demographic.py +27 -18
- cidc_api/models/pydantic/stage2/disease.py +33 -19
- cidc_api/models/pydantic/stage2/exposure.py +3 -3
- cidc_api/models/pydantic/stage2/file.py +2 -2
- cidc_api/models/pydantic/stage2/gvhd_diagnosis_acute.py +2 -2
- cidc_api/models/pydantic/stage2/gvhd_diagnosis_chronic.py +2 -2
- cidc_api/models/pydantic/stage2/gvhd_organ_acute.py +1 -1
- cidc_api/models/pydantic/stage2/gvhd_organ_chronic.py +1 -1
- cidc_api/models/pydantic/stage2/institution.py +1 -1
- cidc_api/models/pydantic/stage2/medical_history.py +2 -2
- cidc_api/models/pydantic/stage2/other_clinical_endpoint.py +1 -1
- cidc_api/models/pydantic/stage2/other_malignancy.py +12 -8
- cidc_api/models/pydantic/stage2/participant.py +10 -6
- cidc_api/models/pydantic/stage2/prior_treatment.py +14 -23
- cidc_api/models/pydantic/stage2/publication.py +2 -2
- cidc_api/models/pydantic/stage2/radiotherapy_dose.py +2 -2
- cidc_api/models/pydantic/stage2/response.py +5 -11
- cidc_api/models/pydantic/stage2/response_by_system.py +10 -7
- cidc_api/models/pydantic/stage2/shipment.py +2 -2
- cidc_api/models/pydantic/stage2/shipment_specimen.py +1 -1
- cidc_api/models/pydantic/stage2/specimen.py +8 -5
- cidc_api/models/pydantic/stage2/stem_cell_transplant.py +2 -2
- cidc_api/models/pydantic/stage2/surgery.py +1 -1
- cidc_api/models/pydantic/stage2/therapy_agent_dose.py +1 -1
- cidc_api/models/pydantic/stage2/treatment.py +2 -2
- cidc_api/models/pydantic/stage2/trial.py +19 -15
- cidc_api/models/types.py +45 -42
- cidc_api/shared/assay_handling.py +68 -0
- cidc_api/shared/auth.py +5 -5
- cidc_api/shared/file_handling.py +16 -4
- cidc_api/shared/gcloud_client.py +78 -16
- cidc_api/shared/utils.py +18 -9
- cidc_api/telemetry.py +101 -0
- {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/METADATA +25 -14
- nci_cidc_api_modules-1.2.45.dist-info/RECORD +165 -0
- cidc_api/models/db/base_orm.py +0 -25
- nci_cidc_api_modules-1.2.29.dist-info/RECORD +0 -109
- {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/WHEEL +0 -0
- {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/licenses/LICENSE +0 -0
- {nci_cidc_api_modules-1.2.29.dist-info → nci_cidc_api_modules-1.2.45.dist-info}/top_level.txt +0 -0
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from __future__ import annotations
|
|
3
2
|
from sqlalchemy import ForeignKey
|
|
4
3
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
5
4
|
|
|
6
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
5
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
7
6
|
from cidc_api.models.types import ICD10CMCode, ICD10CMTerm
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class ComorbidityORM(BaseORM):
|
|
11
10
|
__tablename__ = "comorbidity"
|
|
12
11
|
__repr_attrs__ = ["comorbidity_id", "comorbidity_term"]
|
|
13
|
-
|
|
12
|
+
__data_category__ = "comorbidity"
|
|
14
13
|
|
|
15
14
|
comorbidity_id: Mapped[int] = mapped_column(primary_key=True)
|
|
16
15
|
medical_history_id: Mapped[int] = mapped_column(
|
|
17
16
|
ForeignKey("stage2.medical_history.medical_history_id", ondelete="CASCADE")
|
|
18
17
|
)
|
|
19
18
|
|
|
20
|
-
comorbidity_code: Mapped[
|
|
21
|
-
comorbidity_term: Mapped[
|
|
22
|
-
comorbidity_other: Mapped[
|
|
19
|
+
comorbidity_code: Mapped[ICD10CMCode | None]
|
|
20
|
+
comorbidity_term: Mapped[ICD10CMTerm | None]
|
|
21
|
+
comorbidity_other: Mapped[str | None]
|
|
23
22
|
|
|
24
|
-
medical_history: Mapped[
|
|
23
|
+
medical_history: Mapped[MedicalHistoryORM] = relationship(back_populates="comorbidities", cascade="all, delete")
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from typing import List
|
|
2
3
|
|
|
3
4
|
from pydantic import NonNegativeInt
|
|
4
5
|
from sqlalchemy import 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
|
|
|
9
10
|
|
|
10
11
|
class ConsentGroupORM(BaseORM):
|
|
@@ -14,8 +15,8 @@ class ConsentGroupORM(BaseORM):
|
|
|
14
15
|
ForeignKeyConstraint(
|
|
15
16
|
["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
|
|
16
17
|
),
|
|
17
|
-
{"schema": "stage2"},
|
|
18
18
|
)
|
|
19
|
+
__data_category__ = "consent_group"
|
|
19
20
|
|
|
20
21
|
consent_group_id: Mapped[int] = mapped_column(primary_key=True)
|
|
21
22
|
trial_id: Mapped[str]
|
|
@@ -25,7 +26,7 @@ class ConsentGroupORM(BaseORM):
|
|
|
25
26
|
consent_group_name: Mapped[str]
|
|
26
27
|
consent_group_number: Mapped[NonNegativeInt]
|
|
27
28
|
|
|
28
|
-
trial: Mapped[
|
|
29
|
-
participants: Mapped[List[
|
|
29
|
+
trial: Mapped[TrialORM] = relationship(back_populates="consent_groups", cascade="all, delete")
|
|
30
|
+
participants: Mapped[List[ParticipantORM]] = relationship(
|
|
30
31
|
back_populates="consent_group", cascade="all, delete", passive_deletes=True
|
|
31
32
|
)
|
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from __future__ import annotations
|
|
3
2
|
from sqlalchemy import ForeignKey
|
|
4
3
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
5
4
|
|
|
6
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
5
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class ContactORM(BaseORM):
|
|
10
9
|
__tablename__ = "contact"
|
|
11
|
-
__table_args__ = {"schema": "stage2"}
|
|
12
10
|
|
|
13
11
|
contact_id: Mapped[int] = mapped_column(primary_key=True)
|
|
14
12
|
institution_id: Mapped[int] = mapped_column(ForeignKey("stage2.institution.institution_id", ondelete="CASCADE"))
|
|
15
|
-
shipment_from_id: Mapped[
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
shipment_to_id: Mapped[Optional[int]] = mapped_column(ForeignKey("stage2.shipment.shipment_id", ondelete="CASCADE"))
|
|
13
|
+
shipment_from_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.shipment.shipment_id", ondelete="CASCADE"))
|
|
14
|
+
shipment_to_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.shipment.shipment_id", ondelete="CASCADE"))
|
|
19
15
|
|
|
20
|
-
name: Mapped[
|
|
21
|
-
email: Mapped[
|
|
22
|
-
phone: Mapped[
|
|
23
|
-
street1: Mapped[
|
|
24
|
-
street2: Mapped[
|
|
25
|
-
city: Mapped[
|
|
26
|
-
state: Mapped[
|
|
27
|
-
zip: Mapped[
|
|
28
|
-
country: Mapped[
|
|
16
|
+
name: Mapped[str | None]
|
|
17
|
+
email: Mapped[str | None]
|
|
18
|
+
phone: Mapped[str | None]
|
|
19
|
+
street1: Mapped[str | None]
|
|
20
|
+
street2: Mapped[str | None]
|
|
21
|
+
city: Mapped[str | None]
|
|
22
|
+
state: Mapped[str | None]
|
|
23
|
+
zip: Mapped[str | None]
|
|
24
|
+
country: Mapped[str | None]
|
|
29
25
|
|
|
30
|
-
institution: Mapped[
|
|
31
|
-
shipment_from: Mapped[
|
|
32
|
-
shipment_to: Mapped[
|
|
26
|
+
institution: Mapped[InstitutionORM | None] = relationship(back_populates="contacts", cascade="all, delete")
|
|
27
|
+
shipment_from: Mapped[ShipmentORM] = relationship(cascade="all, delete", foreign_keys=[shipment_from_id])
|
|
28
|
+
shipment_to: Mapped[ShipmentORM] = relationship(cascade="all, delete", foreign_keys=[shipment_to_id])
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from pydantic import NonNegativeFloat, PositiveFloat, PositiveInt
|
|
3
|
+
from typing import List
|
|
2
4
|
|
|
3
5
|
from sqlalchemy import ForeignKey
|
|
4
6
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
7
|
+
from sqlalchemy.types import JSON
|
|
5
8
|
|
|
6
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
9
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
7
10
|
from cidc_api.models.types import (
|
|
8
11
|
Sex,
|
|
9
12
|
Race,
|
|
@@ -20,25 +23,25 @@ from cidc_api.models.types import (
|
|
|
20
23
|
class DemographicORM(BaseORM):
|
|
21
24
|
__tablename__ = "demographic"
|
|
22
25
|
__repr_attrs__ = ["demographic_id", "participant_id", "age_at_enrollment", "sex"]
|
|
23
|
-
|
|
26
|
+
__data_category__ = "demographic"
|
|
24
27
|
|
|
25
28
|
demographic_id: Mapped[int] = mapped_column(primary_key=True)
|
|
26
29
|
participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
|
|
27
30
|
age_at_enrollment: Mapped[PositiveInt | None]
|
|
28
31
|
age_at_enrollment_units: Mapped[AgeAtEnrollmentUnits | None]
|
|
29
|
-
|
|
32
|
+
age_90_or_over: Mapped[bool]
|
|
30
33
|
sex: Mapped[Sex]
|
|
31
|
-
race: Mapped[Race]
|
|
34
|
+
race: Mapped[List[Race]] = mapped_column(JSON)
|
|
32
35
|
ethnicity: Mapped[Ethnicity]
|
|
33
36
|
height: Mapped[PositiveFloat]
|
|
34
37
|
height_units: Mapped[HeightUnits]
|
|
35
38
|
weight: Mapped[PositiveFloat]
|
|
36
39
|
weight_units: Mapped[WeightUnits]
|
|
37
|
-
body_mass_index: Mapped[PositiveFloat]
|
|
38
|
-
body_surface_area: Mapped[PositiveFloat]
|
|
39
|
-
body_surface_area_units: Mapped[BodySurfaceAreaUnits]
|
|
40
|
+
body_mass_index: Mapped[PositiveFloat | None]
|
|
41
|
+
body_surface_area: Mapped[PositiveFloat | None]
|
|
42
|
+
body_surface_area_units: Mapped[BodySurfaceAreaUnits | None]
|
|
40
43
|
occupation: Mapped[Occupation | None]
|
|
41
44
|
income: Mapped[NonNegativeFloat | None]
|
|
42
45
|
highest_level_of_education: Mapped[Education | None]
|
|
43
46
|
|
|
44
|
-
participant: Mapped[
|
|
47
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="demographic", cascade="all, delete")
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
from
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import List
|
|
2
3
|
|
|
3
4
|
from pydantic import NonPositiveInt
|
|
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.db.stage2.base_orm import BaseORM
|
|
9
10
|
from cidc_api.models.types import (
|
|
10
|
-
PrimaryDiagnosisDiseaseGroup,
|
|
11
11
|
TumorGrade,
|
|
12
12
|
CancerStageSystem,
|
|
13
13
|
CancerStageSystemVersion,
|
|
@@ -29,25 +29,24 @@ class DiseaseORM(BaseORM):
|
|
|
29
29
|
"disease_id",
|
|
30
30
|
"participant_id",
|
|
31
31
|
]
|
|
32
|
-
|
|
32
|
+
__data_category__ = "disease"
|
|
33
33
|
|
|
34
34
|
disease_id: Mapped[int] = mapped_column(primary_key=True)
|
|
35
35
|
participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
|
|
36
|
-
primary_diagnosis_disease_group: Mapped[PrimaryDiagnosisDiseaseGroup]
|
|
37
36
|
primary_disease_site: Mapped[UberonAnatomicalTerm]
|
|
38
|
-
morphological_code: Mapped[ICDO3MorphologicalCode]
|
|
39
|
-
morphological_term: Mapped[ICDO3MorphologicalTerm]
|
|
37
|
+
morphological_code: Mapped[ICDO3MorphologicalCode | None]
|
|
38
|
+
morphological_term: Mapped[ICDO3MorphologicalTerm | None]
|
|
40
39
|
cancer_type_description: Mapped[str | None]
|
|
41
|
-
days_since_original_diagnosis: Mapped[NonPositiveInt]
|
|
40
|
+
days_since_original_diagnosis: Mapped[NonPositiveInt | None]
|
|
42
41
|
tumor_grade: Mapped[TumorGrade | None]
|
|
43
42
|
cancer_stage_system: Mapped[CancerStageSystem]
|
|
44
43
|
cancer_stage_system_version: Mapped[CancerStageSystemVersion | None] = mapped_column(String, nullable=True)
|
|
45
|
-
cancer_stage: Mapped[CancerStage] = mapped_column(String)
|
|
46
|
-
t_category: Mapped[TCategory]
|
|
47
|
-
n_category: Mapped[NCategory]
|
|
48
|
-
m_category: Mapped[MCategory]
|
|
49
|
-
metastatic_organ: Mapped[List[UberonAnatomicalTerm]] = mapped_column(JSON, nullable=True)
|
|
44
|
+
cancer_stage: Mapped[CancerStage | None] = mapped_column(String)
|
|
45
|
+
t_category: Mapped[TCategory | None]
|
|
46
|
+
n_category: Mapped[NCategory | None]
|
|
47
|
+
m_category: Mapped[MCategory | None]
|
|
48
|
+
metastatic_organ: Mapped[List[UberonAnatomicalTerm] | None] = mapped_column(JSON, nullable=True)
|
|
50
49
|
solely_extramedullary_disease: Mapped[YNU]
|
|
51
50
|
extramedullary_organ: Mapped[List[UberonAnatomicalTerm]] = mapped_column(JSON, nullable=True)
|
|
52
51
|
|
|
53
|
-
participant: Mapped[
|
|
52
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="diseases", cascade="all, delete")
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
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, ExposureType
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class ExposureORM(BaseORM):
|
|
11
12
|
__tablename__ = "exposure"
|
|
12
13
|
__repr_attrs__ = ["exposure_id", "exposure_type", "carcinogen_exposure"]
|
|
13
|
-
|
|
14
|
+
__data_category__ = "exposure"
|
|
14
15
|
|
|
15
16
|
exposure_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
|
|
|
18
19
|
carcinogen_exposure: Mapped[YNU]
|
|
19
|
-
exposure_type: Mapped[ExposureType]
|
|
20
|
+
exposure_type: Mapped[ExposureType | None]
|
|
20
21
|
|
|
21
|
-
participant: Mapped[
|
|
22
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="exposures", cascade="all, delete")
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from datetime import datetime
|
|
2
|
-
from typing import Optional
|
|
3
3
|
|
|
4
4
|
from sqlalchemy import ForeignKeyConstraint, 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 ChecksumType, FileFormat
|
|
9
9
|
|
|
10
10
|
|
|
@@ -14,17 +14,14 @@ class FileORM(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
|
)
|
|
19
18
|
|
|
20
19
|
file_id: Mapped[int] = mapped_column(primary_key=True)
|
|
21
20
|
trial_id: Mapped[str]
|
|
22
21
|
version: Mapped[str]
|
|
23
22
|
|
|
24
|
-
creator_id: Mapped[
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
description: Mapped[Optional[str]]
|
|
23
|
+
creator_id: Mapped[int | None] = mapped_column(ForeignKey("stage2.institution.institution_id", ondelete="CASCADE"))
|
|
24
|
+
description: Mapped[str | None]
|
|
28
25
|
uuid: Mapped[str]
|
|
29
26
|
file_name: Mapped[str]
|
|
30
27
|
object_url: Mapped[str]
|
|
@@ -34,5 +31,5 @@ class FileORM(BaseORM):
|
|
|
34
31
|
checksum_type: Mapped[ChecksumType]
|
|
35
32
|
file_format: Mapped[FileFormat]
|
|
36
33
|
|
|
37
|
-
trial: Mapped[
|
|
38
|
-
creator: Mapped[
|
|
34
|
+
trial: Mapped[TrialORM] = relationship(back_populates="files", cascade="all, delete")
|
|
35
|
+
creator: Mapped[InstitutionORM | None] = relationship(back_populates="files", cascade="all, delete")
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from typing import List
|
|
2
3
|
|
|
3
4
|
from sqlalchemy import ForeignKey, UniqueConstraint
|
|
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 (
|
|
8
9
|
GVHDDiagnosisAcuteAssessmentSystem,
|
|
9
10
|
GVHDDiagnosisAcuteAssessmentSystemVersion,
|
|
@@ -16,9 +17,9 @@ class GVHDDiagnosisAcuteORM(BaseORM):
|
|
|
16
17
|
__tablename__ = "gvhd_diagnosis_acute"
|
|
17
18
|
__table_args__ = (
|
|
18
19
|
UniqueConstraint("participant_id", "pre_or_post_enrollment", name="unique_ix_gvhd_diagnosis_acute_pre_or_post"),
|
|
19
|
-
{"schema": "stage2"},
|
|
20
20
|
)
|
|
21
21
|
__repr_attrs__ = ["gvhd_diagnosis_acute_id", "pre_or_post_enrollment"]
|
|
22
|
+
__data_category__ = "gvhd_diagnosis_acute"
|
|
22
23
|
|
|
23
24
|
gvhd_diagnosis_acute_id: Mapped[int] = mapped_column(primary_key=True)
|
|
24
25
|
participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
|
|
@@ -27,7 +28,7 @@ class GVHDDiagnosisAcuteORM(BaseORM):
|
|
|
27
28
|
acute_grade: Mapped[GVHDDiagnosisAcuteGrade]
|
|
28
29
|
pre_or_post_enrollment: Mapped[PreOrPostEnrollment]
|
|
29
30
|
|
|
30
|
-
participant: Mapped[
|
|
31
|
-
organs: Mapped[List[
|
|
31
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="gvhd_diagnosis_acutes", cascade="all, delete")
|
|
32
|
+
organs: Mapped[List[GVHDOrganAcuteORM]] = relationship(
|
|
32
33
|
back_populates="diagnosis", cascade="all, delete", passive_deletes=True
|
|
33
34
|
)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from typing import List
|
|
2
3
|
|
|
3
4
|
from sqlalchemy import ForeignKey, UniqueConstraint
|
|
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 (
|
|
8
9
|
GVHDDiagnosisChronicAssessmentSystem,
|
|
9
10
|
GVHDDiagnosisChronicAssessmentSystemVersion,
|
|
@@ -18,9 +19,9 @@ class GVHDDiagnosisChronicORM(BaseORM):
|
|
|
18
19
|
UniqueConstraint(
|
|
19
20
|
"participant_id", "pre_or_post_enrollment", name="unique_ix_gvhd_diagnosis_chronic_pre_or_post"
|
|
20
21
|
),
|
|
21
|
-
{"schema": "stage2"},
|
|
22
22
|
)
|
|
23
23
|
__repr_attrs__ = ["gvhd_diagnosis_chronic_id", "pre_or_post_enrollment"]
|
|
24
|
+
__data_category__ = "gvhd_diagnosis_chronic"
|
|
24
25
|
|
|
25
26
|
gvhd_diagnosis_chronic_id: Mapped[int] = mapped_column(primary_key=True)
|
|
26
27
|
participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
|
|
@@ -29,9 +30,7 @@ class GVHDDiagnosisChronicORM(BaseORM):
|
|
|
29
30
|
chronic_global_severity: Mapped[GVHDDiagnosisChronicGlobalSeverity]
|
|
30
31
|
pre_or_post_enrollment: Mapped[PreOrPostEnrollment]
|
|
31
32
|
|
|
32
|
-
participant: Mapped[
|
|
33
|
-
|
|
34
|
-
)
|
|
35
|
-
organs: Mapped[List["GVHDOrganChronicORM"]] = relationship(
|
|
33
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="gvhd_diagnosis_chronics", cascade="all, delete")
|
|
34
|
+
organs: Mapped[List[GVHDOrganChronicORM]] = relationship(
|
|
36
35
|
back_populates="diagnosis", cascade="all, delete", passive_deletes=True
|
|
37
36
|
)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from sqlalchemy import ForeignKey
|
|
2
3
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
3
4
|
|
|
4
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
5
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
5
6
|
from cidc_api.models.types import GVHDOrgan, GVHDOrganAcuteStage
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class GVHDOrganAcuteORM(BaseORM):
|
|
9
10
|
__tablename__ = "gvhd_organ_acute"
|
|
10
11
|
__repr_attrs__ = ["gvhd_organ_acute_id", "organ"]
|
|
11
|
-
|
|
12
|
+
__data_category__ = "gvhd_organ_acute"
|
|
12
13
|
|
|
13
14
|
gvhd_organ_acute_id: Mapped[int] = mapped_column(primary_key=True)
|
|
14
15
|
gvhd_diagnosis_acute_id: Mapped[int] = mapped_column(
|
|
@@ -17,4 +18,4 @@ class GVHDOrganAcuteORM(BaseORM):
|
|
|
17
18
|
organ: Mapped[GVHDOrgan]
|
|
18
19
|
acute_stage: Mapped[GVHDOrganAcuteStage]
|
|
19
20
|
|
|
20
|
-
diagnosis: Mapped[
|
|
21
|
+
diagnosis: Mapped[GVHDDiagnosisAcuteORM] = relationship(back_populates="organs", cascade="all, delete")
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from sqlalchemy import ForeignKey
|
|
2
3
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
3
4
|
|
|
4
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
5
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
5
6
|
from cidc_api.models.types import GVHDOrgan, GVHDOrganChronicScore
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class GVHDOrganChronicORM(BaseORM):
|
|
9
10
|
__tablename__ = "gvhd_organ_chronic"
|
|
10
11
|
__repr_attrs__ = ["gvhd_organ_chronic_id", "organ"]
|
|
11
|
-
|
|
12
|
+
__data_category__ = "gvhd_organ_chronic"
|
|
12
13
|
|
|
13
14
|
gvhd_organ_chronic_id: Mapped[int] = mapped_column(primary_key=True)
|
|
14
15
|
gvhd_diagnosis_chronic_id: Mapped[int] = mapped_column(
|
|
@@ -17,4 +18,4 @@ class GVHDOrganChronicORM(BaseORM):
|
|
|
17
18
|
organ: Mapped[GVHDOrgan]
|
|
18
19
|
chronic_score: Mapped[GVHDOrganChronicScore]
|
|
19
20
|
|
|
20
|
-
diagnosis: Mapped[
|
|
21
|
+
diagnosis: Mapped[GVHDDiagnosisChronicORM] = relationship(back_populates="organs", cascade="all, delete")
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from typing import List
|
|
2
3
|
|
|
3
4
|
from sqlalchemy import ForeignKeyConstraint
|
|
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 InstitutionORM(BaseORM):
|
|
@@ -13,7 +14,6 @@ class InstitutionORM(BaseORM):
|
|
|
13
14
|
ForeignKeyConstraint(
|
|
14
15
|
["trial_id", "version"], ["stage2.trial.trial_id", "stage2.trial.version"], ondelete="CASCADE"
|
|
15
16
|
),
|
|
16
|
-
{"schema": "stage2"},
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
institution_id: Mapped[int] = mapped_column(primary_key=True)
|
|
@@ -22,12 +22,12 @@ class InstitutionORM(BaseORM):
|
|
|
22
22
|
|
|
23
23
|
name: Mapped[str]
|
|
24
24
|
|
|
25
|
-
trial: Mapped[
|
|
26
|
-
administrative_people: Mapped[List[
|
|
25
|
+
trial: Mapped[TrialORM] = relationship(back_populates="biobank", cascade="all, delete")
|
|
26
|
+
administrative_people: Mapped[List[AdministrativePersonORM]] = relationship(
|
|
27
27
|
back_populates="institution", cascade="all, delete", passive_deletes=True
|
|
28
28
|
)
|
|
29
|
-
shipments: Mapped[List[
|
|
29
|
+
shipments: Mapped[List[ShipmentORM]] = relationship(
|
|
30
30
|
back_populates="institution", cascade="all, delete", passive_deletes=True
|
|
31
31
|
)
|
|
32
|
-
files: Mapped[List[
|
|
33
|
-
contacts: Mapped[List[
|
|
32
|
+
files: Mapped[List[FileORM]] = relationship(back_populates="creator", cascade="all, delete", passive_deletes=True)
|
|
33
|
+
contacts: Mapped[List[ContactORM]] = relationship(back_populates="institution")
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
from
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import List
|
|
2
3
|
|
|
3
4
|
from pydantic import NonNegativeInt, PositiveFloat
|
|
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 TobaccoSmokingStatus
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class MedicalHistoryORM(BaseORM):
|
|
12
13
|
__tablename__ = "medical_history"
|
|
13
14
|
__repr_attrs__ = ["medical_history_id"]
|
|
14
|
-
|
|
15
|
+
__data_category__ = "medical_history"
|
|
15
16
|
|
|
16
17
|
medical_history_id: Mapped[int] = mapped_column(primary_key=True)
|
|
17
18
|
participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
|
|
18
19
|
|
|
19
|
-
tobacco_smoking_status: Mapped[
|
|
20
|
-
pack_years_smoked: Mapped[
|
|
21
|
-
num_prior_systemic_therapies: Mapped[
|
|
20
|
+
tobacco_smoking_status: Mapped[TobaccoSmokingStatus | None]
|
|
21
|
+
pack_years_smoked: Mapped[PositiveFloat | None]
|
|
22
|
+
num_prior_systemic_therapies: Mapped[NonNegativeInt | None]
|
|
22
23
|
|
|
23
|
-
participant: Mapped[
|
|
24
|
-
other_malignancies: Mapped[List[
|
|
24
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="medical_history", cascade="all, delete")
|
|
25
|
+
other_malignancies: Mapped[List[OtherMalignancyORM]] = relationship(
|
|
25
26
|
back_populates="medical_history", cascade="all, delete", passive_deletes=True
|
|
26
27
|
)
|
|
27
|
-
comorbidities: Mapped[List[
|
|
28
|
+
comorbidities: Mapped[List[ComorbidityORM]] = relationship(
|
|
28
29
|
back_populates="medical_history", cascade="all, delete", passive_deletes=True
|
|
29
30
|
)
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from __future__ import annotations
|
|
3
2
|
from sqlalchemy import ForeignKey, String
|
|
4
3
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
5
4
|
|
|
6
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
5
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
7
6
|
from cidc_api.models.types import YNU, ResponseSystem, ResponseSystemVersion
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class OtherClinicalEndpointORM(BaseORM):
|
|
11
10
|
__tablename__ = "other_clinical_endpoint"
|
|
12
11
|
__repr_attrs__ = ["other_clinical_endpoint_id", "name", "event"]
|
|
13
|
-
__table_args__ = {"schema": "stage2"}
|
|
14
12
|
|
|
15
13
|
other_clinical_endpoint_id: Mapped[int] = mapped_column(primary_key=True)
|
|
16
14
|
participant_id: Mapped[int] = mapped_column(ForeignKey("stage2.participant.participant_id", ondelete="CASCADE"))
|
|
17
15
|
|
|
18
16
|
name: Mapped[str]
|
|
19
17
|
event: Mapped[YNU]
|
|
20
|
-
days: Mapped[
|
|
21
|
-
description: Mapped[
|
|
22
|
-
calculation: Mapped[
|
|
23
|
-
response_system: Mapped[
|
|
24
|
-
response_system_version: Mapped[
|
|
18
|
+
days: Mapped[int | None]
|
|
19
|
+
description: Mapped[str | None]
|
|
20
|
+
calculation: Mapped[str | None]
|
|
21
|
+
response_system: Mapped[ResponseSystem | None] = mapped_column(String, nullable=True)
|
|
22
|
+
response_system_version: Mapped[ResponseSystemVersion | None] = mapped_column(String, nullable=True)
|
|
25
23
|
|
|
26
|
-
participant: Mapped[
|
|
27
|
-
back_populates="other_clinical_endpoints", cascade="all, delete"
|
|
28
|
-
)
|
|
24
|
+
participant: Mapped[ParticipantORM] = relationship(back_populates="other_clinical_endpoints", cascade="all, delete")
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from __future__ import annotations
|
|
3
2
|
from pydantic import NonPositiveInt
|
|
4
3
|
from sqlalchemy import ForeignKey
|
|
5
4
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
6
5
|
|
|
7
|
-
from cidc_api.models.db.base_orm import BaseORM
|
|
6
|
+
from cidc_api.models.db.stage2.base_orm import BaseORM
|
|
8
7
|
from cidc_api.models.types import UberonAnatomicalTerm, ICDO3MorphologicalCode, ICDO3MorphologicalTerm, MalignancyStatus
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class OtherMalignancyORM(BaseORM):
|
|
12
11
|
__tablename__ = "other_malignancy"
|
|
13
12
|
__repr_attrs__ = ["other_malignancy_id", "primary_disease_site"]
|
|
14
|
-
|
|
13
|
+
__data_category__ = "other_malignancy"
|
|
15
14
|
|
|
16
15
|
other_malignancy_id: Mapped[int] = mapped_column(primary_key=True)
|
|
17
16
|
medical_history_id: Mapped[int] = mapped_column(
|
|
18
17
|
ForeignKey("stage2.medical_history.medical_history_id", ondelete="CASCADE")
|
|
19
18
|
)
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
other_malignancy_primary_disease_site: Mapped[UberonAnatomicalTerm]
|
|
21
|
+
other_malignancy_morphological_code: Mapped[ICDO3MorphologicalCode | None]
|
|
22
|
+
other_malignancy_morphological_term: Mapped[ICDO3MorphologicalTerm | None]
|
|
23
|
+
other_malignancy_description: Mapped[str | None]
|
|
24
|
+
other_malignancy_days_since_diagnosis: Mapped[NonPositiveInt | None]
|
|
25
|
+
other_malignancy_status: Mapped[MalignancyStatus | None]
|
|
27
26
|
|
|
28
|
-
medical_history: Mapped[
|
|
27
|
+
medical_history: Mapped[MedicalHistoryORM] = relationship(
|
|
29
28
|
back_populates="other_malignancies", cascade="all, delete"
|
|
30
29
|
)
|