def test_infant_arv_proph_required_till_discontinued_2(self): """Test if infant arv proph is not required if arv status of infant is discontinued""" registered_subject_infant = self.infant_arv_proph_setup() infant_appointment_2030 = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2030') infant_visit_2030 = InfantVisitFactory( appointment=infant_appointment_2030, reason=SCHEDULED) self.assertEqual(CrfMetaData.objects.filter( entry_status=UNKEYED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantarvproph', appointment=infant_appointment_2030).count(), 1) InfantArvProphFactory(infant_visit=infant_visit_2030, prophylatic_nvp=YES, arv_status=NO_MODIFICATIONS) infant_appointment_2060 = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2060') infant_visit_2060 = InfantVisitFactory( appointment=infant_appointment_2060, reason=SCHEDULED) InfantArvProphFactory(infant_visit=infant_visit_2060, prophylatic_nvp=YES, arv_status=DISCONTINUED) infant_appointment_2090 = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2090') InfantVisitFactory( appointment=infant_appointment_2090, reason=SCHEDULED) self.assertEqual(CrfMetaData.objects.filter( entry_status=NOT_REQUIRED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantarvproph', appointment=infant_appointment_2090).count(), 1)
def test_infant_visit_missed_at_2030_requires_circumcision_at_2060(self): """Test an missed infant visit at 2030 would require a circumcision form at 2060""" postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) self.assertEqual(postnatal_enrollment.enrollment_hiv_status, POS) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory(appointment=self.appointment) appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=appointment) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit) registered_subject_infant = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del, gender=MALE) appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2000') InfantVisitFactory( appointment=appointment, reason=SCHEDULED) appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2010') InfantVisitFactory( appointment=appointment, reason=SCHEDULED) appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2030') InfantVisitFactory( appointment=appointment, reason=MISSED_VISIT) appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2060') InfantVisitFactory( appointment=appointment, reason=SCHEDULED) self.assertEqual(CrfMetaData.objects.filter( entry_status=UNKEYED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantcircumcision', appointment=appointment).count(), 1)
def test_congentinal_yes(self): postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=self.registered_subject) self.assertEqual(postnatal_enrollment.enrollment_hiv_status, POS) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory(appointment=self.appointment) appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=appointment) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit) registered_subject_infant = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del) appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2000') infant_visit = InfantVisitFactory(appointment=appointment) InfantBirthDataFactory(infant_visit=infant_visit) self.assertEqual( CrfMetaData.objects.filter( entry_status=NEW, crf_entry__app_label='mb_infant', crf_entry__model_name='infantcongenitalanomalies', appointment=appointment).count(), 1)
def test_if_maternal_pos_dna_pcr_required(self): postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) self.assertEqual(postnatal_enrollment.enrollment_hiv_status, POS) self.assertTrue(postnatal_enrollment.is_eligible) appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory(appointment=appointment) appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=appointment) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit) registered_subject_infant = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del) for code in ['2000', '2010', '2030', '2060', '2090', '2120']: appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code=code) InfantVisitFactory( appointment=appointment, reason=SCHEDULED) self.assertEqual(RequisitionMetaData.objects.filter( entry_status=REQUIRED, lab_entry__requisition_panel__name='DNA PCR', lab_entry__app_label='mb_lab', lab_entry__model_name='infantrequisition', appointment=appointment).count(), 1)
def test_infantbirtharv_required_on_postnatal_enrollment_pos(self): postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) self.assertEqual(postnatal_enrollment.enrollment_hiv_status, POS) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory(appointment=self.appointment) appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=appointment) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit) registered_subject_infant = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del) appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2000') InfantVisitFactory(appointment=appointment, reason=SCHEDULED) self.assertEqual( CrfMetaData.objects.filter( entry_status=UNKEYED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantbirtharv', appointment=appointment).count(), 1)
def setUp(self): super(TestInfantFu, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_eligibility.registered_subject PostnatalEnrollmentFactory(registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_birth': self.infant_birth.id, 'infant_visit': self.infant_visit.id, 'physical_assessment': NO, 'diarrhea_illness': NO, 'has_dx': NO, 'was_hospitalized': NO, }
def test_infant_arv_proph_not_required_from_2010(self): """Test that infant arv proph is required from 2010 visit""" postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, valid_regimen=NOT_APPLICABLE, valid_regimen_duration=NOT_APPLICABLE, rapid_test_done=YES, rapid_test_date=timezone.now(), rapid_test_result=NEG) self.assertEqual(postnatal_enrollment.enrollment_hiv_status, NEG) maternal_appointment_1000M = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') MaternalVisitFactory(appointment=maternal_appointment_1000M) maternal_appointment_2000M = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit_2000M = MaternalVisitFactory(appointment=maternal_appointment_2000M) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit_2000M) registered_subject_infant = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del) infant_appointment_2000 = Appointment.objects.get( visit_definition__code='2000', registered_subject=registered_subject_infant) InfantVisitFactory(appointment=infant_appointment_2000) self.assertFalse(CrfMetaData.objects.filter( entry_status=NOT_REQUIRED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantarvproph', appointment=infant_appointment_2000).exists()) infant_appointment_2010 = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2010') InfantVisitFactory( appointment=infant_appointment_2010, reason=SCHEDULED) self.assertEqual(CrfMetaData.objects.filter( entry_status=NOT_REQUIRED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantarvproph', appointment=infant_appointment_2010).count(), 1)
def setUp(self): super(TestInfantBirthRecordExam, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_consent.registered_subject PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES, ) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=maternal_visit) self.registered_subject_infant = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=self.registered_subject_infant, maternal_labour_del=maternal_labour_del, gender='F', ) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject_infant, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_birth': self.infant_birth.id, 'infant_visit': self.infant_visit.id, 'infant_exam_date': timezone.now().date(), 'general_activity': 'NORMAL', 'abnormal_activity': '', 'physical_exam_result': 'NORMAL', 'heent_exam': YES, 'heent_no_other': '', 'resp_exam': YES, 'resp_exam_other': '', 'cardiac_exam': YES, 'cardiac_exam_other': '', 'abdominal_exam': YES, 'abdominal_exam_other': '', 'skin_exam': YES, 'skin_exam_other': '', 'neurologic_exam': YES, 'neuro_exam_other': '', 'other_exam_info': 'NA', }
def setUp(self): super(TestInfantStoolCollection, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory(registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_eligibility.registered_subject PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) self.appointment = Appointment.objects.get(registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory(appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_visit': self.infant_visit.id, 'sample_obtained': NO, 'nappy_type': NOT_APPLICABLE, 'other_nappy': '', 'stool_collection': NOT_APPLICABLE, 'stool_collection_time': '', 'stool_stored': NOT_APPLICABLE, 'past_diarrhea': NO, 'diarrhea_past_24hrs': NOT_APPLICABLE, 'antibiotics_7days': NO, 'antibiotic_dose_24hrs': NOT_APPLICABLE }
def setUp(self): super(TestInfantArvProph, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_consent.registered_subject PostnatalEnrollmentFactory(registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.infant_birth_arv = InfantBirthArvFactory( infant_visit=self.infant_visit, azt_discharge_supply=YES) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_visit': self.infant_visit.id, 'prophylatic_nvp': YES, 'arv_status': 'modified', }
def infant_arv_proph_setup(self): postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) self.assertEqual(postnatal_enrollment.enrollment_hiv_status, POS) maternal_appointment_1000M = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') MaternalVisitFactory(appointment=maternal_appointment_1000M) maternal_appointment_2000M = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit_2000 = MaternalVisitFactory(appointment=maternal_appointment_2000M) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit_2000) registered_subject_infant = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del) infant_appointment_2000 = Appointment.objects.get( visit_definition__code='2000', registered_subject=registered_subject_infant) InfantVisitFactory(appointment=infant_appointment_2000) infant_appointment_2010 = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2010') infant_visit_2010 = InfantVisitFactory( appointment=infant_appointment_2010, reason=SCHEDULED) self.assertEqual(CrfMetaData.objects.filter( entry_status=UNKEYED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantarvproph', appointment=infant_appointment_2010).count(), 1) InfantArvProphFactory(infant_visit=infant_visit_2010, prophylatic_nvp=YES, arv_status=NO_MODIFICATIONS) self.assertEqual(CrfMetaData.objects.filter( entry_status=KEYED, crf_entry__app_label='mb_infant', crf_entry__model_name='infantarvproph', appointment=infant_appointment_2010).count(), 1) return registered_subject_infant
def setUp(self): super(TestInfantImmunizations, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_eligibility.registered_subject PostnatalEnrollmentFactory(registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) appointment1 = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') InfantVisitFactory(appointment=appointment1) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_visit': self.infant_visit.id, 'vaccines_received': YES, 'vaccines_missed': NO }
def test_offstudy_meta_data_created_on_visit(self): self.infant_visit = InfantVisitFactory( appointment=self.infant_appointment, study_status=OFF_STUDY, reason=COMPLETED_PROTOCOL_VISIT) self.assertEqual( CrfMetaData.objects.filter( entry_status=NEW, crf_entry__app_label='mb_infant', crf_entry__model_name='infantoffstudy', appointment=self.infant_appointment).count(), 1)
def test_validate_offstudy_date(self): self.infant_visit = InfantVisitFactory( appointment=self.infant_appointment, reason=COMPLETED_PROTOCOL_VISIT) self.data['infant_visit'] = self.infant_visit.id self.data['offstudy_date'] = date(2015, 10, 6) offstudy_form = InfantOffStudyForm(data=self.data) offstudy_form.is_valid() self.assertIn("Off study date cannot be before consent date", offstudy_form.errors.get("__all__"))
def setUp(self): super(TestInfantBirthData, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_eligibility.registered_subject PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory(appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( relative_identifier=self.registered_subject.subject_identifier, subject_type=INFANT) self.infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_birth': self.infant_birth.id, 'infant_visit': self.infant_visit.id, 'weight_kg': 3.61, 'infant_length': 89.97, 'head_circumference': 39.30, 'apgar_score': NO, 'apgar_score_min_1': '', 'apgar_score_min_5': '', 'apgar_score_min_10': '', 'congenital_anomalities': NO}
def test_offstudy2(self): self.infant_visit = InfantVisitFactory( appointment=self.infant_appointment, study_status=OFF_STUDY, reason=COMPLETED_PROTOCOL_VISIT) infant_birth_visit_schedule = site_visit_schedules.get_visit_schedule( 'birth visit schedule') self.assertEqual( Appointment.objects.filter( registered_subject=self.infant_registered_subject).count(), len(infant_birth_visit_schedule.visit_definitions)) InfantOffStudyFactory( report_datetime=timezone.now(), registered_subject=self.infant_appointment.registered_subject, infant_visit=self.infant_visit, offstudy_date=date.today()) self.assertEqual( Appointment.objects.filter( registered_subject=self.infant_registered_subject).count(), 1)
def setUp(self): super(TestInfantBirthArv, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_consent.registered_subject PostnatalEnrollmentFactory(registered_subject=self.registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=self.maternal_visit) registered_subject_infant = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=registered_subject_infant, maternal_labour_del=maternal_labour_del) self.appointment = Appointment.objects.get( registered_subject=registered_subject_infant, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.data = { 'report_datetime': timezone.now(), 'infant_visit': self.infant_visit.id, 'azt_after_birth': YES, 'azt_dose_date': timezone.now().date(), 'azt_additional_dose': YES, 'sdnvp_after_birth': YES, 'nvp_dose_date': timezone.now().date(), }
def infant_instances(self): instances = [] maternal_eligibility = MaternalEligibilityFactory() instances.append(maternal_eligibility) maternal_consent = MaternalConsentFactory( registered_subject=maternal_eligibility.registered_subject) instances.append(maternal_consent) maternal_registered_subject = maternal_consent.registered_subject instances.append(maternal_registered_subject) post_natal_enrollment = PostnatalEnrollmentFactory( registered_subject=maternal_registered_subject, current_hiv_status=POS, evidence_hiv_status=YES) instances.append(post_natal_enrollment) maternal_appointment_1000 = Appointment.objects.get(registered_subject=maternal_registered_subject, visit_definition__code='1000M') instances.append(maternal_appointment_1000) maternal_visit_1000 = MaternalVisitFactory(appointment=maternal_appointment_1000) instances.append(maternal_visit_1000) maternal_appointment_2000 = Appointment.objects.get(registered_subject=maternal_registered_subject, visit_definition__code='2000M') instances.append(maternal_appointment_2000) maternal_visit_2000 = MaternalVisitFactory(appointment=maternal_appointment_2000) instances.append(maternal_visit_2000) maternal_labour_del = MaternalLabourDelFactory(maternal_visit=maternal_visit_2000) instances.append(maternal_labour_del) infant_registered_subject = RegisteredSubject.objects.get( relative_identifier=maternal_registered_subject.subject_identifier, subject_type=INFANT) instances.append(infant_registered_subject) infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) instances.append(infant_birth) infant_appointment_2000 = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') instances.append(infant_appointment_2000) infant_visit_2000 = InfantVisitFactory(appointment=infant_appointment_2000) instances.append(infant_visit_2000) infant_congenital_anomalies = InfantCongenitalAnomaliesFactory(infant_visit=infant_visit_2000) instances.append(infant_congenital_anomalies) cardio_disorder = InfantCardioDisorderFactory(congenital_anomalies=infant_congenital_anomalies) instances.append(cardio_disorder) cleft_disorder = InfantCleftDisorderFactory(congenital_anomalies=infant_congenital_anomalies) instances.append(cleft_disorder) infant_birth_feed_vaccine = InfantBirthFeedVaccineFactory(infant_visit=infant_visit_2000) instances.append(infant_birth_feed_vaccine) infant_vaccines = InfantVaccinesFactory(infant_birth_feed_vaccine=infant_birth_feed_vaccine) instances.append(infant_vaccines) infant_appointment_2010 = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') instances.append(infant_appointment_2010) infant_visit_2010 = InfantVisitFactory(appointment=infant_appointment_2010) infant_fu_immuninization = InfantFuImmunizationsFactory(infant_visit=infant_visit_2010) instances.append(infant_fu_immuninization) infant_fu_new_med = InfantFuNewMedFactory(infant_visit=infant_visit_2010) instances.append(infant_fu_new_med) infant_fu_new_med_items = InfantFuNewMedItemsFactory(infant_fu_med=infant_fu_new_med) instances.append(infant_fu_new_med_items) vaccines_received = VaccinesReceivedFactory(infant_fu_immunizations=infant_fu_immuninization) instances.append(vaccines_received) vaccines_missed = VaccinesMissedFactory(infant_fu_immunizations=infant_fu_immuninization) instances.append(vaccines_missed) infant_fu_dx = InfantFuDxFactory(infant_visit=infant_visit_2010) instances.append(infant_fu_dx) infant_fu_dx_items = InfantFuDxItemsFactory(infant_fu_dx=infant_fu_dx) instances.append(infant_fu_dx_items) infant_arv_proph = InfantArvProphFactory(infant_visit=infant_visit_2010) instances.append(infant_arv_proph) infant_arv_proph_mod = InfantArvProphModFactory(infant_arv_proph=infant_arv_proph) instances.append(infant_arv_proph_mod) return instances
def setUp(self): super(TestInfantFeedingForm, self).setUp() self.maternal_eligibility = MaternalEligibilityFactory() self.maternal_consent = MaternalConsentFactory( registered_subject=self.maternal_eligibility.registered_subject) self.registered_subject = self.maternal_eligibility.registered_subject PostnatalEnrollmentFactory(registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M') self.maternal_visit = MaternalVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=self.appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject.subject_identifier) self.infant_birth = InfantBirthFactory( registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2030') self.infant_visit_2030 = InfantVisitFactory( appointment=self.appointment) self.appointment = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2060') self.infant_visit = InfantVisitFactory(appointment=self.appointment) self.maternal_eligibility2 = MaternalEligibilityFactory() self.maternal_consent2 = MaternalConsentFactory( registered_subject=self.maternal_eligibility2.registered_subject) self.registered_subject2 = self.maternal_eligibility2.registered_subject PostnatalEnrollmentFactory(registered_subject=self.registered_subject2, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) self.appointment2 = Appointment.objects.get( registered_subject=self.registered_subject2, visit_definition__code='1000M') self.maternal_visit2 = MaternalVisitFactory( appointment=self.appointment2) self.appointment2 = Appointment.objects.get( registered_subject=self.registered_subject2, visit_definition__code='2000M') maternal_visit2 = MaternalVisitFactory(appointment=self.appointment2) maternal_labour_del2 = MaternalLabourDelFactory( maternal_visit=maternal_visit2) infant_registered_subject2 = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=self.registered_subject2.subject_identifier) self.infant_birth2 = InfantBirthFactory( registered_subject=infant_registered_subject2, maternal_labour_del=maternal_labour_del2) self.appointment2 = Appointment.objects.get( registered_subject=infant_registered_subject2, visit_definition__code='2000') self.infant_visit2 = InfantVisitFactory(appointment=self.appointment2) self.appointment2 = Appointment.objects.get( registered_subject=infant_registered_subject2, visit_definition__code='2010') self.infant_visit2 = InfantVisitFactory(appointment=self.appointment2) self.appointment2 = Appointment.objects.get( registered_subject=infant_registered_subject2, visit_definition__code='2030') self.infant_visit2 = InfantVisitFactory(appointment=self.appointment2) self.data = { 'report_datetime': timezone.now(), 'infant_birth': self.infant_birth.id, 'infant_visit': self.infant_visit.id, 'last_att_sche_visit': date(2015, 9, 15), 'other_feeding': YES, 'formula_intro_occur': YES, 'formula_intro_date': None, 'took_formula': NO, 'is_first_formula': NO, 'date_first_formula': None, 'est_date_first_formula': None, 'water': YES, 'juice': YES, 'cow_milk': YES, 'cow_milk_yes': 'N/A', 'other_milk': YES, 'other_milk_animal': YES, 'milk_boiled': YES, 'fruits_veg': YES, 'cereal_porridge': YES, 'solid_liquid': YES, 'rehydration_salts': YES, 'water_used': 'N/A', 'water_used_other': None, 'ever_breastfeed': YES, 'complete_weaning': YES, 'weaned_completely': YES, 'most_recent_bm': None, 'times_breastfed': '<1 per week' }
def setUp(self): super(TestInfantDeathReportForm, self).setUp() maternal_eligibility = MaternalEligibilityFactory( report_datetime=timezone.now()) maternal_consent = MaternalConsentFactory( registered_subject=maternal_eligibility.registered_subject) registered_subject = maternal_consent.registered_subject maternal_subject_identifier = maternal_consent.subject_identifier postnatal_enrollment = PostnatalEnrollmentFactory( registered_subject=registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_date=date.today(), rapid_test_result=NEG) self.assertTrue(postnatal_enrollment.is_eligible) appointment1 = Appointment.objects.get( registered_subject=registered_subject, visit_definition__code='1000M') MaternalVisitFactory(appointment=appointment1) appointment = Appointment.objects.get( registered_subject=postnatal_enrollment.registered_subject, visit_definition__code='2000M') maternal_visit = MaternalVisitFactory(appointment=appointment) maternal_labour_del = MaternalLabourDelFactory( maternal_visit=maternal_visit) infant_registered_subject = RegisteredSubject.objects.get( subject_type=INFANT, relative_identifier=maternal_subject_identifier) InfantBirthFactory(registered_subject=infant_registered_subject, maternal_labour_del=maternal_labour_del) appointment2000 = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2000') InfantVisitFactory(appointment=appointment2000) appointment2010 = Appointment.objects.get( registered_subject=infant_registered_subject, visit_definition__code='2010') infant_visit = InfantVisitFactory(appointment=appointment2010) # requery infant_registered_subject = RegisteredSubject.objects.get( pk=infant_registered_subject.pk) self.data = { 'registered_subject': infant_registered_subject.id, 'report_datetime': timezone.now(), 'infant_visit': infant_visit.id, 'death_date': timezone.now().date(), 'death_cause_info': 'N/A', 'death_cause_info_other': NO, 'perform_autopsy': NO, 'death_cause': NO, 'death_cause_category': NO, 'death_cause_other': None, 'illness_duration': None, 'death_medical_responsibility': None, 'participant_hospitalized': YES, 'reason_hospitalized': None, 'days_hospitalized': 0, 'study_drug_relate': None, 'infant_nvp_relate': None, 'haart_relate': None, 'trad_med_relate': None, 'comment': None, }