Ejemplo n.º 1
0
class Anthropometry(CrfModelMixin, BaseUuidModel):

    weight = edc_models.WeightField()

    height = edc_models.HeightField()

    bmi = models.DecimalField(
        verbose_name="BMI",
        decimal_places=1,
        max_digits=7,
        help_text="kg/mm^2 (Note: this field is read only. The value is calculated)",
    )

    waist_circumference = edc_models.WaistCircumferenceField()

    sys_blood_pressure_r1 = edc_models.SystolicPressureField(null=True, blank=False,)

    dia_blood_pressure_r1 = edc_models.DiastolicPressureField(null=True, blank=False,)

    sys_blood_pressure_r2 = edc_models.SystolicPressureField(null=True, blank=False,)

    dia_blood_pressure_r2 = edc_models.DiastolicPressureField(null=True, blank=False,)

    def save(self, *args, **kwargs):
        self.bmi = round((float(self.weight) / (float(self.height) / 100.0)), 2)
        super().save(*args, **kwargs)

    class Meta(CrfModelMixin.Meta):
        verbose_name = "Anthropometry"
        verbose_name_plural = "Anthropometry"
Ejemplo n.º 2
0
class FollowupIndicators(IndicatorsModelMixin, CrfModelMixin,
                         edc_models.BaseUuidModel):

    height = edc_models.HeightField(null=True, blank=True)

    class Meta(CrfModelMixin.Meta):
        verbose_name = "Followup Indicators"
        verbose_name_plural = "Followup Indicators"
Ejemplo n.º 3
0
class Indicators(CrfModelMixin, BaseUuidModel):
    weight = edc_models.WeightField(
        validators=[MinValueValidator(25), MaxValueValidator(200)],
        null=True,
        blank=True,
    )

    height = edc_models.HeightField(
        null=True,
        blank=True,
    )

    r1_taken = models.CharField(
        verbose_name=mark_safe("Was a blood pressure reading taken"),
        max_length=15,
        choices=YES_NO,
        default=YES,
    )

    r1_reason_not_taken = models.TextField(
        verbose_name="reason not taken", max_length=250, null=True, blank=True
    )

    sys_blood_pressure_r1 = edc_models.SystolicPressureField(null=True, blank=True)

    dia_blood_pressure_r1 = edc_models.DiastolicPressureField(null=True, blank=True)

    r2_taken = models.CharField(
        verbose_name=mark_safe("Was a <u>second</u> blood pressure reading taken"),
        max_length=15,
        choices=YES_NO_NOT_REQUIRED,
        default=NOT_REQUIRED,
    )

    r2_reason_not_taken = models.TextField(max_length=250, null=True, blank=True)

    sys_blood_pressure_r2 = edc_models.SystolicPressureField(null=True, blank=True)

    dia_blood_pressure_r2 = edc_models.DiastolicPressureField(null=True, blank=True)

    class Meta(CrfModelMixin.Meta, edc_models.BaseUuidModel.Meta):
        verbose_name = "Indicators"
        verbose_name_plural = "Indicators"
Ejemplo n.º 4
0
class CoronaKapDiseaseModelMixin(models.Model):

    # Disease burden
    hiv_pos = models.CharField(
        verbose_name=mark_safe("Does the patient have <u>HIV</u> infection?"),
        max_length=25,
        choices=YES_NO_UNKNOWN,
    )

    hiv_pos_year = models.IntegerField(
        verbose_name=mark_safe(
            "If 'Yes', what year did you first test positive?"),
        validators=[MinValueValidator(1950),
                    MaxValueValidator(2020)],
        null=True,
        blank=True,
        help_text="format YYYY",
    )

    hiv_year_started_art = models.IntegerField(
        verbose_name=
        "If 'Yes', what year did you <u>start antiretroviral therapy</u>?",
        validators=[MinValueValidator(0)],
        null=True,
        blank=True,
        help_text="format YYYY",
    )

    hiv_missed_doses = models.IntegerField(
        verbose_name=mark_safe(
            "If 'Yes', in the last month <u>how many days</u> did you miss "
            "taking your <u>ART</u> medications?"),
        null=True,
        blank=True,
    )

    diabetic = models.CharField(
        verbose_name=mark_safe(
            "Have you been diagnosed with <u>diabetes</u>?"),
        max_length=25,
        choices=YES_NO_UNKNOWN,
    )

    diabetic_dx_year = models.IntegerField(
        verbose_name=mark_safe(
            "If 'Yes', what year did you first learn you had <u>diabetes</u>?"
        ),
        validators=[MinValueValidator(1950),
                    MaxValueValidator(2020)],
        null=True,
        blank=True,
        help_text="format YYYY",
    )

    diabetic_on_meds = models.CharField(
        verbose_name=mark_safe(
            "If 'Yes', are you taking medications to control your <u>diabetes</u>?"
        ),
        max_length=25,
        choices=YES_NO_NA,
        default=NOT_APPLICABLE,
    )

    diabetic_missed_doses = models.IntegerField(
        verbose_name=mark_safe(
            "If 'Yes', in the last month <u>how many days</u> did you miss "
            "taking your <u>diabetes</u> medications?"),
        null=True,
        blank=True,
    )

    hypertensive = models.CharField(
        verbose_name=mark_safe(
            "Have you been diagnosed with <u>hypertension</u>?"),
        max_length=25,
        choices=YES_NO_UNKNOWN,
    )

    hypertensive_dx_year = models.IntegerField(
        verbose_name=mark_safe(
            "If 'Yes', what year did you first learn you had <u>hypertension</u>?"
        ),
        validators=[MinValueValidator(1950),
                    MaxValueValidator(2020)],
        null=True,
        blank=True,
        help_text="format YYYY",
    )

    hypertensive_on_meds = models.CharField(
        verbose_name=mark_safe(
            "If 'Yes', are you taking medications to control your <u>hypertension</u>?"
        ),
        max_length=25,
        choices=YES_NO_NA,
        default=NOT_APPLICABLE,
    )

    hypertensive_missed_doses = models.IntegerField(
        verbose_name=mark_safe(
            "If 'Yes', in the last month <u>how many days</u> did you miss "
            "taking your <u>hypertension</u> medications?"),
        null=True,
        blank=True,
    )

    weight = edc_models.WeightField(null=True, blank=True)

    height = edc_models.HeightField(null=True, blank=True)

    sys_blood_pressure = edc_models.SystolicPressureField(null=True,
                                                          blank=True)

    dia_blood_pressure = edc_models.DiastolicPressureField(null=True,
                                                           blank=True)

    class Meta:
        abstract = True
class PartThreeFieldsModelMixin(
    FastingModelMixin,
    IfgModelMixin,
    OgttModelMixin,
    CreatinineModelFieldsMixin,
    models.Model,
):

    part_three_report_datetime = models.DateTimeField(
        verbose_name="Second stage report date and time",
        null=True,
        blank=False,
        help_text="Date and time of report.",
    )

    sys_blood_pressure = edc_models.SystolicPressureField(
        null=True,
        blank=True,
    )

    dia_blood_pressure = edc_models.DiastolicPressureField(
        null=True,
        blank=True,
    )

    weight = edc_models.WeightField(null=True, blank=True)

    height = edc_models.HeightField(null=True, blank=True)

    waist_circumference = models.DecimalField(
        verbose_name="Waist circumference",
        max_digits=5,
        decimal_places=1,
        validators=[MinValueValidator(50.0), MaxValueValidator(175.0)],
        null=True,
        blank=True,
        help_text="in centimeters",
    )

    hba1c_performed = models.CharField(
        verbose_name="Was the HbA1c performed?",
        max_length=15,
        choices=YES_NO,
        default=NO,
        help_text="",
    )

    hba1c_value = models.DecimalField(
        verbose_name="HbA1c",
        max_digits=8,
        decimal_places=2,
        null=True,
        blank=True,
        help_text="in %",
    )

    creatinine_performed = models.CharField(
        verbose_name="Was the serum creatinine performed?",
        max_length=15,
        choices=YES_NO,
        default=NO,
        help_text="",
    )

    class Meta:
        abstract = True
Ejemplo n.º 6
0
class PartThreeFieldsModelMixin(CreatinineModelFieldsMixin, models.Model):

    part_three_report_datetime = models.DateTimeField(
        verbose_name="Second stage report date and time",
        null=True,
        blank=False,
        help_text="Date and time of report.",
    )

    sys_blood_pressure = edc_models.SystolicPressureField(
        null=True,
        blank=True,
    )

    dia_blood_pressure = edc_models.DiastolicPressureField(
        null=True,
        blank=True,
    )

    weight = edc_models.WeightField(null=True, blank=True)

    height = edc_models.HeightField(null=True, blank=True)

    waist_circumference = models.DecimalField(
        verbose_name="Waist circumference",
        max_digits=5,
        decimal_places=1,
        validators=[MinValueValidator(50.0),
                    MaxValueValidator(175.0)],
        null=True,
        blank=True,
        help_text="in centimeters",
    )

    fasted = models.CharField(
        verbose_name="Has the participant fasted?",
        max_length=15,
        choices=YES_NO,
        null=True,
        blank=False,
    )

    fasted_duration_str = models.CharField(
        verbose_name="How long have they fasted in hours and/or minutes?",
        max_length=8,
        validators=[hm_validator],
        null=True,
        blank=True,
        help_text=
        "Duration of fast. Format is `HHhMMm`. For example 1h23m, 12h7m, etc",
    )

    fasted_duration_minutes = models.IntegerField(
        null=True, help_text="system calculated value")

    hba1c_performed = models.CharField(
        verbose_name="Was the HbA1c performed?",
        max_length=15,
        choices=YES_NO,
        default=NO,
        help_text="",
    )

    hba1c = models.DecimalField(
        verbose_name="HbA1c",
        max_digits=8,
        decimal_places=2,
        null=True,
        blank=True,
        help_text="in %",
    )

    creatinine_performed = models.CharField(
        verbose_name="Was the serum creatinine performed?",
        max_length=15,
        choices=YES_NO,
        default=NO,
        help_text="",
    )

    # IFG
    fasting_glucose = models.DecimalField(
        verbose_name=mark_safe("Fasting glucose <u>level</u>"),
        max_digits=8,
        decimal_places=2,
        null=True,
        blank=True,
    )

    fasting_glucose_quantifier = models.CharField(
        max_length=10,
        choices=RESULT_QUANTIFIER,
        default=EQ,
    )

    fasting_glucose_units = models.CharField(
        verbose_name="Units (fasting glucose)",
        max_length=15,
        choices=GLUCOSE_UNITS,
        blank=True,
        null=True,
    )

    fasting_glucose_datetime = models.DateTimeField(
        verbose_name=mark_safe(
            "<u>Time</u> fasting glucose <u>level</u> measured"),
        null=True,
        blank=True,
    )

    ogtt_base_datetime = models.DateTimeField(
        verbose_name=mark_safe("<u>Time</u> oral glucose solution was given"),
        null=True,
        blank=True,
        help_text="(glucose solution given)",
    )

    ogtt_two_hr = models.DecimalField(
        verbose_name=mark_safe("Blood glucose <u>level</u> 2-hours "
                               "after oral glucose solution given"),
        max_digits=8,
        decimal_places=2,
        null=True,
        blank=True,
    )

    ogtt_two_hr_quantifier = models.CharField(
        max_length=10,
        choices=RESULT_QUANTIFIER,
        default=EQ,
    )

    ogtt_two_hr_units = models.CharField(
        verbose_name="Units (Blood glucose 2hrs after...)",
        max_length=15,
        choices=GLUCOSE_UNITS,
        blank=True,
        null=True,
    )

    ogtt_two_hr_datetime = models.DateTimeField(
        verbose_name=mark_safe("<u>Time</u> blood glucose measured 2-hours "
                               "after oral glucose solution given"),
        blank=True,
        null=True,
        help_text="(2 hours after glucose solution given)",
    )

    class Meta:
        abstract = True