Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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(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(TestReproductiveHealthForm, self).setUp()
        maternal_eligibility = MaternalEligibilityFactory()
        maternal_consent = MaternalConsentFactory(
            registered_subject=maternal_eligibility.registered_subject)
        registered_subject = maternal_consent.registered_subject
        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)

        appointment1000 = Appointment.objects.get(
            registered_subject=postnatal_enrollment.registered_subject,
            visit_definition__code='1000M')
        appointment2000 = Appointment.objects.get(
            registered_subject=postnatal_enrollment.registered_subject,
            visit_definition__code='2000M')
        appointment2010 = Appointment.objects.get(
            registered_subject=postnatal_enrollment.registered_subject,
            visit_definition__code='2010M')

        MaternalVisitFactory(appointment=appointment1000, reason=SCHEDULED)
        MaternalVisitFactory(appointment=appointment2000, reason=SCHEDULED)
        maternal_visit = MaternalVisitFactory(appointment=appointment2010,
                                              reason=SCHEDULED)

        contraceptives = Contraceptives.objects.exclude(
            name__icontains='other').exclude(
                name__icontains=NOT_APPLICABLE).first()

        maternal_relatives = MaternalRelatives.objects.exclude(
            name__icontains='other').exclude(
                name__icontains=NOT_APPLICABLE).first()

        self.data = {
            'report_datetime': timezone.now(),
            'maternal_visit': maternal_visit.id,
            'more_children': YES,
            'next_child': 'between 2-5years from now',
            'contraceptive_measure': YES,
            'contraceptive_partner': YES,
            'contraceptive_relative': [maternal_relatives.id],
            'influential_decision_making': 'partner_most_influential',
            'uses_contraceptive': YES,
            'contr': [contraceptives.id],
            'pap_smear': YES,
            'pap_smear_date': date.today(),
            'pap_smear_estimate': NO,
            'pap_smear_result': YES,
            'pap_smear_result_status': 'normal',
            'pap_smear_result_abnormal': None,
            'srh_referral': YES
        }
 def test_visit_reason_unscheduled(self):
     appointment = Appointment.objects.get(
         registered_subject=self.registered_subject,
         visit_definition__code='2000M')
     MaternalVisitFactory(appointment=self.appointment, reason=SCHEDULED)
     maternal_visit = MaternalVisitFactory(appointment=appointment,
                                           reason=UNSCHEDULED)
     MaternalRequistionFactory(panel=self.panel,
                               aliquot_type=self.aliquot_type,
                               maternal_visit=maternal_visit)
     self.assertEqual(MaternalRequisition.objects.all().count(), 1)
Exemple #7
0
 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 setUp(self):
        super(TestViralLoadRequisition, 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=POS,
                                   evidence_hiv_status=YES,
                                   rapid_test_done=NOT_APPLICABLE)
        self.appointment = Appointment.objects.get(
            registered_subject=self.registered_subject,
            visit_definition__code='1000M')
        self.maternal_visit = MaternalVisitFactory(
            appointment=self.appointment)

        def test_viral_load_meta_data_for_pos(self):
            labs = ['Viral Load']
            maternal_visits = [
                '2000M', '2010M', '2030M', '2060M', '2090M', '2120M'
            ]
            for visit in maternal_visits:
                appointment = Appointment.objects.get(
                    registered_subject=self.registered_subject,
                    visit_definition__code=visit)
                visit = MaternalVisitFactory(appointment=appointment)
                for mylab in labs:
                    lab_entry = LabEntry.objects.get(
                        model_name=mylab,
                        visit_definition_id=appointment.visit_definition_id)
                    lab_meta_data = RequisitionMetaData.objects.get(
                        lab_entry=lab_entry, appointment=appointment)
                    self.assertEqual(lab_meta_data.entry_status, 'NEW')
Exemple #9
0
 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(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 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
     }
Exemple #12
0
    def test_serialize_deserialize(self):
        """Confirms all models have a get_by_natural_key manager method."""
        maternal_eligibility = MaternalEligibilityFactory()
        maternal_consent = MaternalConsentFactory(
            registered_subject=maternal_eligibility.registered_subject)
        specimen_consent = SpecimenConsentFactory(
            registered_subject=maternal_consent.registered_subject)
        antenatal_enrollment = AntenatalEnrollmentFactory(
            registered_subject=specimen_consent.registered_subject,
            current_hiv_status=POS,
            evidence_hiv_status=YES,
            rapid_test_done=NO)
        appointment = Appointment.objects.get(
            registered_subject=antenatal_enrollment.registered_subject,
            visit_definition__code='1000M')
        maternal_visit = MaternalVisitFactory(appointment=appointment)
        maternal_locator = MaternalLocatorFactory(
            maternal_visit=maternal_visit,
            registered_subject=antenatal_enrollment.registered_subject,
        )
        maternal_demographics = MaternalDemographics.objects.create(
            maternal_visit=maternal_visit,
            report_datetime=timezone.now(),
            marital_status='Single',
            ethnicity='Black African',
            highest_education='Tertiary',
            current_occupation='Student',
            provides_money='Mother',
            money_earned='P1001-5000 per month / P212 - 1157 per week',
            own_phone=YES,
            house_electrified=YES,
            house_fridge=YES,
            cooking_method='Gas or electric stove',
            toilet_facility='Indoor toilet',
            house_people_number=1,
            house_type='Formal: Tin-roofed, concrete walls')
        instances = []
        instances.append(maternal_eligibility)
        instances.append(maternal_consent)
        instances.append(specimen_consent)
        instances.append(antenatal_enrollment)
        instances.append(maternal_visit)
        instances.append(maternal_locator)
        instances.append(maternal_demographics)
        for obj in instances:
            natural_key = obj.natural_key()
            get_obj = obj.__class__.objects.get_by_natural_key(*natural_key)
            self.assertEqual(obj.pk, get_obj.pk)

        for obj in instances:
            outgoing_transaction = SerializeToTransaction().serialize(
                obj.__class__, obj, False, True, 'default')
            for transaction in serializers.deserialize(
                    "json",
                    FieldCryptor('aes',
                                 'local').decrypt(outgoing_transaction.tx)):
                self.assertEqual(transaction.object.pk, obj.pk)
    def setUp(self):
        super(TestMaternalSrhForm, self).setUp()
        maternal_eligibility = MaternalEligibilityFactory()
        maternal_consent = MaternalConsentFactory(
            registered_subject=maternal_eligibility.registered_subject)
        registered_subject = maternal_consent.registered_subject
        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)

        appointment1000 = Appointment.objects.get(
            registered_subject=postnatal_enrollment.registered_subject,
            visit_definition__code='1000M')
        appointment2000 = Appointment.objects.get(
            registered_subject=postnatal_enrollment.registered_subject,
            visit_definition__code='2000M')
        appointment2010 = Appointment.objects.get(
            registered_subject=postnatal_enrollment.registered_subject,
            visit_definition__code='2010M')

        MaternalVisitFactory(appointment=appointment1000, reason=SCHEDULED)
        MaternalVisitFactory(appointment=appointment2000, reason=SCHEDULED)
        maternal_visit = MaternalVisitFactory(appointment=appointment2010,
                                              reason=SCHEDULED)

        contraceptives = Contraceptives.objects.exclude(
            name__icontains='other').exclude(
                name__icontains=NOT_APPLICABLE).first()

        self.data = {
            'report_datetime': timezone.now(),
            'maternal_visit': maternal_visit.id,
            'seen_at_clinic': YES,
            'reason_unseen_clinic': None,
            'reason_unseen_clinic_other': None,
            'is_contraceptive_initiated': YES,
            'contr': [contraceptives.id],
            'contr_other': None,
            'reason_not_initiated': None
        }
    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}
Exemple #15
0
 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(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',
        }
Exemple #17
0
    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
        }
Exemple #18
0
    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 setUp(self):
        super(TestOffStudy, self).setUp()
        self.maternal_eligibility = MaternalEligibilityFactory()
        self.registered_subject = self.maternal_eligibility.registered_subject
        self.maternal_consent = MaternalConsentFactory(
            registered_subject=self.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)
        self.infant_registered_subject = RegisteredSubject.objects.get(
            relative_identifier=self.registered_subject.subject_identifier,
            subject_type=INFANT)
        self.infant_birth = InfantBirthFactory(
            registered_subject=self.infant_registered_subject,
            maternal_labour_del=maternal_labour_del)
        self.infant_appointment = Appointment.objects.get(
            registered_subject=self.infant_registered_subject,
            visit_definition__code='2000')

        self.data = {
            'registered_subject': self.registered_subject.id,
            'reason': 'not_{}'.format(MIN_AGE_OF_CONSENT),
            'has_scheduled_data': YES,
            'infant_visit': None,
            'offstudy_date': timezone.now().date(),
        }
 def test_visit_reason_unscheduled(self):
     maternal_visit = MaternalVisitFactory(appointment=self.appointment,
                                           reason=UNSCHEDULED)
     self.data['maternal_visit'] = maternal_visit.id
     self.data['is_drawn'] = YES
     self.data['drawn_datetime'] = timezone.now() - timezone.timedelta(
         hours=1)
     self.data['item_count_total'] = 1
     self.data['estimated_volume'] = 5.0
     self.data['reason_not_drawn'] = None
     self.data['priority'] = 'normal'
     form = MaternalRequisitionForm(data=self.data)
     self.assertTrue(form.is_valid())
    def setUp(self):
        super(TestInfantBirth, self).setUp()

        maternal_eligibility = MaternalEligibilityFactory()
        maternal_consent = MaternalConsentFactory(
            registered_subject=maternal_eligibility.registered_subject)
        registered_subject = maternal_consent.registered_subject
        postnatal_enrollment = PostnatalEnrollmentFactory(
            registered_subject=registered_subject,
            current_hiv_status=NEG,
            evidence_hiv_status=YES,
            rapid_test_done=YES,
            rapid_test_result=NEG)
        self.assertTrue(postnatal_enrollment.is_eligible)
        appointment1000 = Appointment.objects.get(
            registered_subject=registered_subject,
            visit_definition__code='1000M')
        appointment2000 = Appointment.objects.get(
            registered_subject=registered_subject,
            visit_definition__code='2000M')

        MaternalVisitFactory(appointment=appointment1000)
        maternal_visit = MaternalVisitFactory(appointment=appointment2000)
        self.maternal_labour_del = MaternalLabourDelFactory(
            maternal_visit=maternal_visit)
        self.infant_registered_subject = RegisteredSubject.objects.get(
            relative_identifier=registered_subject.subject_identifier,
            subject_type=INFANT)

        self.data = {
            'report_datetime': timezone.now(),
            'registered_subject': self.infant_registered_subject.id,
            'maternal_labour_del': self.maternal_labour_del.id,
            'first_name': 'FIRST NAME',
            'initials': 'FN',
            'dob': self.maternal_labour_del.delivery_datetime.date(),
            'gender': FEMALE
        }
 def test_viral_load_meta_data_for_pos(self):
     labs = ['Viral Load']
     maternal_visits = [
         '2000M', '2010M', '2030M', '2060M', '2090M', '2120M'
     ]
     for visit in maternal_visits:
         appointment = Appointment.objects.get(
             registered_subject=self.registered_subject,
             visit_definition__code=visit)
         visit = MaternalVisitFactory(appointment=appointment)
         for mylab in labs:
             lab_entry = LabEntry.objects.get(
                 model_name=mylab,
                 visit_definition_id=appointment.visit_definition_id)
             lab_meta_data = RequisitionMetaData.objects.get(
                 lab_entry=lab_entry, appointment=appointment)
             self.assertEqual(lab_meta_data.entry_status, 'NEW')
 def setUp(self):
     super(TestMaternalRequisitionForm, self).setUp()
     self.maternal_eligibility = MaternalEligibilityFactory()
     self.maternal_consent = MaternalConsentFactory(
         registered_subject=self.maternal_eligibility.registered_subject,
         study_site=self.study_site)
     self.registered_subject = self.maternal_consent.registered_subject
     postnatal_enrollment = PostnatalEnrollmentFactory(
         current_hiv_status=POS,
         evidence_hiv_status=YES,
         registered_subject=self.registered_subject,
         will_breastfeed=YES)
     self.assertTrue(postnatal_enrollment.is_eligible)
     appointment = Appointment.objects.get(
         registered_subject=self.registered_subject,
         visit_definition__code='1000M')
     MaternalVisitFactory(appointment=appointment, reason=SCHEDULED)
     self.appointment = Appointment.objects.get(
         registered_subject=self.registered_subject,
         visit_definition__code='2000M')
     self.panel = Panel.objects.get(name='Breast Milk (Storage)')
     self.aliquot_type = AliquotType.objects.get(alpha_code='WB')
     self.data = {
         'maternal_visit': None,
         'requisition_identifier': 'ZXDF39U',
         'requisition_datetime': timezone.now(),
         'report_datetime': timezone.now(),
         'is_drawn': NO,
         'reason_not_drawn': 'collection_failed',
         'drawn_datetime': '',
         'study_site': self.study_site,
         'panel': self.panel.id,
         'aliquot_type': self.aliquot_type.id,
         'item_type': 'tube',
         'item_count_total': '',
         'estimated_volume': '',
         'priority': '',
         'comments': '',
     }
Exemple #24
0
    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,
        }
 def maternal_instances(self):
     instances = []
     maternal_eligibility = MaternalEligibilityFactory()
     instances.append(maternal_eligibility)
     maternal_consent = MaternalConsentFactory(
         registered_subject=maternal_eligibility.registered_subject)
     instances.append(maternal_consent)
     specimen_consent = SpecimenConsentFactory(
         registered_subject=maternal_consent.registered_subject)
     instances.append(specimen_consent)
     antenatal_enrollment = AntenatalEnrollmentFactory(
         registered_subject=specimen_consent.registered_subject,
         current_hiv_status=POS,
         evidence_hiv_status=YES,
         rapid_test_done=NO)
     instances.append(antenatal_enrollment)
     post_natal_enrollment = PostnatalEnrollmentFactory(
         registered_subject=specimen_consent.registered_subject, )
     instances.append(post_natal_enrollment)
     appointment_1000 = Appointment.objects.get(
         registered_subject=antenatal_enrollment.registered_subject,
         visit_definition__code='1000M')
     instances.append(appointment_1000)
     maternal_visit_1000 = MaternalVisitFactory(
         appointment=appointment_1000)
     instances.append(maternal_visit_1000)
     maternal_locator = MaternalLocatorFactory(
         maternal_visit=maternal_visit_1000,
         registered_subject=antenatal_enrollment.registered_subject,
     )
     instances.append(maternal_locator)
     maternal_demographics = MaternalDemographicsFactory(
         maternal_visit=maternal_visit_1000, )
     instances.append(maternal_demographics)
     appointment_2000 = Appointment.objects.get(
         registered_subject=antenatal_enrollment.registered_subject,
         visit_definition__code='2000M')
     instances.append(appointment_2000)
     maternal_visit_2000 = MaternalVisitFactory(
         appointment=appointment_2000)
     instances.append(maternal_visit_2000)
     appointment_2010 = Appointment.objects.get(
         registered_subject=antenatal_enrollment.registered_subject,
         visit_definition__code='2010M')
     maternal_visit_2010 = MaternalVisitFactory(
         appointment=appointment_2010)
     instances.append(maternal_visit_2010)
     reproductive_health = ReproductiveHealthFactory(
         maternal_visit=maternal_visit_2010)
     instances.append(reproductive_health)
     maternal_arv_post = MaternalArvPostFactory(
         maternal_visit=maternal_visit_2010)
     instances.append(maternal_arv_post)
     maternal_arv_post_mod = MaternalArvPostModFactory(
         maternal_arv_post=maternal_arv_post)
     instances.append(maternal_arv_post_mod)
     maternal_arv_preg = MaternalArvPregFactory(
         maternal_visit=maternal_visit_2000)
     instances.append(maternal_arv_preg)
     maternal_arv = MaternalArvFactory(maternal_arv_preg=maternal_arv_preg)
     instances.append(maternal_arv)
     maternal_post_fu_med = MaternalPostFuMedFactory(
         maternal_visit=maternal_visit_2010)
     instances.append(maternal_post_fu_med)
     maternal_post_fu_items = MaternalPostFuMedItemsFactory(
         maternal_post_fu_med=maternal_post_fu_med)
     instances.append(maternal_post_fu_items)
     maternal_post_fu_dx = MaternalPostFuDxFactory(
         maternal_visit=maternal_visit_2010)
     instances.append(maternal_post_fu_dx)
     #         maternal_post_fu_dxt = MaternalPostFuDxTFactory(maternal_post_fu_dx=maternal_post_fu_dx)
     #         instances.append(maternal_post_fu_dxt)
     return instances
 def test_visit_reason_scheduled(self):
     maternal_visit = MaternalVisitFactory(appointment=self.appointment,
                                           reason=SCHEDULED)
     MaternalRequistionFactory(maternal_visit=maternal_visit,
                               panel=self.panel,
                               aliquot_type=self.aliquot_type)
    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'
        }