class InfantStudyDrug(BaseScheduledVisitModel): on_placebo_status = models.CharField( verbose_name= "Was the baby supposed to be taking CTX/Placebo for any period since the last attended scheduled visit?", max_length=3, choices=YES_NO, help_text="", ) drug_status = models.CharField( verbose_name= "What is the status of the participant's CTX/Placebo at this visit or since the last visit?", choices=CTX_PLACEBO_STATUS, max_length=90, help_text="", ) history = AuditTrail() def __unicode__(self): return "%s" % (self.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantstudydrug_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = "Infant Study Drug Record"
class InfantVerbalAutopsy(BaseInfantRegisteredSubjectModel): """Verbal Autopsy""" report_datetime = models.DateTimeField( verbose_name="Today's date", null=True, blank=False, validators=[ datetime_not_before_study_start, datetime_not_future, ], ) source = models.ManyToManyField( AutopsyInfoSource, verbose_name='Source of verbal autopsy', max_length=50, ) first_sign = models.TextField( verbose_name= "Starting with the last illness preceding (participant\'s) death, describe the first noticeable sign or symptom of illness, continuing until the time of death.", max_length=1000, ) prop_cause = models.TextField( verbose_name= "What do you think probably caused (participant\'s) death?", max_length=1000, help_text="Note: Please avoid HIV as cause of death", ) sign_symptoms = models.CharField( verbose_name= "During the last illness preceding death, did the participant experience ANY of the following signs or symptoms:", max_length=3, choices=YES_NO, ) history = AuditTrail() infant_visit = models.OneToOneField(InfantVisit) entry_meta_data_manager = EntryMetaDataManager(InfantVisit) def __unicode__(self): return self.registered_subject.subject_identifier def get_absolute_url(self): return reverse('admin:mpepu_infant_infantverbalautopsy_change', args=(self.id, )) def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.registered_subject.relative_identifier def get_registration_datetime(self): return self.report_datetime class Meta: app_label = "mpepu_infant"
class MaternalArvPreg (BaseScheduledVisitModel): """ Maternal arv for current pregnancy. """ # if yes, complete MaternalArvPregHistory took_arv = models.CharField( max_length=3, choices=YES_NO, verbose_name="Did the mother receive any ARVs during this pregnancy?", help_text="(NOT including single -dose NVP in labour)", ) sd_nvp = models.CharField( max_length=10, choices=YES_NO_UNKNOWN, verbose_name="Was single-dose NVP received by the mother during labour(or false labour)? ", help_text="", ) # if yes, complete MaternalArvPostPart start_pp = models.CharField( max_length=3, choices=YES_NO, verbose_name="Did the mother START any antiretroviral drugs during the immediate postpartum period (before discharge from maternity)?", help_text="", ) history = AuditTrail() def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternalarvpreg_change', args=(self.id,)) class Meta: app_label = "mpepu_maternal" verbose_name = 'Maternal ARV In This Preg'
class MaternalRequisition(BaseClinicRequisition): maternal_visit = models.ForeignKey(MaternalVisit) entry_meta_data_manager = RequisitionManager(MaternalVisit) packing_list = models.ForeignKey(PackingList, null=True, blank=True) aliquot_type = models.ForeignKey(AliquotType) panel = models.ForeignKey(Panel) history = AuditTrail() def get_visit(self): return self.maternal_visit def aliquot(self): url = reverse('admin:mpepu_lab_aliquot_changelist') return """<a href="{url}?q={requisition_identifier}" />aliquot</a>""".format( url=url, requisition_identifier=self.requisition_identifier) aliquot.allow_tags = True class Meta: app_label = 'mpepu_lab' verbose_name = 'Maternal Laboratory Requisition' unique_together = ('maternal_visit', 'panel', 'is_drawn')
class InfantFuNewMedItems(InfantBaseUuidModel): infant_fu_med = models.ForeignKey(InfantFuNewMed) medication = models.CharField( max_length=100, choices=MP010_MEDICATIONS, verbose_name="Medication", blank=True, null=True, ) drug_route = models.CharField( max_length=20, choices=DRUG_ROUTE, verbose_name="Drug route", blank=True, null=True, ) history = AuditTrail() def get_visit(self): return self.infant_fu_med.infant_visit def __unicode__(self): return unicode(self.infant_fu_med.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantfunewmeditems_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = "Infant FollowUp: New Med Items" verbose_name_plural = "Infant FollowUp: New Med Items"
class ResistanceConsent(BaseResistanceConsent): """Model for resistance sub study consent for mothers.""" registered_subject = models.OneToOneField(RegisteredSubject, editable=False, null=True) history = AuditTrail() def get_registered_subject(self): return self._registered_subject def save_new_consent(self, using=None, subject_identifier=None): """Confirms if Maternal Consent instance exists""" try: maternal_consent = MaternalConsent.objects.get(first_name=self.first_name, identity=self.identity) registered_subject = maternal_consent.registered_subject self.registered_subject = registered_subject subject_identifier = registered_subject.subject_identifier return subject_identifier except ObjectDoesNotExist: raise ValidationError('Cannot locate maternal consent with first_name={0} and identity={1}'.format(self.first_name, self.identity)) def get_registration_datetime(self): return self.consent_datetime class Meta: app_label = 'mpepu_maternal' verbose_name = 'ARV Resistance Consent'
class InfantFu(BaseScheduledVisitModel): physical_assessment = models.CharField( max_length=3, choices=YES_NO, verbose_name="Was physical assessment done today?", help_text="", ) diarrhea_illness = models.CharField( verbose_name="Since the last scheduled visit, has the infant had any diarrheal illness (at least 3 loose stools per day which is ALSO a change from the normal)", max_length=3, choices=YES_NO, help_text="must be of grade 3 or 4", ) has_dx = models.CharField( max_length=25, choices=YES_NO, verbose_name="Since the last attended scheduled visit, has the infant had any diagnosis that were NEW events", help_text="\'NEW events\' are those that were never previously reported OR a NEW episode of a previously resolved diagnosis", ) history = AuditTrail() def __unicode__(self): return "%s" % (self.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantfu_change', args=(self.id,)) class Meta: app_label = "mpepu_infant" verbose_name = "Infant FollowUp"
class InfantFuDx2Proph(BaseScheduledVisitModel): infant_fu = models.OneToOneField(InfantFu) has_dx = models.CharField( max_length=25, choices=YES_NO, verbose_name="Since the last attended scheduled visit, did one of the new diagnoses listed below occur", help_text="please indicate relationship of this diagnoses to the study CTX/placebo and to infant NVP prophylaxis in the table below", ) who_diagnosis = models.CharField( max_length=25, choices=YES_NO, verbose_name="Since the last attended scheduled visit,has the infant ever had any of the diagnoses in the WHO pediatric HIV clinical staging document which were NEW(never previously reported,or a NEW episode of a previously resolved* diagnosis),and which are not reported above?", help_text="if this is the randomization visit,include the time period from birth through the randomization visit", ) wcs_dx_ped = models.ManyToManyField(WcsDxPed, verbose_name="List any new WHO Stage III/IV diagnoses that are not reported in Question 6 above: ", ) history = AuditTrail() def __unicode__(self): return unicode(self.infant_fu.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantfudx2proph_change', args=(self.id,)) class Meta: app_label = "mpepu_infant" verbose_name = "Infant FollowUp: Dx to Proph" verbose_name_plural = "Infant FollowUp: Dx to Proph"
class MaternalOffStudy(BaseOffStudy): """ Maternal Off-Study. * Complete this form to record permanent discontinuation from all follow-up for each participant (Mother). * Header date equals "Off-Study Date", unless there is a death.In the event of death "Off-study Date"="Date of Death". """ history = AuditTrail() maternal_visit = models.OneToOneField(MaternalVisit) entry_meta_data_manager = EntryMetaDataManager(MaternalVisit) def __unicode__(self): return '%s ' % (self.registered_subject) def get_visit(self): return self.maternal_visit def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternaloffstudy_change', args=(self.id,)) class Meta: verbose_name = "Maternal Off-Study" verbose_name_plural = "Maternal Off-Study" app_label = "mpepu_maternal"
class InfantArvProph(BaseScheduledVisitModel): prophylatic_nvp = models.CharField( max_length=3, choices=YES_NO, verbose_name= "Was the baby supposed to be taking taking prophylactic NVP for any period since the last attended scheduled visit?", ) arv_status = models.CharField( max_length=25, verbose_name= "What is the status of the participant's ARV prophylaxis at this visit or since the last visit? ", choices=ARV_STATUS_WITH_NEVER, help_text="referring to prophylaxis other than single dose NVP", default='N/A', ) history = AuditTrail() def __unicode__(self): return "%s" % (self.infant_visit) def report_datetime(self): return datetime.today() def get_absolute_url(self): return reverse('admin:mpepu_infant_infantarvproph_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = 'Infant NVP or AZT Proph'
class MaternalEligibilityAnte(BaseMaternalEligibility): """Model for Maternal Eligiblity Ante-Natal""" gestational_age = models.IntegerField( verbose_name="Gestational age", help_text="if <26 weeks,ineligible", validators=[MaxValueValidator(43), MinValueValidator(26)]) history = AuditTrail() def get_registration_datetime(self): return self.registration_datetime def get_result_datetime(self): return self.registration_datetime def get_test_code(self): return 'HIV' def __unicode__(self): return unicode(self.registered_subject) def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternaleligibilityante_change', args=(self.id, )) class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal Eligibility Ante-Natal" verbose_name_plural = "Maternal Eligibility Ante-Natal"
class InfantFuDxItems(InfantOffStudyMixin, BaseBaseDiagnosisItem): infant_fu_dx = models.ForeignKey(InfantFuDx) fu_dx = models.CharField( max_length=150, choices=DX_INFANT, verbose_name="Diagnosis", # null = True, help_text="", ) fu_dx_specify = models.CharField( max_length=50, verbose_name="Diagnosis specification", help_text="", blank=True, null=True, ) health_facility = models.CharField( choices=YES_NO, max_length=3, verbose_name="Seen at health facility for Dx", help_text="", # null = True, ) was_hospitalized = models.CharField( choices=YES_NO, max_length=3, verbose_name="Hospitalized?", help_text="", # null = True, ) history = AuditTrail() def get_report_datetime(self): return self.infant_fu_dx.get_report_datetime() def get_subject_identifier(self): return self.infant_fu_dx.get_subject_identifier() def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.get_visit().appointment.registered_subject.relative_identifier def get_visit(self): return self.infant_fu_dx.infant_visit def __unicode__(self): return unicode(self.infant_fu_dx.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantfudxitems_change', args=(self.id,)) class Meta: app_label = "mpepu_infant" verbose_name = "Infant FollowUp: Dx Items" verbose_name_plural = "Infant FollowUp: Dx Items"
class InfantDeath(InfantOffStudyMixin, BaseDeathReport): death_reason_hospitalized_other = models.TextField( verbose_name= "if other illness or pathogen specify or non infectious reason, please specify below:", max_length=250, blank=True, null=True, ) study_drug_relate = models.CharField( verbose_name= "Relationship between the participant death and study drug (CTX vs Placebo)", max_length=25, choices=DRUG_RELATIONSHIP, ) infant_nvp_relate = models.CharField( verbose_name= "Relationship between the participant death and infant extended nevirapine prophylaxis ", max_length=25, choices=DRUG_RELATIONSHIP, ) haart_relate = models.CharField( verbose_name="Relationship between the participant death and HAART", max_length=25, choices=DRUG_RELATIONSHIP, ) trad_med_relate = models.CharField( verbose_name= "Relationship between the participant death and traditional medicine use", max_length=25, choices=DRUG_RELATIONSHIP, ) history = AuditTrail() infant_visit = models.OneToOneField(InfantVisit) entry_meta_data_manager = EntryMetaDataManager(InfantVisit) def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.registered_subject.relative_identifier def get_report_datetime(self): return datetime.today() def get_visit(self): return self.infant_visit def get_absolute_url(self): return reverse('admin:mpepu_infant_infantdeath_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = "Infant Death"
class MaternalLabDelDxT(MaternalBaseUuidModel): """ Diagnosis during pregnancy collected during labor and delivery (transactions). """ maternal_lab_del_dx = models.ForeignKey(MaternalLabDelDx) lab_del_dx = models.CharField( max_length=175, choices=DX, verbose_name="Diagnosis", help_text="", ) lab_del_dx_specify = models.CharField( max_length=50, verbose_name="Diagnosis specification", help_text="", blank=True, null=True, ) grade = models.IntegerField( choices=GRADING_SCALE, verbose_name="Grade", ) hospitalized = models.CharField( max_length=3, choices=YES_NO, verbose_name="Hospitalized", help_text="", ) history = AuditTrail() objects = MaternalLabDelDxTManager() def natural_key(self): return (self.lab_del_dx, ) + self.maternal_lab_del_dx.natural_key() def get_visit(self): return self.maternal_lab_del_dx.maternal_visit def get_report_datetime(self): return self.maternal_lab_del_dx.maternal_visit.report_datetime def get_subject_identifier(self): return self.maternal_lab_del_dx.maternal_visit.subject_identifier def __unicode__(self): return unicode(self.get_visit()) def get_absolute_url(self): return reverse( 'admin:mpepu_maternal_maternallabour&deliverypregdx_change', args=(self.id, )) class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal Labour & Delivery: Preg DxT"
class InfantPrerandoLoss(BaseInfantRegisteredSubjectModel): # report_datetime = models.DateTimeField( # verbose_name='Report date/time', # null=True) reason_loss = models.TextField( max_length=250, verbose_name= "Describe the reason that the infant who consented did not undergo randomization", ) loss_code = models.CharField( verbose_name= "Please code the primary reason for pre- randomization loss to follow up:", max_length=25, choices=INFANT_PRE_RANDO_LOSS_REASON, help_text= "See Study Protocol for definition of 'Loss to follow up'. If \'refused\', explain in comments below", ) reason_loss_other = OtherCharField( verbose_name="if other specify...", blank=True, null=True, ) comment = models.TextField( max_length=250, verbose_name= "Comments (Please provide any additional information pertinent to the response given in question 3)", blank=True, null=True, ) history = AuditTrail() infant_visit = models.OneToOneField(InfantVisit) entry_meta_data_manager = EntryMetaDataManager(InfantVisit) def __unicode__(self): return unicode(self.registered_subject) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantprerandoloss_change', args=(self.id, )) def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.registered_subject.relative_identifier def get_report_datetime(self): return self.created class Meta: app_label = "mpepu_infant" verbose_name = "Infant Pre-Rando Loss"
class FeedingChoiceSectionThree(BaseScheduledVisitModel): risk_benefit_training = models.ManyToManyField( MaternalBfFfRisksBenefits, verbose_name=( "I received training about the risks and benefits of breast and " "formula feeding: "), ) und_risk_benefit = models.CharField( verbose_name=( "The training increased my understanding of the risk and benefits" " of breastfeeding and formula feeding: "), max_length=35, choices=AGREEING_TERMS, ) ff_advice = models.CharField( verbose_name= "I was advised by a health worker to formula feed my baby: ", max_length=35, choices=AGREEING_TERMS, ) bf_advice = models.CharField( verbose_name="I was advised by a health worker to breastfeed my baby: ", max_length=35, choices=AGREEING_TERMS, ) feeding_choice_made = models.CharField( verbose_name="I have already made a feeding choice for my infant: ", max_length=3, choices=YES_NO, help_text="If Yes go to Q7, and if No go to Q8", ) chosen_feeding_choice = models.CharField( verbose_name="I made this feeding choice: ", max_length=50, choices=DECIDED_FEEDING_CHOICE, help_text="", ) undecided_feeding = models.ManyToManyField( MaternalUndecidedFeeding, verbose_name="I have not yet decided how to feed my baby because: ", help_text="Check all that apply ", ) history = AuditTrail() class Meta: app_label = 'mpepu_maternal' verbose_name = "Feeding Choice: Section 3" verbose_name_plural = "Feeding Choice: Section 3" def get_absolute_url(self): return reverse('admin:mpepu_maternal_feedingchoicesectionthree_change', args=(self.id, ))
class MaternalEnrollArv(BaseScheduledVisitModel): """Model for Maternal Enrollment: ARV History""" maternal_enroll = models.OneToOneField(MaternalEnroll) haart_start_date = models.DateField( verbose_name="Date of HAART first started", help_text="", ) is_date_estimated = IsDateEstimatedField( verbose_name=("Is the subject's date of HAART estimated?"), ) preg_on_haart = models.CharField( max_length=25, choices=YES_NO, verbose_name= "Was she still on HAART at the time she became pregnant for this pregnancy? ", help_text="", ) haart_changes = models.IntegerField( verbose_name="How many times did you change your HAART medicines?", help_text="", ) prior_preg = models.CharField( max_length=80, verbose_name="Prior to this pregnancy the mother has ", choices=PRIOR_PREG_HAART_STATUS, help_text="", ) prior_arv = models.ManyToManyField( PriorArv, verbose_name= "Please list all of the ARVs that the mother ever received prior to the current pregnancy:", help_text="", ) prior_arv_other = OtherCharField( max_length=35, verbose_name="if other specify...", blank=True, null=True, ) history = AuditTrail() def __unicode__(self): return "%s" % (self.maternal_enroll) def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternalenrollarv_change', args=(self.id, )) class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal Enrollment: ARV History"
class InfantStudyDrugInit(BaseScheduledVisitModel): """ CTX / Placebo """ initiated = models.CharField( max_length=25, choices=YES_NO, verbose_name="Did the participant start CTX or placebo study drug? ", help_text="If 'No' skip to question 4", ) first_dose_date = models.DateField( verbose_name="Date of first known dose", blank=True, null=True, help_text="", validators=[ date_not_future, ], ) reason_not_init = models.CharField( verbose_name="Reason for not starting CTX or placebo Study Drug?", max_length=25, choices=INFANT_DRUG_INITIATION, help_text="If contra-indicated please complete Off Study Form (AF004)", default='N/A', ) reason_not_survive = models.CharField( verbose_name='If "Survival to 18 months unlikely", describe', max_length=250, blank=True, null=True, ) reason_not_init_other = models.CharField( verbose_name='If "Other", specify', max_length=250, blank=True, null=True, ) history = AuditTrail() def __unicode__(self): return "%s" % (self.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantstudydruginit_change', args=(self.id,)) class Meta: app_label = "mpepu_infant" verbose_name = "Infant Study Drug Initiation"
class MaternalLabDelMed(BaseScheduledVisitModel): """ Medical history collected during labor and delivery. """ maternal_lab_del = models.OneToOneField(MaternalLabDel) has_health_cond = models.CharField( max_length=3, choices=YES_NO, verbose_name= "Has the mother been newly diagnosed (during this pregnancy) with any major chronic health condition(s) that remain ongoing? ", help_text="if yes answer Question 4, otherwise go to Question 6", ) health_cond = models.ManyToManyField( HealthCond, verbose_name="Select all that apply ", help_text="", ) health_cond_other = OtherCharField() has_ob_comp = models.CharField( max_length=3, choices=YES_NO, verbose_name= "During this pregnancy, did the mother have any of the following obstetrical complications? (in 7)", help_text="", ) ob_comp = models.ManyToManyField( ObComp, verbose_name="Select all that apply", help_text="", ) ob_comp_other = models.TextField( max_length=250, blank=True, null=True, ) comment = models.TextField( max_length=250, verbose_name="Comment if any additional pertinent information ", blank=True, null=True, ) history = AuditTrail() class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal Labour & Delivery: MedHistory" def get_absolute_url(self): return reverse( 'admin:mpepu_maternal_maternallabour&deliverymedhistory_change', args=(self.id, ))
class InfantHivStatus(BaseScheduledVisitModel): """New form - Infant HIV status - added to 2180 infant visit ONLY """ recent_hiv_result = models.CharField( verbose_name="Most recent HIV test result", choices=POS_NEG, max_length=15, help_text="if positive answer 7-9", ) recent_hiv_date = models.DateField( verbose_name="Date of most recent HIV test result", ) recent_hiv_date_est = models.CharField( verbose_name="Is date of most recent HIV test result ESTIMATED?", choices=YES_NO, max_length=3, ) test_place = models.TextField( verbose_name="Place where HIV test was done:", max_length=35, ) result_record = models.CharField( verbose_name="Is result written in participants medical record?", choices=YES_NO, max_length=3, ) date_first_pos = models.DateField( verbose_name="Date of first positive test", help_text="Can only be answered if answer to Q2 is positive", null=True, blank=True, ) infant_haart = models.CharField( verbose_name="Is infant on HAART?", choices=YES_NO, max_length=3, ) infant_haart_date = models.DateField( verbose_name="Date infant started HAART?", null=True, blank=True, ) history = AuditTrail() def get_absolute_url(self): return reverse('admin:mpepu_infant_infanthivstatus_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = "Infant HIV status"
class MaternalPostFuDx(BaseScheduledVisitModel): """ Post-partum follow up of diagnosis. """ maternal_post_fu = models.OneToOneField(MaternalPostFu) mother_hospitalized = models.CharField( max_length=3, choices=YES_NO, verbose_name= "Has the mother been hospitalized overnight since the last scheduled visit (or since discharge after delivery, if this is the randomization visit)?", help_text= "if yes, the primary diagnosis associated with the hospitalization(s) must be recorded in Postnatal diagnosis section", ) new_diagnoses = models.CharField( max_length=3, choices=YES_NO, verbose_name= "Since the last attended scheduled visit, has the mother had any of the following which were NEW (never previously reported, or a NEW episode of a previously resolved* diagnosis)", help_text= "if yes, tick all that apply, only report grade 3 0r 4 diagnoses", ) who_clinical_stage = models.CharField( max_length=3, choices=YES_NO, verbose_name= "Since the last attended scheduled visit, has the mother ever had any of the diagnoses listed in the WHO Adult/Adolescent HIV clinical staging document which are NEW?", help_text= "never previously reported, or a NEW episode of a previously resolved diagnosis, and which is NOT reported above in Question 4", ) wcs_dx_adult = models.ManyToManyField( WcsDxAdult, verbose_name= "List any new WHO Stage III/IV diagnoses that are not reported in Question 6 above: ", ) history = AuditTrail() def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternalpostfudx_change', args=(self.id, )) def get_report_datetime(self): return self.maternal_post_fu.get_report_datetime() def get_subject_identifier(self): return self.maternal_post_fu.get_subject_identifier() class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal Postnatal Follow-Up: Dx"
class InfantHaart(BaseInfantRegisteredSubjectModel): """ mp016 """ hiv_positive_date = models.DateField( verbose_name="Date infant tested HIV-positive", help_text="", ) haart_initiated = models.CharField( max_length=25, choices=YES_NO, verbose_name="Has patient been initiated on HAART? ", help_text= "If no, fill out comment,and indicate the reason HAART has not yet been initiated,otherwise answer question 4", ) haart_date = models.DateField( verbose_name="Date of HAART initiation ", help_text="", blank=True, null=True, ) arv_status = models.CharField( max_length=15, choices=ARV_STATUS, verbose_name= "What is the status of the participant's antiretroviral treatment / prophylaxis at this visit or since the last visit?", help_text="", ) comment = models.CharField( max_length=35, verbose_name="Comments", blank=True, null=True, ) history = AuditTrail() def __unicode__(self): return "%s" % (self.registered_subject) def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.registered_subject.relative_identifier def get_absolute_url(self): return reverse('admin:mpepu_infant_infanthaart_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = 'Infant HAART'
class InfantStudyDrugItems(InfantBaseUuidModel): """ CTX / Placebo """ inf_study_drug = models.ForeignKey(InfantStudyDrug) dose_status = models.CharField( verbose_name="Dose Status", choices=DOSE_STATUS, max_length=25, ) ingestion_date = models.DateField( verbose_name="Date of study drug ingestion", validators=[ date_not_before_study_start, date_not_future, ], ) modification_reason = models.CharField( verbose_name="Reason for modification", choices=ARV_MODIFICATION_REASON, max_length=75, ) history = AuditTrail() # def save(self, *args, **kwargs): # super(InfantStudyDrugItems, self).save(*args, **kwargs) # if self.dose_status.lower() == 'permanently discontinued': # model = get_model('mpepu_infant', 'infantoffdrug') # AdditionalEntryBucket.objects.add_for( # registered_subject=self.inf_study_drug.infant_visit.appointment.registered_subject, # model=model, # qset=Q(registered_subject=self.inf_study_drug.infant_visit.appointment.registered_subject)) def get_visit(self): return self.inf_study_drug.infant_visit def __unicode__(self): return unicode(self.inf_study_drug.infant_visit) def get_absolute_url(self): return reverse('admin:mpepu_infant_infantstudydrug_change', args=(self.id, )) class Meta: app_label = "mpepu_infant" verbose_name = "Infant Study Drug Record Items" ordering = [ 'ingestion_date', ]
class MaternalArvPostAdh(BaseScheduledVisitModel): """Maternal ARV adherence post-partum. complete if YES for haart_last_visit in MaternalArvPost """ maternal_arv_post = models.OneToOneField(MaternalArvPost) missed_doses = models.IntegerField( verbose_name= "Since the last attended last scheduled visit, how many doses of HAART were missed? ", help_text="", ) missed_days = models.IntegerField( verbose_name= "Since the last attended scheduled visit, how many entire days was HAART not taken? ", help_text="", default='0', ) missed_days_discnt = models.IntegerField( verbose_name= "If HAART discontinued by health provider, how many days was HAART missed prior to HAART discontinuation? ", help_text="", default='0', ) comment = models.TextField( max_length=250, verbose_name="Comment", blank=True, null=True, ) history = AuditTrail() def __unicode__(self): return "%s" % (self.maternal_arv_post) def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternalarvspostadherence_change', args=(self.id, )) def get_report_datetime(self): return self.maternal_arv_post.get_report_datetime() def get_subject_identifier(self): return self.maternal_arv_post.get_subject_identifier() class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal ARVs Post: Adherence"
class ResistanceEligibility(BaseScheduledVisitModel): co_enrolled = models.CharField( max_length=3, choices=YES_NO, verbose_name="Is participant co-enrolled in the Mpepu study?", help_text='if no, INELIGIBLE', validators=[eligible_if_yes]) status_evidence = models.CharField( max_length=3, choices=YES_NO, verbose_name="Evidence of confirmed HIV positive status", help_text= ("By indicating YES, you confirm that you have copied such evidence for the" " patient chart"), validators=[eligible_if_yes]) lates_cd4 = models.IntegerField( max_length=4, verbose_name="What is the mother's nadir (lowest recorded) CD4 count?", validators=[MinValueValidator(0), MaxValueValidator(3000)], ) who_illness = models.CharField( max_length=3, choices=YES_NO, verbose_name= "Has the mother ever experienced a WHO stage 3 or 4 illness?", validators=[eligible_if_no], help_text='if yes, INELIGIBLE', ) stopped_arv = models.CharField( max_length=3, choices=YES_NO, verbose_name= ("Has the Mother Stopped (or definitely planning to stop) EFV/TDF/FTC or" " EFV/TDF/3TC postpartum?"), validators=[eligible_if_yes]) incarcerated = models.CharField( max_length=3, choices=YES_NO, verbose_name="Is participant currently involuntarily incarcerated?", validators=[eligible_if_no]) history = AuditTrail() class Meta: app_label = 'mpepu_maternal' verbose_name = 'ARV Resistance Eligibility' verbose_name_plural = 'ARV Resistance Eligibility'
class InfantSurvival(BaseInfantRegisteredSubjectModel): infant_survival_status = models.CharField( verbose_name="Survival Status of the participant at 18 months of age? ", choices=ALIVE_DECEASED, max_length=25, help_text="", ) info_provider = models.CharField( verbose_name="Who provided this information? ", choices=INFO_PROVIDER, max_length=25, help_text="", ) info_provider_other = OtherCharField( max_length=35, verbose_name="if other specify...", blank=True, null=True, ) comment = OtherCharField( max_length=35, verbose_name="Comment", blank=True, null=True, ) history = AuditTrail() infant_visit = models.OneToOneField(InfantVisit) entry_meta_data_manager = EntryMetaDataManager(InfantVisit) def __unicode__(self): return self.registered_subject.subject_identifier def get_report_datetime(self): return self.registered_subject.registration_datetime def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.registered_subject.relative_identifier def get_absolute_url(self): return reverse('admin:mpepu_infant_infantsurvival_change', args=(self.id,)) class Meta: app_label = "mpepu_infant" verbose_name = "Infant Survival"
class MaternalEnrollDx(MaternalBaseUuidModel): """ Model for Maternal Enrollment: Dx History viewable based on question 5a.""" maternal_enroll_med = models.ForeignKey(MaternalEnrollMed) diagnosis = models.CharField( max_length=50, verbose_name="Diagnosis", help_text="", null=True, blank=True, ) diagnosis_year = models.IntegerField( verbose_name="Year", validators=[ MinValueValidator(1947), MaxValueValidator(datetime.today().year), ], null=True, blank=True, ) history = AuditTrail() objects = MaternalEnrollDxManager() def natural_key(self): return (self.diagnosis, ) + self.maternal_enroll_med.natural_key() def get_report_datetime(self): return self.get_visit().get_report_datetime() def get_subject_identifier(self): return self.get_visit().get_subject_identifier() def get_visit(self): return self.maternal_enroll_med.maternal_visit def __unicode__(self): return unicode(self.get_visit()) def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternalenrolldx_change', args=(self.id, )) class Meta: app_label = "mpepu_maternal" verbose_name = "Maternal Enrollment: Dx History"
class PostNatalInfantFeedingSurvey(BaseScheduledVisitModel): feeding_satisfaction = models.CharField( verbose_name=("Were you satisfied with the infant feeding choice, breast feeding or" " formula feeding, that you initially selected for your infant : "), max_length=3, choices=YES_NO, ) feeding_period = models.CharField( verbose_name="Do you think your infant breastfed for the right number of months:", max_length=3, choices=YES_NO_FF, help_text='If formula feeding skip to question 5. If breast feeding continue' ) feeding_duration = models.CharField( verbose_name="If No to Q3 above, the duration of breastfeeding of my infant was:", max_length=10, choices=FEEDING_DURATION, null=True, blank=True, ) correct_bf_duration = models.CharField( verbose_name=("What do you think the correct duration of breastfeeding should be" " if a mother has HIV but taking Highly Active Antiretroviral Treatment" " to prevent mother-to-child HIV transmission throughout breastfeeding: "), max_length=50, choices=CORRECT_BF_DURATION, ) next_feeding_choice = models.CharField( verbose_name=("How do you think you will feed your next infant from birth through " " the first six months of life : "), max_length=30, choices=NEXT_FEEDING_CHOICE, ) history = AuditTrail() class Meta: app_label = 'mpepu_maternal' verbose_name = "Post Natal Infant Feeding Survey" def get_absolute_url(self): return reverse('admin:mpepu_maternal_postnatalinfantfeedingsurvey_change', args=(self.id,))
class MaternalConsent(BaseMaternalConsent): """Model for maternal consent and registration model for mothers.""" history = AuditTrail() registered_subject = models.OneToOneField(RegisteredSubject, editable=False, null=True, help_text='') def get_registered_subject(self): # reg_subject = None subject = RegisteredSubject.objects.filter(subject_identifier=self.subject_identifier) if subject: self.registered_subject = subject[0] return self.registered_subject # @property # def registered_subject(self): # return self.registered_subject # return self.get_registered_subject() # @registered_subject.setter # def registered_subject(self, registered_subject): # if registered_subject: # self.registered_subject=registered_subject # else: # subject = RegisteredSubject.objects.filter(subject_identifier=self.subject_identifier) # if subject: # self.registered_subject = subject[0] def dispatch_container_lookup(self): return None @classmethod def get_consent_update_model(self): return models.get_model('bhp_consent', 'MaternalConsentUpdate') class Meta: verbose_name = "Maternal Consent" app_label = 'mpepu_maternal' def get_absolute_url(self): return reverse('admin:mpepu_maternal_maternalconsent_change', args=(self.id,))
class InfantOffStudy(BaseOffStudy): history = AuditTrail() infant_visit = models.OneToOneField(InfantVisit) report_datetime = models.DateTimeField( verbose_name="Visit Date and Time", validators=[ datetime_not_before_study_start, datetime_is_after_consent, datetime_not_future, ], default=datetime.today() ) def save(self, *args, **kwargs): super(InfantOffStudy, self).save(*args, **kwargs) def __unicode__(self): return "%s" % (self.registered_subject.subject_identifier) def get_consenting_subject_identifier(self): """Returns mother's identifier.""" return self.registered_subject.relative_identifier def get_absolute_url(self): return reverse('admin:mpepu_infant_infantoffstudy_change', args=(self.id,)) def get_date_grouping_field(self): #set field for date-based grouping return 'offstudy_date' def get_visit(self): return self.infant_visit def get_report_datetime(self): return self.report_datetime entry_meta_data_manager = EntryMetaDataManager(InfantVisit) class Meta: verbose_name = "Infant Off-Study" verbose_name_plural = "Infant Off-Study" app_label = "mpepu_infant"