nci-cidc-api-modules 1.2.22__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.
- cidc_api/models/db/stage2/__init__.py +78 -0
- cidc_api/models/db/stage2/additional_treatment_orm.py +22 -0
- cidc_api/models/db/stage2/administrative_person_orm.py +25 -0
- cidc_api/models/db/stage2/administrative_role_assignment_orm.py +28 -0
- cidc_api/models/db/stage2/adverse_event_orm.py +47 -0
- cidc_api/models/db/stage2/arm_orm.py +23 -0
- cidc_api/models/db/stage2/baseline_clinical_assessment_orm.py +23 -0
- cidc_api/models/db/stage2/cohort_orm.py +23 -0
- cidc_api/models/db/stage2/comorbidity_orm.py +24 -0
- cidc_api/models/db/stage2/consent_group_orm.py +31 -0
- cidc_api/models/db/stage2/contact_orm.py +32 -0
- cidc_api/models/db/stage2/demographic_orm.py +44 -0
- cidc_api/models/db/stage2/disease_orm.py +53 -0
- cidc_api/models/db/stage2/exposure_orm.py +21 -0
- cidc_api/models/db/stage2/file_orm.py +38 -0
- cidc_api/models/db/stage2/gvhd_diagnosis_acute_orm.py +33 -0
- cidc_api/models/db/stage2/gvhd_diagnosis_chronic_orm.py +37 -0
- cidc_api/models/db/stage2/gvhd_organ_acute_orm.py +20 -0
- cidc_api/models/db/stage2/gvhd_organ_chronic_orm.py +20 -0
- cidc_api/models/db/stage2/institution_orm.py +33 -0
- cidc_api/models/db/stage2/medical_history_orm.py +29 -0
- cidc_api/models/db/stage2/other_clinical_endpoint_orm.py +28 -0
- cidc_api/models/db/stage2/other_malignancy_orm.py +30 -0
- cidc_api/models/db/stage2/participant_orm.py +79 -0
- cidc_api/models/db/stage2/prior_treatment_orm.py +28 -0
- cidc_api/models/db/stage2/publication_orm.py +31 -0
- cidc_api/models/db/stage2/radiotherapy_dose_orm.py +39 -0
- cidc_api/models/db/stage2/response_by_system_orm.py +28 -0
- cidc_api/models/db/stage2/response_orm.py +27 -0
- cidc_api/models/db/stage2/shipment_orm.py +47 -0
- cidc_api/models/db/stage2/shipment_specimen_orm.py +24 -0
- cidc_api/models/db/stage2/specimen_orm.py +100 -0
- cidc_api/models/db/stage2/stem_cell_transplant_orm.py +25 -0
- cidc_api/models/db/stage2/surgery_orm.py +27 -0
- cidc_api/models/db/stage2/therapy_agent_dose_orm.py +31 -0
- cidc_api/models/db/stage2/treatment_orm.py +39 -0
- cidc_api/models/db/stage2/trial_orm.py +60 -0
- cidc_api/models/pydantic/stage2/__init__.py +78 -0
- cidc_api/models/pydantic/stage2/additional_treatment.py +23 -0
- cidc_api/models/pydantic/stage2/administrative_person.py +30 -0
- cidc_api/models/pydantic/stage2/administrative_role_assignment.py +16 -0
- cidc_api/models/pydantic/stage2/adverse_event.py +100 -0
- cidc_api/models/pydantic/stage2/arm.py +16 -0
- cidc_api/models/pydantic/stage2/base.py +30 -0
- cidc_api/models/pydantic/stage2/baseline_clinical_assessment.py +23 -0
- cidc_api/models/pydantic/stage2/cohort.py +16 -0
- cidc_api/models/pydantic/stage2/comorbidity.py +36 -0
- cidc_api/models/pydantic/stage2/consent_group.py +30 -0
- cidc_api/models/pydantic/stage2/contact.py +35 -0
- cidc_api/models/pydantic/stage2/demographic.py +114 -0
- cidc_api/models/pydantic/stage2/disease.py +144 -0
- cidc_api/models/pydantic/stage2/exposure.py +32 -0
- cidc_api/models/pydantic/stage2/file.py +44 -0
- cidc_api/models/pydantic/stage2/gvhd_diagnosis_acute.py +33 -0
- cidc_api/models/pydantic/stage2/gvhd_diagnosis_chronic.py +32 -0
- cidc_api/models/pydantic/stage2/gvhd_organ_acute.py +22 -0
- cidc_api/models/pydantic/stage2/gvhd_organ_chronic.py +23 -0
- cidc_api/models/pydantic/stage2/institution.py +10 -0
- cidc_api/models/pydantic/stage2/medical_history.py +36 -0
- cidc_api/models/pydantic/stage2/other_clinical_endpoint.py +32 -0
- cidc_api/models/pydantic/stage2/other_malignancy.py +45 -0
- cidc_api/models/pydantic/stage2/participant.py +47 -0
- cidc_api/models/pydantic/stage2/prior_treatment.py +52 -0
- cidc_api/models/pydantic/stage2/publication.py +37 -0
- cidc_api/models/pydantic/stage2/radiotherapy_dose.py +79 -0
- cidc_api/models/pydantic/stage2/response.py +71 -0
- cidc_api/models/pydantic/stage2/response_by_system.py +109 -0
- cidc_api/models/pydantic/stage2/shipment.py +48 -0
- cidc_api/models/pydantic/stage2/shipment_specimen.py +15 -0
- cidc_api/models/pydantic/stage2/specimen.py +211 -0
- cidc_api/models/pydantic/stage2/stem_cell_transplant.py +35 -0
- cidc_api/models/pydantic/stage2/surgery.py +49 -0
- cidc_api/models/pydantic/stage2/therapy_agent_dose.py +67 -0
- cidc_api/models/pydantic/stage2/treatment.py +50 -0
- cidc_api/models/pydantic/stage2/trial.py +85 -0
- {nci_cidc_api_modules-1.2.22.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/METADATA +1 -1
- nci_cidc_api_modules-1.2.24.dist-info/RECORD +104 -0
- nci_cidc_api_modules-1.2.22.dist-info/RECORD +0 -29
- {nci_cidc_api_modules-1.2.22.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/WHEEL +0 -0
- {nci_cidc_api_modules-1.2.22.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/licenses/LICENSE +0 -0
- {nci_cidc_api_modules-1.2.22.dist-info → nci_cidc_api_modules-1.2.24.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from sqlalchemy import ForeignKey
|
|
5
|
+
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
6
|
+
from sqlalchemy.types import JSON
|
|
7
|
+
|
|
8
|
+
from cidc_api.models.db.base_orm import BaseORM
|
|
9
|
+
from cidc_api.models.types import TrialStatus, AssayType, TrialOrganization, TrialFundingAgency
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TrialORM(BaseORM):
|
|
13
|
+
__tablename__ = "trial"
|
|
14
|
+
__repr_attrs__ = ["trial_id", "version"]
|
|
15
|
+
__table_args__ = {"schema": "stage2"}
|
|
16
|
+
|
|
17
|
+
trial_id: Mapped[str] = mapped_column(primary_key=True)
|
|
18
|
+
version: Mapped[str] = mapped_column(primary_key=True)
|
|
19
|
+
|
|
20
|
+
nct_id: Mapped[Optional[str]]
|
|
21
|
+
nci_id: Mapped[Optional[str]]
|
|
22
|
+
trial_name: Mapped[Optional[str]]
|
|
23
|
+
trial_type: Mapped[Optional[str]]
|
|
24
|
+
trial_description: Mapped[Optional[str]]
|
|
25
|
+
trial_organization: Mapped[Optional[TrialOrganization]]
|
|
26
|
+
grant_or_affiliated_network: Mapped[Optional[TrialFundingAgency]]
|
|
27
|
+
trial_status: Mapped[TrialStatus]
|
|
28
|
+
biobank_institution_id: Mapped[Optional[int]]
|
|
29
|
+
justification: Mapped[Optional[str]]
|
|
30
|
+
dates_of_conduct_start: Mapped[datetime]
|
|
31
|
+
dates_of_conduct_end: Mapped[Optional[datetime]]
|
|
32
|
+
schema_file_id: Mapped[Optional[int]]
|
|
33
|
+
biomarker_plan: Mapped[Optional[str]]
|
|
34
|
+
data_sharing_plan: Mapped[Optional[str]]
|
|
35
|
+
expected_assays: Mapped[Optional[List[AssayType]]] = mapped_column(JSON, nullable=True)
|
|
36
|
+
is_liquid_tumor_trial: Mapped[bool]
|
|
37
|
+
dbgap_study_accession: Mapped[Optional[str]]
|
|
38
|
+
|
|
39
|
+
biobank: Mapped["InstitutionORM"] = relationship(back_populates="trial")
|
|
40
|
+
schema: Mapped[Optional["FileORM"]] = relationship(back_populates="trial", viewonly=True)
|
|
41
|
+
administrative_role_assignments: Mapped[List["AdministrativeRoleAssignmentORM"]] = relationship(
|
|
42
|
+
back_populates="trial", cascade="all, delete", passive_deletes=True
|
|
43
|
+
)
|
|
44
|
+
arms: Mapped[List["ArmORM"]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
|
|
45
|
+
cohorts: Mapped[List["CohortORM"]] = relationship(
|
|
46
|
+
back_populates="trial", cascade="all, delete", passive_deletes=True
|
|
47
|
+
)
|
|
48
|
+
participants: Mapped[List["ParticipantORM"]] = relationship(
|
|
49
|
+
back_populates="trial", cascade="all, delete", passive_deletes=True
|
|
50
|
+
)
|
|
51
|
+
shipments: Mapped[List["ShipmentORM"]] = relationship(
|
|
52
|
+
back_populates="trial", cascade="all, delete", passive_deletes=True
|
|
53
|
+
)
|
|
54
|
+
files: Mapped[List["FileORM"]] = relationship(back_populates="trial", cascade="all, delete", passive_deletes=True)
|
|
55
|
+
publications: Mapped[List["PublicationORM"]] = relationship(
|
|
56
|
+
back_populates="trial", cascade="all, delete", passive_deletes=True
|
|
57
|
+
)
|
|
58
|
+
consent_groups: Mapped[List["ConsentGroupORM"]] = relationship(
|
|
59
|
+
back_populates="trial", cascade="all, delete", passive_deletes=True
|
|
60
|
+
)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from .additional_treatment import AdditionalTreatment
|
|
2
|
+
from .administrative_person import AdministrativePerson
|
|
3
|
+
from .administrative_role_assignment import AdministrativeRoleAssignment
|
|
4
|
+
from .adverse_event import AdverseEvent
|
|
5
|
+
from .arm import Arm
|
|
6
|
+
from .baseline_clinical_assessment import BaselineClinicalAssessment
|
|
7
|
+
from .cohort import Cohort
|
|
8
|
+
from .comorbidity import Comorbidity
|
|
9
|
+
from .consent_group import ConsentGroup
|
|
10
|
+
from .contact import Contact
|
|
11
|
+
from .demographic import Demographic
|
|
12
|
+
from .disease import Disease
|
|
13
|
+
from .exposure import Exposure
|
|
14
|
+
from .file import File
|
|
15
|
+
from .gvhd_diagnosis_acute import GVHDDiagnosisAcute
|
|
16
|
+
from .gvhd_diagnosis_chronic import GVHDDiagnosisChronic
|
|
17
|
+
from .gvhd_organ_acute import GVHDOrganAcute
|
|
18
|
+
from .gvhd_organ_chronic import GVHDOrganChronic
|
|
19
|
+
from .institution import Institution
|
|
20
|
+
from .medical_history import MedicalHistory
|
|
21
|
+
from .other_clinical_endpoint import OtherClinicalEndpoint
|
|
22
|
+
from .other_malignancy import OtherMalignancy
|
|
23
|
+
from .participant import Participant
|
|
24
|
+
from .prior_treatment import PriorTreatment
|
|
25
|
+
from .publication import Publication
|
|
26
|
+
from .radiotherapy_dose import RadiotherapyDose
|
|
27
|
+
from .response import Response
|
|
28
|
+
from .response_by_system import ResponseBySystem
|
|
29
|
+
from .shipment import Shipment
|
|
30
|
+
from .shipment_specimen import ShipmentSpecimen
|
|
31
|
+
from .specimen import Specimen
|
|
32
|
+
from .stem_cell_transplant import StemCellTransplant
|
|
33
|
+
from .surgery import Surgery
|
|
34
|
+
from .therapy_agent_dose import TherapyAgentDose
|
|
35
|
+
from .treatment import Treatment
|
|
36
|
+
from .trial import Trial
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"AdditionalTreatment",
|
|
41
|
+
"AdministrativePerson",
|
|
42
|
+
"AdministrativeRoleAssignment",
|
|
43
|
+
"AdverseEvent",
|
|
44
|
+
"Arm",
|
|
45
|
+
"BaselineClinicalAssessment",
|
|
46
|
+
"Cohort",
|
|
47
|
+
"Comorbidity",
|
|
48
|
+
"ConsentGroup",
|
|
49
|
+
"Contact",
|
|
50
|
+
"Demographic",
|
|
51
|
+
"Disease",
|
|
52
|
+
"Exposure",
|
|
53
|
+
"File",
|
|
54
|
+
"GVHDDiagnosisAcute",
|
|
55
|
+
"GVHDOrganAcute",
|
|
56
|
+
"GVHDDiagnosisChronic",
|
|
57
|
+
"GVHDOrganChronic",
|
|
58
|
+
"Institution",
|
|
59
|
+
"MedicalHistory",
|
|
60
|
+
"OtherClinicalEndpoint",
|
|
61
|
+
"OtherMalignancy",
|
|
62
|
+
"Participant",
|
|
63
|
+
"PriorTreatment",
|
|
64
|
+
"Publication",
|
|
65
|
+
"RadiotherapyDose",
|
|
66
|
+
"Response",
|
|
67
|
+
"ResponseBySystem",
|
|
68
|
+
"Shipment",
|
|
69
|
+
"ShipmentSpecimen",
|
|
70
|
+
"Specimen",
|
|
71
|
+
"StemCellTransplant",
|
|
72
|
+
"Surgery",
|
|
73
|
+
"TherapyAgentDose",
|
|
74
|
+
"Treatment",
|
|
75
|
+
"Trial",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
all_models = [globals()[cls_name] for cls_name in __all__]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from pydantic import NonNegativeInt
|
|
2
|
+
from .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: int | None = None
|
|
14
|
+
|
|
15
|
+
# Number of days from the enrollment date to the first recorded administration or occurrence of the treatment modality.
|
|
16
|
+
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
|
+
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
|
+
description: str
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from .base import Base
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AdministrativePerson(Base):
|
|
5
|
+
|
|
6
|
+
# The unique internal identifier for the administrative person
|
|
7
|
+
administrative_person_id: int | None = None
|
|
8
|
+
|
|
9
|
+
# The internal identifier for the Institution the administrative person belongs to
|
|
10
|
+
institution_id: int | None = None
|
|
11
|
+
|
|
12
|
+
# The word or group of words indicating a person's first (personal or given) name, e.g. "John"
|
|
13
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179589%20and%20ver_nr=2
|
|
14
|
+
first_name: str
|
|
15
|
+
|
|
16
|
+
# The word or group of worlds indicating a person's middle name, e.g. "Alan"
|
|
17
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179590%20and%20ver_nr=2
|
|
18
|
+
middle_name: str | None = None
|
|
19
|
+
|
|
20
|
+
# The means of identifying an individual by using a word or group of words indicating a person's last (family) name, e.g. "Smith"
|
|
21
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179591%20and%20ver_nr=2
|
|
22
|
+
last_name: str
|
|
23
|
+
|
|
24
|
+
# The string of characters that represents the electronic mail address of a person.
|
|
25
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2517550%20and%20ver_nr=1
|
|
26
|
+
email: str | None = None
|
|
27
|
+
|
|
28
|
+
# The string of digits that represent a telephone number that can be used to contact the person.
|
|
29
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179593%20and%20ver_nr=3
|
|
30
|
+
phone_number: str | None = None
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .base import Base
|
|
2
|
+
from cidc_api.models.types import AdministrativeRole
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AdministrativeRoleAssignment(Base):
|
|
6
|
+
# The unique identifier for the associated trial
|
|
7
|
+
trial_id: int | None = None
|
|
8
|
+
|
|
9
|
+
# The version number of the trial dataset
|
|
10
|
+
version: str | None = None
|
|
11
|
+
|
|
12
|
+
# The unique identifier for the associated administrative person
|
|
13
|
+
administrative_person_id: int
|
|
14
|
+
|
|
15
|
+
# The role the administrative_person is performing for the associated trial
|
|
16
|
+
administrative_role: AdministrativeRole
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
from typing import Self
|
|
2
|
+
|
|
3
|
+
from pydantic import NonNegativeInt, model_validator
|
|
4
|
+
|
|
5
|
+
from .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: int | 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,16 @@
|
|
|
1
|
+
from .base import Base
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Arm(Base):
|
|
5
|
+
# The unique internal identifier for the arm
|
|
6
|
+
arm_id: int | None = None
|
|
7
|
+
|
|
8
|
+
# The unique identifier for the associated trial
|
|
9
|
+
trial_id: int | None = None
|
|
10
|
+
|
|
11
|
+
# The version number of the trial dataset
|
|
12
|
+
version: str | None = None
|
|
13
|
+
|
|
14
|
+
# The name of the arm, e.g. "Arm A1"
|
|
15
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2001626%20and%20ver_nr=3
|
|
16
|
+
name: str
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from pydantic import BaseModel, ConfigDict
|
|
2
|
+
from contextlib import contextmanager
|
|
3
|
+
|
|
4
|
+
import copy
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Base(BaseModel):
|
|
8
|
+
|
|
9
|
+
model_config = ConfigDict(validate_assignment=True, from_attributes=True)
|
|
10
|
+
|
|
11
|
+
# Validates the new state and updates the object if valid
|
|
12
|
+
def update(self, **kwargs):
|
|
13
|
+
self.model_validate(self.__dict__ | kwargs)
|
|
14
|
+
self.__dict__.update(kwargs)
|
|
15
|
+
|
|
16
|
+
# CM that delays validation until all fields are applied.
|
|
17
|
+
# If validation fails the original fields are restored and the ValidationError is raised.
|
|
18
|
+
@contextmanager
|
|
19
|
+
def delay_validation(self):
|
|
20
|
+
original_dict = copy.deepcopy(self.__dict__)
|
|
21
|
+
self.model_config["validate_assignment"] = False
|
|
22
|
+
try:
|
|
23
|
+
yield
|
|
24
|
+
finally:
|
|
25
|
+
self.model_config["validate_assignment"] = True
|
|
26
|
+
try:
|
|
27
|
+
self.model_validate(self.__dict__)
|
|
28
|
+
except:
|
|
29
|
+
self.__dict__.update(original_dict)
|
|
30
|
+
raise
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from .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: int | 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,16 @@
|
|
|
1
|
+
from .base import Base
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Cohort(Base):
|
|
5
|
+
# A unique internal identifier for the cohort
|
|
6
|
+
cohort_id: int | None = None
|
|
7
|
+
|
|
8
|
+
# The unique identifier for the associated trial
|
|
9
|
+
trial_id: str | None = None
|
|
10
|
+
|
|
11
|
+
# The version number of the trial dataset
|
|
12
|
+
version: str | None = None
|
|
13
|
+
|
|
14
|
+
# The name of the cohort, e.g. "Cohort A"
|
|
15
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=7979585%20and%20ver_nr=1
|
|
16
|
+
name: str
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import Self
|
|
2
|
+
|
|
3
|
+
from pydantic import model_validator
|
|
4
|
+
|
|
5
|
+
from .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 .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: int | 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
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from .base import Base
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Contact(Base):
|
|
5
|
+
contact_id: int | None = None
|
|
6
|
+
institution_id: int | None = None
|
|
7
|
+
shipment_from_id: int | None = None
|
|
8
|
+
shipment_to_id: int | None = None
|
|
9
|
+
|
|
10
|
+
# The name of the contact
|
|
11
|
+
name: str | None = None
|
|
12
|
+
|
|
13
|
+
# The email address of the contact
|
|
14
|
+
email: str | None = None
|
|
15
|
+
|
|
16
|
+
# The phone number of the contact
|
|
17
|
+
phone: str | None = None
|
|
18
|
+
|
|
19
|
+
# Line 1 of the street address of the contact
|
|
20
|
+
street1: str | None = None
|
|
21
|
+
|
|
22
|
+
# Line 2 of the street address of the contact
|
|
23
|
+
street2: str | None = None
|
|
24
|
+
|
|
25
|
+
# The city where the contact is located
|
|
26
|
+
city: str | None = None
|
|
27
|
+
|
|
28
|
+
# The state where the contact is located
|
|
29
|
+
state: str | None = None
|
|
30
|
+
|
|
31
|
+
# The zip code where the contact is located
|
|
32
|
+
zip: str | None = None
|
|
33
|
+
|
|
34
|
+
# The country where the contact is located
|
|
35
|
+
country: str | None = None
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from typing import Self
|
|
2
|
+
|
|
3
|
+
from pydantic import PositiveInt, NonNegativeFloat, PositiveFloat, model_validator, field_validator
|
|
4
|
+
|
|
5
|
+
from .base import Base
|
|
6
|
+
from cidc_api.models.types import (
|
|
7
|
+
Sex,
|
|
8
|
+
Race,
|
|
9
|
+
Ethnicity,
|
|
10
|
+
HeightUnits,
|
|
11
|
+
WeightUnits,
|
|
12
|
+
BodySurfaceAreaUnits,
|
|
13
|
+
Occupation,
|
|
14
|
+
Education,
|
|
15
|
+
AgeAtEnrollmentUnits,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Demographic(Base):
|
|
20
|
+
__data_category__ = "demographic"
|
|
21
|
+
__cardinality__ = "one"
|
|
22
|
+
|
|
23
|
+
# The unique internal identifier for this demographic record
|
|
24
|
+
demographic_id: int | None = None
|
|
25
|
+
|
|
26
|
+
# The unique internal identifier for the associated participant
|
|
27
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=12220014%20and%20ver_nr=1
|
|
28
|
+
participant_id: int | None = None
|
|
29
|
+
|
|
30
|
+
# The age of the subject when the subject enrolled in the study.
|
|
31
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15742605%20and%20ver_nr=1
|
|
32
|
+
age_at_enrollment: PositiveInt | None = None
|
|
33
|
+
|
|
34
|
+
# Unit of measurement for the age of the participant. e.g. "Years"
|
|
35
|
+
age_at_enrollment_units: AgeAtEnrollmentUnits | None = None
|
|
36
|
+
|
|
37
|
+
# Indicates whether the participant is 90 years old or older. (for PHI purposes)
|
|
38
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15354920%20and%20ver_nr=1
|
|
39
|
+
age_90_or_older: bool
|
|
40
|
+
|
|
41
|
+
# A textual description of a person's sex at birth. e.g. "Male"
|
|
42
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=7572817%20and%20ver_nr=3
|
|
43
|
+
sex: Sex
|
|
44
|
+
|
|
45
|
+
# The race of the participant. e.g. "White"
|
|
46
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2192199%20and%20ver_nr=1
|
|
47
|
+
race: Race
|
|
48
|
+
|
|
49
|
+
# The ethnicity of the participant. e.g. "Hispanic or Latino"
|
|
50
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2192217%20and%20ver_nr=2
|
|
51
|
+
ethnicity: Ethnicity
|
|
52
|
+
|
|
53
|
+
# The number that describes the vertical distance of the participant at enrollment date.
|
|
54
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179643%20and%20ver_nr=4
|
|
55
|
+
height: PositiveFloat
|
|
56
|
+
|
|
57
|
+
# Unit of measurement for the height of the participant at the enrollment date. e.g. "in"
|
|
58
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2538920%20and%20ver_nr=1
|
|
59
|
+
height_units: HeightUnits
|
|
60
|
+
|
|
61
|
+
# The mass of the participant's entire body at the enrollment date.
|
|
62
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2179689%20and%20ver_nr=4
|
|
63
|
+
weight: PositiveFloat
|
|
64
|
+
|
|
65
|
+
# Unit of measurement for the weight of the participant at the enrollment date. e.g. "kg"
|
|
66
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2630200%20and%20ver_nr=1
|
|
67
|
+
weight_units: WeightUnits
|
|
68
|
+
|
|
69
|
+
# The body mass index of the participant at the enrollment date.
|
|
70
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2006410%20and%20ver_nr=3
|
|
71
|
+
body_mass_index: PositiveFloat
|
|
72
|
+
|
|
73
|
+
# A decimal number that represents the measure of the 2-dimensional extent of the body surface (i.e., the skin) of the participant at the enrollment date.
|
|
74
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6606197%20and%20ver_nr=1
|
|
75
|
+
body_surface_area: PositiveFloat
|
|
76
|
+
|
|
77
|
+
# Unit of measurement for body surface area of the participant at the enrollment date. e.g. "m2"
|
|
78
|
+
# https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=15114329%20and%20ver_nr=1
|
|
79
|
+
body_surface_area_units: BodySurfaceAreaUnits
|
|
80
|
+
|
|
81
|
+
# The occupation/job category of the participant. e.g. "Manager"
|
|
82
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=6617540%20and%20ver_nr=1
|
|
83
|
+
occupation: Occupation | None = None
|
|
84
|
+
|
|
85
|
+
# The amount of earnings in USD made by the participant's family in a year.
|
|
86
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=14834966%20and%20ver_nr=1
|
|
87
|
+
income: NonNegativeFloat | None = None
|
|
88
|
+
|
|
89
|
+
# The highest level of education attained by the participant. e.g. "Bachelor's Degree"
|
|
90
|
+
# CDE: https://cadsr.cancer.gov/onedata/dmdirect/NIH/NCI/CO/CDEDD?filter=CDEDD.ITEM_ID=2681552%20and%20ver_nr=1
|
|
91
|
+
highest_level_of_education: Education | None = None
|
|
92
|
+
|
|
93
|
+
@model_validator(mode="after")
|
|
94
|
+
def validate_age_at_enrollment_cr(self) -> Self:
|
|
95
|
+
if self.age_90_or_older:
|
|
96
|
+
if self.age_at_enrollment or self.age_at_enrollment_units:
|
|
97
|
+
raise ValueError(
|
|
98
|
+
'If "age_90_or_older" is "Yes" then "age_at_enrollment" and "age_at_enrollment_units" must be blank.'
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
if not self.age_at_enrollment or not self.age_at_enrollment_units:
|
|
102
|
+
raise ValueError(
|
|
103
|
+
'If "age_90_or_older" is "No" then "age_at_enrollment" and "age_at_enrollment_units" are required.'
|
|
104
|
+
)
|
|
105
|
+
return self
|
|
106
|
+
|
|
107
|
+
@model_validator(mode="after")
|
|
108
|
+
def validate_age_at_enrollment_value(self) -> Self:
|
|
109
|
+
age_in_years = (
|
|
110
|
+
self.age_at_enrollment if self.age_at_enrollment_units == "Years" else self.age_at_enrollment / 365.25
|
|
111
|
+
)
|
|
112
|
+
if age_in_years >= 90:
|
|
113
|
+
raise ValueError('"age_at_enrollment" cannot represent a value greater than 90 years of age.')
|
|
114
|
+
return self
|