def test_offstudy3(self): PostnatalEnrollmentFactory( registered_subject=self.registered_subject, current_hiv_status=NEG, evidence_hiv_status=YES, rapid_test_done=YES, rapid_test_result=NEG) post_natal_visit_schedule = site_visit_schedules.get_visit_schedule('postnatal visit schedule') self.assertEqual(Appointment.objects.filter( registered_subject=self.registered_subject).count(), len(post_natal_visit_schedule.visit_definitions)) appointment = Appointment.objects.get( registered_subject=self.registered_subject, visit_definition__code='1000M', visit_instance='0') maternal_visit = MaternalVisitFactory( appointment=appointment, report_datetime=timezone.now(), study_status=OFF_STUDY, survival_status=ALIVE, reason=COMPLETED_PROTOCOL_VISIT) MaternalOffStudyFactory( registered_subject=appointment.registered_subject, maternal_visit=maternal_visit, report_datetime=timezone.now(), offstudy_date=date.today()) self.assertEqual(Appointment.objects.filter( registered_subject=self.registered_subject).count(), 1)
def test_offstudy2(self): self.infant_visit = InfantVisitFactory( appointment=self.infant_appointment, study_status=OFF_STUDY, reason=COMPLETED_PROTOCOL_VISIT) infant_birth_visit_schedule = site_visit_schedules.get_visit_schedule('birth visit schedule') self.assertEqual( Appointment.objects.filter( registered_subject=self.infant_registered_subject).count(), len(infant_birth_visit_schedule.visit_definitions)) InfantOffStudyFactory( report_datetime=timezone.now(), registered_subject=self.infant_appointment.registered_subject, infant_visit=self.infant_visit, offstudy_date=date.today()) self.assertEqual( Appointment.objects.filter( registered_subject=self.infant_registered_subject).count(), 1)
def test_offstudy2(self): self.infant_visit = InfantVisitFactory( appointment=self.infant_appointment, study_status=OFF_STUDY, reason=COMPLETED_PROTOCOL_VISIT) infant_birth_visit_schedule = site_visit_schedules.get_visit_schedule( 'birth visit schedule') self.assertEqual( Appointment.objects.filter( registered_subject=self.infant_registered_subject).count(), len(infant_birth_visit_schedule.visit_definitions)) InfantOffStudyFactory( report_datetime=timezone.now(), registered_subject=self.infant_appointment.registered_subject, infant_visit=self.infant_visit, offstudy_date=date.today()) self.assertEqual( Appointment.objects.filter( registered_subject=self.infant_registered_subject).count(), 1)