Ejemplo n.º 1
0
class BaseStudyTerminationConclusion(ActionModelMixin, models.Model):
    last_study_fu_date = models.DateField(
        verbose_name="Date of last research follow up (if different):",
        validators=[date_not_future],
        blank=True,
        null=True,
    )

    death_date = models.DateField(
        verbose_name="Date of Death",
        validators=[date_not_future],
        blank=True,
        null=True,
    )

    consent_withdrawal_reason = models.CharField(
        verbose_name="Reason for withdrawing consent",
        max_length=75,
        blank=True,
        null=True,
    )

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    def natural_key(self):
        return (self.action_identifier,)

    class Meta:
        abstract = True
class AesiModelMixin(
        NonUniqueSubjectIdentifierFieldMixin,
        AesiFieldsModelMixin,
        AesiMethodsModelMixin,
        ReportStatusModelMixin,
        SiteModelMixin,
        ActionModelMixin,
        TrackingModelMixin,
        models.Model,
):

    action_name = AESI_ACTION

    tracking_identifier_prefix = "AI"

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    class Meta:
        abstract = True
        verbose_name = "AE of Special Interest Report"
        indexes = [
            models.Index(fields=[
                "subject_identifier", "action_identifier", "site", "id"
            ])
        ]
class AeFollowupModelMixin(
        NonUniqueSubjectIdentifierFieldMixin,
        AeFollowupFieldsModelMixin,
        AeFollowupMethodsModelMixin,
        SiteModelMixin,
        ActionModelMixin,
        TrackingModelMixin,
        models.Model,
):

    action_name = AE_FOLLOWUP_ACTION

    tracking_identifier_prefix = "AF"

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    class Meta:
        abstract = True
        verbose_name = "AE Follow-up Report"
        indexes = [
            models.Index(fields=[
                "subject_identifier", "action_identifier", "site", "id"
            ])
        ]
class AeTmgModelMixin(
        NonUniqueSubjectIdentifierFieldMixin,
        AeTmgFieldsModelMixin,
        AeTmgMethodsModelMixin,
        ReportStatusModelMixin,
        SearchSlugModelMixin,
        SiteModelMixin,
        ActionModelMixin,
        TrackingModelMixin,
        models.Model,
):

    action_name = AE_TMG_ACTION

    tracking_identifier_prefix = "AT"

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    class Meta:
        abstract = True
        verbose_name = "AE TMG Report"
        indexes = [
            models.Index(fields=[
                "subject_identifier", "action_identifier", "site", "id"
            ])
        ]
Ejemplo n.º 5
0
class AeInitialModelMixin(
    NonUniqueSubjectIdentifierFieldMixin,
    AeInitialFieldsModelMixin,
    AeInitialMethodsModelMixin,
    AeInitialAeModelMixin,
    AeInitialSaeModelMixin,
    AeInitialSusarModelMixin,
    AeInitialTmgModelMixin,
    SiteModelMixin,
    ActionModelMixin,
    TrackingModelMixin,
    models.Model,
):

    action_name = AE_INITIAL_ACTION

    tracking_identifier_prefix = "AE"

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    class Meta:
        abstract = True
        verbose_name = "AE Initial Report"
        indexes = [
            models.Index(fields=["subject_identifier", "action_identifier", "site", "id"])
        ]
Ejemplo n.º 6
0
class SimpleDeathReportModelMixin(
        UniqueSubjectIdentifierFieldMixin,
        SiteModelMixin,
        ActionModelMixin,
        TrackingModelMixin,
        models.Model,
):

    action_name = DEATH_REPORT_ACTION

    death_date_field = "death_date"

    tracking_identifier_prefix = "DR"

    report_datetime = models.DateTimeField(
        verbose_name="Report Date",
        validators=[datetime_not_before_study_start, datetime_not_future],
        default=get_utcnow,
    )

    death_datetime = models.DateTimeField(
        validators=[datetime_not_future],
        verbose_name="Date and Time of Death",
        null=True,
        blank=False,
    )

    death_date = models.DateField(
        validators=[date_not_future],
        verbose_name="Date of Death",
        null=True,
        blank=False,
    )

    narrative = models.TextField(verbose_name="Narrative")

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    def natural_key(self):
        return (self.action_identifier, )

    class Meta:
        abstract = True
        verbose_name = "Death Report"
        verbose_name_plural = "Death Reports"
        indexes = [
            models.Index(fields=[
                "subject_identifier", "action_identifier", "site", "id"
            ])
        ]
Ejemplo n.º 7
0
class ProtocolDeviationViolation(
    NonUniqueSubjectIdentifierFieldMixin,
    SiteModelMixin,
    ActionModelMixin,
    TrackingModelMixin,
    edc_models.BaseUuidModel,
):

    action_name = PROTOCOL_DEVIATION_VIOLATION_ACTION

    tracking_identifier_prefix = "PD"

    report_datetime = models.DateTimeField(
        verbose_name="Report Date and Time", default=get_utcnow
    )

    short_description = models.CharField(
        verbose_name="Provide a short description of this occurrence",
        max_length=35,
        null=True,
        blank=False,
        help_text=(
            'Max 35 characters. Note: If this occurrence is a "violation" '
            "there is additional space below for a more detailed "
            "description"
        ),
    )

    report_type = models.CharField(
        verbose_name="Type of occurrence", max_length=25, choices=DEVIATION_VIOLATION
    )

    safety_impact = models.CharField(
        verbose_name="Could this occurrence have an impact on safety of the " "participant?",
        max_length=25,
        choices=YES_NO,
    )

    safety_impact_details = models.TextField(
        verbose_name='If "Yes", provide details', null=True, blank=True
    )

    study_outcomes_impact = models.CharField(
        verbose_name="Could this occurrence have an impact on study outcomes?",
        max_length=25,
        choices=YES_NO,
    )

    study_outcomes_impact_details = models.TextField(
        verbose_name='If "Yes", provide details', null=True, blank=True
    )

    violation_datetime = models.DateTimeField(
        verbose_name="Date violation occurred",
        validators=[edc_models.datetime_not_future],
        null=True,
        blank=True,
    )

    violation_type = models.CharField(
        verbose_name="Type of violation",
        max_length=75,
        choices=PROTOCOL_VIOLATION,
        default=NOT_APPLICABLE,
    )

    violation_type_other = models.CharField(
        null=True, blank=True, verbose_name="If other, please specify", max_length=75
    )

    violation_description = models.TextField(
        verbose_name="Describe the violation",
        null=True,
        blank=True,
        help_text=(
            "Describe in full. Explain how the violation " "happened, what occurred, etc."
        ),
    )

    violation_reason = models.TextField(
        verbose_name="Explain the reason why the violation occurred",
        null=True,
        blank=True,
    )

    corrective_action_datetime = models.DateTimeField(
        verbose_name="Corrective action date and time",
        validators=[edc_models.datetime_not_future],
        null=True,
        blank=True,
    )

    corrective_action = models.TextField(
        verbose_name="Corrective action taken", null=True, blank=True
    )

    preventative_action_datetime = models.DateTimeField(
        verbose_name="Preventative action date and time",
        validators=[edc_models.datetime_not_future],
        null=True,
        blank=True,
    )

    preventative_action = models.TextField(
        verbose_name="Preventative action taken", null=True, blank=True
    )

    action_required = models.CharField(max_length=45, choices=ACTION_REQUIRED)

    report_status = models.CharField(
        verbose_name="What is the status of this report?",
        max_length=25,
        choices=REPORT_STATUS,
    )

    report_closed_datetime = models.DateTimeField(
        blank=True,
        null=True,
        validators=[edc_models.datetime_not_future],
        verbose_name="Date and time report closed.",
    )

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    def natural_key(self):
        return (self.action_identifier,)

    class Meta(edc_models.BaseUuidModel.Meta):
        verbose_name = "Protocol Deviation/Violation"
        verbose_name_plural = "Protocol Deviations/Violations"
        indexes = [
            models.Index(fields=["subject_identifier", "action_identifier", "site", "id"])
        ]
Ejemplo n.º 8
0
class DeathReportModelMixin(
    UniqueSubjectIdentifierFieldMixin,
    SiteModelMixin,
    ActionNoManagersModelMixin,
    TrackingModelMixin,
    models.Model,
):

    action_name = DEATH_REPORT_ACTION

    death_date_field = "death_datetime"

    tracking_identifier_prefix = "DR"

    report_datetime = models.DateTimeField(
        verbose_name="Report Date",
        validators=[datetime_not_before_study_start, datetime_not_future],
        default=get_utcnow,
    )

    death_datetime = models.DateTimeField(
        validators=[datetime_not_future],
        verbose_name="Date and Time of Death",
        null=True,
        blank=False,
    )

    death_date = models.DateField(
        validators=[date_not_future],
        verbose_name="Date of Death",
        null=True,
        blank=False,
    )

    study_day = models.IntegerField(
        validators=[MinValueValidator(1)],
        verbose_name="Study day",
        null=True,
        blank=False,
    )

    death_as_inpatient = models.CharField(
        choices=YES_NO,
        max_length=5,
        verbose_name="Death as inpatient",
        null=True,
        blank=False,
    )

    cause_of_death = models.ForeignKey(
        CauseOfDeath,
        on_delete=PROTECT,
        verbose_name="Main cause of death",
        help_text=(
            "Main cause of death in the opinion of the " "local study doctor and local PI"
        ),
        null=True,
        blank=False,
    )

    cause_of_death_other = OtherCharField(max_length=100, blank=True, null=True)

    narrative = models.TextField(verbose_name="Narrative", blank=False, null=True)

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    history = HistoricalRecords(inherit=True)

    def natural_key(self):
        return tuple(
            self.action_identifier,
        )

    natural_key.dependencies = ["edc_adverse_event.causeofdeath"]

    class Meta:
        abstract = True
        verbose_name = "Death Report"
        indexes = [
            models.Index(fields=["subject_identifier", "action_identifier", "site", "id"])
        ]
class RecurrenceSymptom(
        NonUniqueSubjectIdentifierFieldMixin,
        ActionModelMixin,
        TrackingModelMixin,
        SiteModelMixin,
        BaseUuidModel,
):

    tracking_identifier_prefix = "RS"

    action_name = RECURRENCE_OF_SYMPTOMS_ACTION

    report_datetime = models.DateTimeField(verbose_name="Report Date and Time",
                                           default=get_utcnow)

    meningitis_symptom = models.ManyToManyField(
        MeningitisSymptom, verbose_name="What are your current symptoms?")

    meningitis_symptom_other = models.CharField(
        verbose_name="If other symptom, please specify",
        max_length=50,
        null=True,
        blank=True,
    )

    patient_readmitted = models.CharField(
        verbose_name=(
            "Has the patient been re-admitted due to these recurrent symptoms?"
        ),
        max_length=5,
        choices=YES_NO,
    )

    glasgow_coma_score = models.IntegerField(
        verbose_name="Score:",
        validators=[MinValueValidator(3),
                    MaxValueValidator(15)],
        help_text="/15",
    )

    recent_seizure = models.CharField(
        verbose_name=("Recent seizure (<72 hrs):"),
        max_length=5,
        choices=YES_NO)

    behaviour_change = models.CharField(max_length=5, choices=YES_NO)

    confusion = models.CharField(max_length=5, choices=YES_NO)

    neurological = models.ManyToManyField(Neurological,
                                          verbose_name="neurologic:")

    focal_neurologic_deficit = models.CharField(
        verbose_name='If "Focal neurologic deficit" chosen, please specify',
        max_length=15,
        null=True,
        blank=True,
    )

    cn_palsy_chosen_other = models.CharField(verbose_name="If other CN Palsy",
                                             max_length=15,
                                             null=True,
                                             blank=True)

    lp_completed = models.CharField(
        verbose_name="LP completed",
        max_length=5,
        choices=YES_NO,
        help_text="If YES, complete LP form",
    )

    amb_administered = models.CharField(max_length=5, choices=YES_NO)

    amb_duration = models.IntegerField(
        verbose_name="If YES, specify length of course",
        validators=[MinValueValidator(1)],
        null=True,
        blank=True,
    )

    tb_treatment = models.CharField(verbose_name="TB treatment:",
                                    max_length=5,
                                    choices=YES_NO)

    steroids_administered = models.CharField(max_length=5, choices=YES_NO)

    steroids_duration = models.IntegerField(
        verbose_name="If YES, specify the length of course in days:",
        validators=[MinValueValidator(1)],
        null=True,
        blank=True,
    )

    steroids_choices = models.CharField(
        verbose_name="If YES",
        max_length=25,
        default=NOT_APPLICABLE,
        choices=STEROIDS_CHOICES,
    )

    steroids_choices_other = models.CharField(
        blank=True,
        max_length=50,
        verbose_name="If other steroids, please specify")

    CD4_count = models.IntegerField(
        verbose_name="CD4 count (if available)",
        validators=[MinValueValidator(1)],
        null=True,
        blank=True,
    )

    antibiotic_treatment = models.ManyToManyField(
        AntibioticTreatment, verbose_name="Antibiotics treatment")

    antibiotic_treatment_other = models.CharField(
        verbose_name="If other antibiotic treatment, please specify",
        max_length=50,
        blank=True,
        null=True,
    )

    on_arvs = models.CharField(verbose_name="On ARVs:",
                               max_length=26,
                               choices=YES_NO_ALREADY_ARV)

    arv_date = models.DateField(
        verbose_name="Study date ARVs started.",
        validators=[date_not_future],
        null=True,
        blank=True,
    )

    arvs_stopped = models.CharField(
        verbose_name="ARVs stopped this clinical episode?",
        max_length=5,
        choices=YES_NO_NA,
    )

    narrative_summary = models.TextField(
        verbose_name="Narrative summary of recurrence of symptoms:",
        help_text=("Please ensure the following forms have been completed: "
                   "LP, Bloods, Microbiology, Radiology"),
    )

    dr_opinion = models.CharField(verbose_name="Study doctor's opinion:",
                                  max_length=10,
                                  choices=DR_OPINION)

    dr_opinion_other = models.CharField(
        verbose_name="If other doctor's opinion, please specify",
        blank=True,
        max_length=50,
        null=True,
    )

    on_site = ActionIdentifierSiteManager()

    objects = ActionIdentifierManager()

    def __str__(self):
        return f"{self.action_identifier[-9:]}"

    def natural_key(self):
        return (self.action_identifier, )

    class Meta:
        verbose_name = "Recurrence of Symptoms"
        verbose_name_plural = "Recurrence of Symptoms"
        indexes = [
            models.Index(fields=[
                "subject_identifier", "action_identifier", "site", "id"
            ])
        ]