示例#1
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)
示例#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)
示例#3
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)
示例#4
0
    def test_serializing_deserialing_infant_death(self):
        InfantBirthFactory(
            registered_subject=self.registered_subject_infant, maternal_labour_del=self.maternal_labour_del)

        appointment = Appointment.objects.get(
            registered_subject=self.registered_subject_infant,
            visit_definition__code='2000')
        infant_visit = InfantVisitFactory(
            appointment=appointment)

        infant_death = InfantDeathReport.objects.create(
            infant_visit=infant_visit,
            report_datetime=timezone.now(),
            death_date=date(2015, 12, 15),
            cause_id=5,
            cause_category_id=2,
            illness_duration=2,
            diagnosis_code_id=2,
            medical_responsibility_id=1,
            registered_subject=self.registered_subject_infant
        )
        out_tx = SerializeToTransaction().serialize(
            infant_death.__class__, infant_death, False, True, 'default')
        serialized_objects = serializers.deserialize("json", FieldCryptor('aes', 'local').decrypt(out_tx.tx))
        for transaction in serialized_objects:
            self.assertEqual(transaction.object.pk, infant_death.pk)
示例#5
0
    def setUp(self):
        super(TestInfantVisitForm, 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=POS,
            evidence_hiv_status=YES,
            rapid_test_done=NOT_APPLICABLE,
            rapid_test_result=None,
            rapid_test_date=None)
        self.assertTrue(postnatal_enrollment.is_eligible)

        appointment = Appointment.objects.get(
            registered_subject=registered_subject,
            visit_definition__code='1000M')
        MaternalVisitFactory(appointment=appointment)
        appointment = Appointment.objects.get(
            registered_subject=registered_subject,
            visit_definition__code='2000M')
        maternal_visit = MaternalVisitFactory(appointment=appointment)
        maternal_labour_del = MaternalLabourDelFactory(
            maternal_visit=maternal_visit)

        self.registered_subject_infant = RegisteredSubject.objects.get(
            subject_type=INFANT,
            relative_identifier=registered_subject.subject_identifier)
        InfantBirthFactory(registered_subject=self.registered_subject_infant,
                           maternal_labour_del=maternal_labour_del)
        self.appointment = Appointment.objects.get(
            registered_subject=self.registered_subject_infant,
            visit_definition__code='2000')
    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 test_saving_infant_birth(self):
     """Test resaving an already existing infant birth data form"""
     InfantBirthFactory(registered_subject=self.infant_registered_subject,
                        maternal_labour_del=self.maternal_labour_del)
     form = InfantBirthForm(data=self.data)
     self.assertIn(
         'Infant birth record cannot be saved. An infant has already been registered'
         ' for this mother.', form.errors.get('__all__'))
示例#8
0
    def test_serializing_deserialing_infant_birth(self):
        infant_birth = InfantBirthFactory(
            registered_subject=self.registered_subject_infant, maternal_labour_del=self.maternal_labour_del)

        outgoing_tx = SerializeToTransaction().serialize(
            infant_birth.__class__, infant_birth, False, True, 'default')

        for transaction in serializers.deserialize("json", FieldCryptor('aes', 'local').decrypt(outgoing_tx.tx)):
            self.assertEqual(transaction.object.pk, infant_birth.pk)
示例#9
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)
示例#10
0
    def test_serializing_deserialing_infant_visit(self):
        InfantBirthFactory(
            registered_subject=self.registered_subject_infant, maternal_labour_del=self.maternal_labour_del)

        appointment = Appointment.objects.get(
            registered_subject=self.registered_subject_infant,
            visit_definition__code='2000')

        infant_visit = InfantVisitFactory(
            appointment=appointment)

        outgoing_tx = SerializeToTransaction().serialize(
            infant_visit.__class__, infant_visit, False, True, 'default')

        for transaction in serializers.deserialize("json", FieldCryptor('aes', 'local').decrypt(outgoing_tx.tx)):
            self.assertEqual(transaction.object.pk, infant_visit.pk)
示例#11
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
     }
    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}
示例#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
示例#16
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
        }
    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',
        }
示例#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(),
        }
示例#19
0
    def test_serializing_deserialing_visit_models_2000(self):
        InfantBirthFactory(
            registered_subject=self.registered_subject_infant, maternal_labour_del=self.maternal_labour_del)

        appointment = Appointment.objects.get(
            registered_subject=self.registered_subject_infant,
            visit_definition__code='2000')
        infant_visit = InfantVisitFactory(
            appointment=appointment)
        visit_model_classes = [
            InfantBirthExam, InfantBirthFeedVaccine, InfantStoolCollection, InfantCongenitalAnomalies]
        for visit_model_class in visit_model_classes:
            visit_model = visit_model_class.objects.create(
                infant_visit=infant_visit,
                report_datetime=timezone.now()
            )
            outgoing_tx = SerializeToTransaction().serialize(
                visit_model.__class__, visit_model, False, True, 'default')

            for transaction in serializers.deserialize("json", FieldCryptor('aes', 'local').decrypt(outgoing_tx.tx)):
                self.assertEqual(transaction.object.pk, visit_model.pk)
    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(),
        }
示例#21
0
    def test_serializing_deserialing_infant_offstudy(self):
        InfantBirthFactory(
            registered_subject=self.registered_subject_infant, maternal_labour_del=self.maternal_labour_del)

        appointment = Appointment.objects.get(
            registered_subject=self.registered_subject_infant,
            visit_definition__code='2000')
        infant_visit = InfantVisitFactory(
            appointment=appointment,
            reason=COMPLETED_PROTOCOL_VISIT)

        infant_offstudy = InfantOffStudy.objects.create(
            infant_visit=infant_visit,
            report_datetime=timezone.now(),
            registered_subject=self.registered_subject_infant,
            offstudy_date=date(2015, 12, 12),
        )
        outgoing_tx = SerializeToTransaction().serialize(
            infant_offstudy.__class__, infant_offstudy, False, True, 'default')

        for transaction in serializers.deserialize("json", FieldCryptor('aes', 'local').decrypt(outgoing_tx.tx)):
            self.assertEqual(transaction.object.pk, infant_offstudy.pk)
示例#22
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 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'
        }