def setUp(self):
        from pttrack.test_views import log_in_provider, build_provider
        log_in_provider(self.client, build_provider())

        self.contact_method = ContactMethod.objects.create(
            name="Carrier Pidgeon")

        self.contact_result = ContactResult.objects.create(
            name="Reached on phone", patient_reached=True)

        self.pt = Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=self.contact_method,
        )

        self.reftype = ReferralType.objects.create(
            name="Specialty", is_fqhc=False)
        self.refloc = ReferralLocation.objects.create(
            name='COH', address='Euclid Ave.')
        self.refloc.care_availiable.add(self.reftype)

        self.no_show_reason = NoShowReason.objects.create(name="Hella busy.")
Exemplo n.º 2
0
    def setUp(self):
        from pttrack.test_views import log_in_provider, build_provider
        log_in_provider(self.client, build_provider())

        self.contact_method = ContactMethod.objects.create(
            name="Carrier Pidgeon")

        self.contact_result = ContactResult.objects.create(
            name="Reached on phone", patient_reached=True)

        self.pt = Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 0o1, 0o1),
            patient_comfortable_with_english=False,
            preferred_contact_method=self.contact_method,
        )

        self.reftype = ReferralType.objects.create(name="Specialty",
                                                   is_fqhc=False)
        self.refloc = ReferralLocation.objects.create(name='COH',
                                                      address='Euclid Ave.')
        self.refloc.care_availiable.add(self.reftype)

        self.no_show_reason = NoShowReason.objects.create(name="Hella busy.")
    def setUp(self):
        """ Provides the same context in all the tests """
        from pttrack.test_views import log_in_provider, build_provider
        log_in_provider(self.client, build_provider())

        self.contact_method = ContactMethod.objects.create(
            name="Carrier Pidgeon")
        self.pt = Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=self.contact_method,
        )

        reftype = ReferralType.objects.create(
            name="Specialty", is_fqhc=False)
        refloc = ReferralLocation.objects.create(
            name='COH', address='Euclid Ave.')
        refloc.care_availiable.add(reftype)

        self.referral = models.Referral.objects.create(
            comments="Needs his back checked",
            status=models.Referral.STATUS_PENDING,
            kind=reftype,
            author=Provider.objects.first(),
            author_type=ProviderType.objects.first(),
            patient=self.pt
        )
        self.referral.location.add(refloc)

        self.followup_request = models.FollowupRequest.objects.create(
            referral=self.referral,
            contact_instructions="Call him",
            due_date=datetime.date(2018, 9, 01),
            author=Provider.objects.first(),
            author_type=ProviderType.objects.first(),
            patient=self.pt
        )

        self.successful_res = ContactResult.objects.create(
            name="Got him", patient_reached=True)
        self.unsuccessful_res = ContactResult.objects.create(
            name="Disaster", patient_reached=False)
        # Need to update referral location
        self.referral_location = ReferralLocation.objects.create(
            name="Franklin's Back Adjustment",
            address="1435 Sillypants Drive")
        self.noapt_reason = NoAptReason.objects.create(
            name="better things to do")
        self.noshow_reason = NoShowReason.objects.create(
            name="Hella busy.")
Exemplo n.º 4
0
    def test_workup_submit(self):
        """verify we can submit a valid workup as a signer and nonsigner"""

        for provider_type in ["Attending", "Clinical"]:
            provider = build_provider([provider_type])
            log_in_provider(self.client, provider)
            pt_id = Patient.objects.first().pk

            wu_count = models.Workup.objects.all().count()
            wu_data = wu_dict(units=True)
            wu_data['diagnosis_categories'] = [
                models.DiagnosisType.objects.first().pk]

            r = self.client.post(
                reverse('new-workup', args=(pt_id,)),
                data=wu_data)

            # print(dir(r))
            # # print(r.context)
            # print(r.context['form'].errors)

            # print(provider_type)
            # with open('./tmp.html', 'wb') as f:
            #     f.write(r.content)

            self.assertRedirects(r, reverse("new-action-item", args=(pt_id,)))
            self.assertEqual(wu_count + 1, models.Workup.objects.all().count())
            self.assertEqual(
                models.Workup.objects.last().signed(),
                provider.clinical_roles.first().signs_charts)
Exemplo n.º 5
0
    def test_workup_signing(self):
        '''
        Verify that singing is possible for attendings, and not for others.
        '''

        wu_url = "workup-sign"

        self.wu.diagnosis_categories.add(models.DiagnosisType.objects.first())
        self.wu.save()

        # Fresh workups should be unsigned
        self.assertFalse(self.wu.signed())

        # Providers with can_attend == False should not be able to sign
        for nonattesting_role in ["Preclinical", "Clinical", "Coordinator"]:
            log_in_provider(self.client, build_provider([nonattesting_role]))

            response = self.client.get(reverse(wu_url, args=(self.wu.id, )))
            self.assertRedirects(response,
                                 reverse('workup', args=(self.wu.id, )))
            self.assertFalse(models.Workup.objects.get(pk=self.wu.id).signed())

        # Providers able to attend should be able to sign.
        log_in_provider(self.client, build_provider(["Attending"]))

        response = self.client.get(reverse(wu_url, args=(self.wu.id, )))
        self.assertRedirects(
            response,
            reverse('workup', args=(self.wu.id, )),
        )
        # the self.wu has been updated, so we have to hit the db again.
        self.assertTrue(models.Workup.objects.get(pk=self.wu.id).signed())
Exemplo n.º 6
0
    def setUp(self):

        models.ClinicDate.objects.create(
            clinic_type=models.ClinicType.objects.first(),
            clinic_date=now().date(),
            gcal_id="tmp")

        self.provider = build_provider()
        log_in_provider(self.client, self.provider)

        self.wu = models.Workup.objects.create(
            clinic_day=models.ClinicDate.objects.first(),
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="A",
            PMH_PSH="B",
            meds="C",
            allergies="D",
            fam_hx="E",
            soc_hx="F",
            ros="",
            pe="",
            A_and_P="",
            author=models.Provider.objects.first(),
            author_type=ProviderType.objects.first(),
            patient=Patient.objects.first())
Exemplo n.º 7
0
    def setUp(self):

        log_in_provider(self.client, build_provider())

        models.IncomeRange.objects.create(name="Default")
        models.EducationLevel.objects.create(name="Default")
        models.WorkStatus.objects.create(name="Default")
        models.ResourceAccess.objects.create(name="Default")
        models.ChronicCondition.objects.create(name="Default")
        models.TransportationOption.objects.create(name="Default")
    def setUp(self):

        log_in_provider(self.client, build_provider())

        models.IncomeRange.objects.create(name="Default")
        models.EducationLevel.objects.create(name="Default")
        models.WorkStatus.objects.create(name="Default")
        models.ResourceAccess.objects.create(name="Default")
        models.ChronicCondition.objects.create(name="Default")
        models.TransportationOption.objects.create(name="Default")
Exemplo n.º 9
0
    def setUp(self):
        """ Provides the same context in all the tests """
        from pttrack.test_views import log_in_provider, build_provider
        log_in_provider(self.client, build_provider())

        self.contact_method = ContactMethod.objects.create(
            name="Carrier Pidgeon")
        self.pt = Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 0o1, 0o1),
            patient_comfortable_with_english=False,
            preferred_contact_method=self.contact_method,
        )

        reftype = ReferralType.objects.create(name="Specialty", is_fqhc=False)
        refloc = ReferralLocation.objects.create(name='COH',
                                                 address='Euclid Ave.')
        refloc.care_availiable.add(reftype)

        self.referral = models.Referral.objects.create(
            comments="Needs his back checked",
            status=models.Referral.STATUS_PENDING,
            kind=reftype,
            author=Provider.objects.first(),
            author_type=ProviderType.objects.first(),
            patient=self.pt)
        self.referral.location.add(refloc)

        self.followup_request = models.FollowupRequest.objects.create(
            referral=self.referral,
            contact_instructions="Call him",
            due_date=datetime.date(2018, 9, 0o1),
            author=Provider.objects.first(),
            author_type=ProviderType.objects.first(),
            patient=self.pt)

        self.successful_res = ContactResult.objects.create(
            name="Got him", patient_reached=True)
        self.unsuccessful_res = ContactResult.objects.create(
            name="Disaster", patient_reached=False)
        # Need to update referral location
        self.referral_location = ReferralLocation.objects.create(
            name="Franklin's Back Adjustment", address="1435 Sillypants Drive")
        self.noapt_reason = NoAptReason.objects.create(
            name="better things to do")
        self.noshow_reason = NoShowReason.objects.create(name="Hella busy.")
    def setUp(self):

        self.all_roles_provider = build_provider()

        log_in_provider(self.client, self.all_roles_provider)

        self.apt = models.Appointment.objects.create(
            comment='test this stuff',
            clindate=now().date(),
            clintime=time(9, 0),
            appointment_type='PSYCH_NIGHT',
            author=Provider.objects.first(),
            author_type=ProviderType.objects.filter(signs_charts=False).first(),
            patient=Patient.objects.first())
Exemplo n.º 11
0
    def setUp(self):

        self.all_roles_provider = build_provider()

        log_in_provider(self.client, self.all_roles_provider)

        self.apt = models.Appointment.objects.create(
            comment='test this stuff',
            clindate=now().date(),
            clintime=time(9, 0),
            appointment_type='PSYCH_NIGHT',
            author=Provider.objects.first(),
            author_type=ProviderType.objects.filter(signs_charts=False).first(),
            patient=Patient.objects.first())
Exemplo n.º 12
0
    def setUp(self):

        # build an attending and a clinical student
        self.attending = build_provider(roles=["Attending"],
                                        email='*****@*****.**')
        self.clinical_student = build_provider(roles=["Clinical"],
                                               email='*****@*****.**')
        log_in_provider(self.client, self.attending)

        self.wu_info = dict(chief_complaint="SOB",
                            diagnosis="MI",
                            HPI="A",
                            PMH_PSH="B",
                            meds="C",
                            allergies="D",
                            fam_hx="E",
                            soc_hx="F",
                            ros="",
                            pe="",
                            A_and_P="")

        # prepare a patient with an unsigned wu today, in addition to
        # what comes in in the fixture
        self.clinic_today = ClinicDate.objects.create(
            clinic_type=ClinicType.objects.first(),
            clinic_date=now().date(),
            gcal_id="tmp")

        self.pt2 = Patient.objects.create(
            first_name="Arthur",
            last_name="Miller",
            middle_name="",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1994, 01, 22),
            patient_comfortable_with_english=False,
            preferred_contact_method=ContactMethod.objects.first(),
        )
        self.wu2 = Workup.objects.create(
            clinic_day=self.clinic_today,
            author=self.clinical_student,
            author_type=self.clinical_student.clinical_roles.first(),
            patient=self.pt2,
            **self.wu_info)
Exemplo n.º 13
0
    def setUp(self):

        self.formdata = {
            'title': 'Depression',
            'text': 'so sad does testing work???',
            'patient': Patient.objects.first(),
            'author': models.Provider.objects.first(),
            'author_type': ProviderType.objects.first()
        }

        models.ClinicDate.objects.create(
            clinic_type=models.ClinicType.objects.first(),
            clinic_date=now().date())

        provider = build_provider()
        log_in_provider(self.client, provider)
Exemplo n.º 14
0
    def test_audit_admin(self):
        p = log_in_provider(self.client, build_provider(["Coordinator"]))
        p.associated_user.is_staff = True
        p.associated_user.is_superuser = True
        p.associated_user.save()

        r = self.client.get(reverse('admin:audit_pageviewrecord_changelist'))
        self.assertEquals(r.status_code, 200)
Exemplo n.º 15
0
    def setUp(self):
        self.provider = log_in_provider(self.client, build_provider())

        models.ClinicType.objects.create(name="Basic Care Clinic")
        models.ClinicDate.objects.create(
            clinic_type=models.ClinicType.objects.first(),
            clinic_date=now().date(),
            gcal_id="tmp")
Exemplo n.º 16
0
    def test_audit_admin(self):
        p = log_in_provider(self.client, build_provider(["Coordinator"]))
        p.associated_user.is_staff = True
        p.associated_user.is_superuser = True
        p.associated_user.save()

        r = self.client.get(reverse('admin:audit_pageviewrecord_changelist'))
        self.assertEquals(r.status_code, 200)
Exemplo n.º 17
0
    def setUp(self):
        self.provider = log_in_provider(
            self.client,
            build_provider())

        models.ClinicType.objects.create(name="Basic Care Clinic")
        models.ClinicDate.objects.create(
            clinic_type=models.ClinicType.objects.first(),
            clinic_date=now().date(),
            gcal_id="tmp")
Exemplo n.º 18
0
    def test_no_create_on_view_if_USER_IP_is_in_BLACKLIST(self):

        provider = log_in_provider(self.client, build_provider(["Attending"]))
        expected_user = provider.associated_user

        # format is: {X-Forwarded-For: client, proxy1, proxy2}
        USER_IP = '0.0.0.1'
        self.client.get(reverse('home'), HTTP_X_FORWARDED_FOR=USER_IP + ',,')

        n_records = PageviewRecord.objects.count()
        self.assertEquals(n_records, 0)
Exemplo n.º 19
0
    def test_workup_pdf(self):
        '''
        Verify that pdf download with the correct naming protocol is working
        '''

        wu_url = "workup-pdf"

        self.wu.diagnosis_categories.add(models.DiagnosisType.objects.first())
        self.wu.save()

        for nonstaff_role in ProviderType.objects.filter(staff_view=False):
            log_in_provider(self.client, build_provider([nonstaff_role]))

            response = self.client.get(reverse(wu_url, args=(self.wu.id, )))
            self.assertRedirects(response,
                                 reverse('workup', args=(self.wu.id, )))

        for staff_role in ProviderType.objects.filter(staff_view=True):
            log_in_provider(self.client, build_provider([staff_role.pk]))
            response = self.client.get(reverse(wu_url, args=(self.wu.id, )))
            self.assertEqual(response.status_code, 200)
Exemplo n.º 20
0
    def test_workup_update(self):
        '''
        Updating should be possible always for attendings, only without
        attestation for non-attendings.
        '''

        # if the wu is unsigned, all can access update.
        for role in ["Preclinical", "Clinical", "Coordinator", "Attending"]:
            log_in_provider(self.client, build_provider([role]))
            response = self.client.get(
                reverse('workup-update', args=(self.wu.id, )))
            self.assertEqual(response.status_code, 200)

        self.wu.sign(build_provider(["Attending"]).associated_user)
        self.wu.save()

        # nonattesting cannot access
        for role in ["Preclinical", "Clinical", "Coordinator"]:
            log_in_provider(self.client, build_provider([role]))
            response = self.client.get(
                reverse('workup-update', args=(self.wu.id, )))
            self.assertRedirects(response,
                                 reverse('workup', args=(self.wu.id, )))

        # attesting can
        log_in_provider(self.client, build_provider(["Attending"]))
        response = self.client.get(
            reverse('workup-update', args=(self.wu.id, )))
        self.assertEqual(response.status_code, 200)
Exemplo n.º 21
0
    def setUp(self):
        from pttrack.test_views import log_in_provider, build_provider
        log_in_provider(self.client, build_provider())

        self.contact_method = ContactMethod.objects.create(
            name="Carrier Pidgeon")

        self.pt = Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=self.contact_method,
        )
Exemplo n.º 22
0
    def test_api_list_cases(self):

        p = log_in_provider(self.client, build_provider(["Coordinator"]))

        pt1 = models.Patient.objects.get(pk=1)

        pt1.case_managers.add(p)

        data = {'filter': 'user_cases'}
        response = self.client.get(reverse("pt_list_api"), data, format='json')

        self.assertEqual(len(response.data), 1)
        self.assertEqual(response.data[0]['id'], pt1.id)
Exemplo n.º 23
0
    def test_workup_submit(self):
        """verify we can submit a valid workup as a signer and nonsigner"""

        for provider_type in ["Attending", "Clinical"]:
            provider = build_provider([provider_type])
            log_in_provider(self.client, provider)
            pt_id = Patient.objects.first().pk

            wu_count = models.Workup.objects.all().count()
            wu_data = wu_dict(units=True)
            wu_data['diagnosis_categories'] = [
                models.DiagnosisType.objects.first().pk
            ]
            wu_data['clinic_day'] = wu_data['clinic_day'].pk

            r = self.client.post(reverse('new-workup', args=(pt_id, )),
                                 data=wu_data)
            self.assertRedirects(r, reverse("patient-detail", args=(pt_id, )))

            self.assertEqual(wu_count + 1, models.Workup.objects.all().count())
            self.assertEqual(models.Workup.objects.last().signed(),
                             provider.clinical_roles.first().signs_charts)
Exemplo n.º 24
0
Arquivo: test.py Projeto: wwick/osler
    def test_api_list_cases(self):

        p = log_in_provider(self.client, build_provider(["Coordinator"]))

        pt1 = models.Patient.objects.get(pk=1)

        pt1.case_managers.add(p)

        data = {'filter': 'user_cases'}
        response = self.client.get(reverse("pt_list_api"), data, format='json')

        self.assertEqual(len(response.data), 1)
        self.assertEqual(response.data[0]['id'], pt1.id)
Exemplo n.º 25
0
    def setUp(self):
        from pttrack.test_views import log_in_provider, build_provider
        log_in_provider(self.client, build_provider())

        self.contact_method = ContactMethod.objects.create(
            name="Carrier Pidgeon")

        self.pt = Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 0o1, 0o1),
            patient_comfortable_with_english=False,
            preferred_contact_method=self.contact_method,
        )
Exemplo n.º 26
0
    def test_progressnote_signing(self):
        """Verify that singing is possible for attendings and not for others.
        """

        sign_url = "progress-note-sign"

        pn = models.ProgressNote.objects.create(
            title='Depression',
            text='so sad does testing work???',
            patient=Patient.objects.first(),
            author=models.Provider.objects.first(),
            author_type=ProviderType.objects.first()
        )

        # Fresh notes should be unsigned
        self.assertFalse(pn.signed())

        # Providers with can_attend == False should not be able to sign
        for nonattesting_role in ["Preclinical", "Clinical", "Coordinator"]:
            log_in_provider(self.client, build_provider([nonattesting_role]))

            response = self.client.get(
                reverse(sign_url, args=(pn.id,)))
            self.assertRedirects(response,
                                 reverse('progress-note-detail',
                                         args=(pn.id,)))
            self.assertFalse(models.ProgressNote.objects
                             .get(pk=pn.id)
                             .signed())

        # Providers able to attend should be able to sign.
        log_in_provider(self.client, build_provider(["Attending"]))

        response = self.client.get(reverse(sign_url, args=(pn.id,)))
        self.assertRedirects(response, reverse('progress-note-detail',
                                               args=(pn.id,)),)
        # the pn has been updated, so we have to hit the db again.
        self.assertTrue(models.ProgressNote.objects.get(pk=pn.id).signed())
Exemplo n.º 27
0
    def test_create_on_view_if_USER_IP_is_not_in_BLACKLIST(self):

        provider = log_in_provider(self.client, build_provider(["Attending"]))
        expected_user = provider.associated_user

        # format is: {X-Forwarded-For: client, proxy1, proxy2}
        USER_IP = '0.0.0.0'
        self.client.get(reverse('home'), HTTP_X_FORWARDED_FOR=USER_IP + ',,')

        n_records = PageviewRecord.objects.count()
        self.assertEquals(n_records, 1)

        record = PageviewRecord.objects.first()
        self.assertEquals(record.user, expected_user)
        self.assertEquals(record.user_ip, USER_IP)
        self.assertEquals(record.role.short_name, 'Attending')
        self.assertEquals(record.method, 'GET')
Exemplo n.º 28
0
    def test_create_on_view(self):

        provider = log_in_provider(self.client, build_provider(["Attending"]))
        expected_user = provider.associated_user

        # format is: {X-Forwarded-For: client, proxy1, proxy2}
        USER_IP = '0.0.0.0'
        self.client.get(
            reverse('home'),
            HTTP_X_FORWARDED_FOR=USER_IP + ',,')

        n_records = PageviewRecord.objects.count()
        self.assertEquals(n_records, 1)

        record = PageviewRecord.objects.first()
        self.assertEquals(record.user, expected_user)
        self.assertEquals(record.user_ip, USER_IP)
        self.assertEquals(record.role.short_name, 'Attending')
        self.assertEquals(record.method, 'GET')
Exemplo n.º 29
0
Arquivo: test.py Projeto: wwick/osler
    def setUp(self):
        workupModels.ClinicType.objects.create(name="Basic Care Clinic")
        workupModels.ClinicDate.objects.create(
            clinic_type=workupModels.ClinicType.objects.all()[0],
            clinic_date=now().date() + datetime.timedelta(days=1))
        workupModels.ClinicDate.objects.create(
            clinic_type=workupModels.ClinicType.objects.all()[0],
            clinic_date=now().date() - datetime.timedelta(days=1))
        workupModels.ClinicDate.objects.create(
            clinic_type=workupModels.ClinicType.objects.all()[0],
            clinic_date=now().date() - datetime.timedelta(days=5))
        log_in_provider(self.client, build_provider(["Attending"]))

        pt1 = models.Patient.objects.get(pk=1)

        pt2 = models.Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=models.Gender.objects.all()[1],
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.all()[0],
        )

        pt3 = models.Patient.objects.create(
            first_name="Asdf",
            last_name="Lkjh",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=models.Gender.objects.all()[0],
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.all()[0],
        )

        pt4 = models.Patient.objects.create(
            first_name="No",
            last_name="Action",
            middle_name="Item",
            phone='+12 345 678 9000',
            gender=models.Gender.objects.all()[0],
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.all()[0],
        )

        # Give pt2 a workup one day later.
        workupModels.Workup.objects.create(
            clinic_day=workupModels.ClinicDate.objects.all()
            [0],  # one day later
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="",
            PMH_PSH="",
            meds="",
            allergies="",
            fam_hx="",
            soc_hx="",
            ros="",
            pe="",
            A_and_P="",
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            patient=pt2)

        # Give pt3 a workup one day ago.
        workupModels.Workup.objects.create(
            clinic_day=workupModels.ClinicDate.objects.all()[1],  # one day ago
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="",
            PMH_PSH="",
            meds="",
            allergies="",
            fam_hx="",
            soc_hx="",
            ros="",
            pe="",
            A_and_P="",
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            patient=pt3)

        # Give pt1 a signed workup five days ago.
        workupModels.Workup.objects.create(
            clinic_day=workupModels.ClinicDate.objects.all()
            [2],  # five days ago
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="",
            PMH_PSH="",
            meds="",
            allergies="",
            fam_hx="",
            soc_hx="",
            ros="",
            pe="",
            A_and_P="",
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            patient=pt1,
            signer=models.Provider.objects.all().filter(
                clinical_roles=models.ProviderType.objects.all().filter(
                    short_name="Attending")[0])[0])

        # make pt1 have and AI due tomorrow
        pt1_ai = models.ActionItem.objects.create(
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            instruction=models.ActionInstruction.objects.all()[0],
            due_date=now().date() + datetime.timedelta(days=1),
            comments="",
            priority=True,
            patient=pt1)

        # make pt2 have an AI due yesterday
        pt2_ai = models.ActionItem.objects.create(
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            instruction=models.ActionInstruction.objects.all()[0],
            due_date=now().date() - datetime.timedelta(days=1),
            comments="",
            priority=True,
            patient=pt2)

        # make pt3 have an AI that during the test will be marked done
        pt3_ai = models.ActionItem.objects.create(
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            instruction=models.ActionInstruction.objects.all()[0],
            due_date=now().date() - datetime.timedelta(days=15),
            comments="",
            patient=pt3)
Exemplo n.º 30
0
    def setUp(self):
        workupModels.ClinicType.objects.create(name="Basic Care Clinic")
        workupModels.ClinicDate.objects.create(
            clinic_type=workupModels.ClinicType.objects.all()[0],
            clinic_date=now().date()+datetime.timedelta(days=1),
            gcal_id="tmp")
        workupModels.ClinicDate.objects.create(
            clinic_type=workupModels.ClinicType.objects.all()[0],
            clinic_date=now().date()-datetime.timedelta(days=1),
            gcal_id="tmp")
        workupModels.ClinicDate.objects.create(
            clinic_type=workupModels.ClinicType.objects.all()[0],
            clinic_date=now().date()-datetime.timedelta(days=5),
            gcal_id="tmp")
        log_in_provider(self.client, build_provider(["Attending"]))

        pt1 = models.Patient.objects.get(pk=1)

        pt2 = models.Patient.objects.create(
            first_name="Juggie",
            last_name="Brodeltein",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=models.Gender.objects.all()[1],
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.all()[0],
        )

        pt3 = models.Patient.objects.create(
            first_name="Asdf",
            last_name="Lkjh",
            middle_name="Bayer",
            phone='+49 178 236 5288',
            gender=models.Gender.objects.all()[0],
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.all()[0],
        )

        pt4 = models.Patient.objects.create(
            first_name="No",
            last_name="Action",
            middle_name="Item",
            phone='+12 345 678 9000',
            gender=models.Gender.objects.all()[0],
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1990, 01, 01),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.all()[0],
        )

        # Give pt2 a workup one day later.
        workupModels.Workup.objects.create(
            clinic_day=workupModels.ClinicDate.objects.all()[0], # one day later
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="", PMH_PSH="", meds="", allergies="", fam_hx="", soc_hx="",
            ros="", pe="", A_and_P="",
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            patient=pt2)

        # Give pt3 a workup one day ago.
        workupModels.Workup.objects.create(
            clinic_day=workupModels.ClinicDate.objects.all()[1], # one day ago
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="", PMH_PSH="", meds="", allergies="", fam_hx="", soc_hx="",
            ros="", pe="", A_and_P="",
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            patient=pt3)


        # Give pt1 a signed workup five days ago.
        workupModels.Workup.objects.create(
            clinic_day=workupModels.ClinicDate.objects.all()[2], # five days ago
            chief_complaint="SOB",
            diagnosis="MI",
            HPI="", PMH_PSH="", meds="", allergies="", fam_hx="", soc_hx="",
            ros="", pe="", A_and_P="",
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            patient=pt1,
            signer=models.Provider.objects.all().filter(
            clinical_roles=models.ProviderType.objects.all().filter(
                short_name="Attending")[0])[0])

        # make pt1 have and AI due tomorrow
        pt1_ai = models.ActionItem.objects.create(
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            instruction=models.ActionInstruction.objects.all()[0],
            due_date=now().date()+datetime.timedelta(days=1),
            comments="",
            priority=True,
            patient=pt1)

        # make pt2 have an AI due yesterday
        pt2_ai = models.ActionItem.objects.create(
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            instruction=models.ActionInstruction.objects.all()[0],
            due_date=now().date()-datetime.timedelta(days=1),
            comments="",
            priority=True,
            patient=pt2)

        # make pt3 have an AI that during the test will be marked done
        pt3_ai = models.ActionItem.objects.create(
            author=models.Provider.objects.all()[0],
            author_type=models.ProviderType.objects.all()[0],
            instruction=models.ActionInstruction.objects.all()[0],
            due_date=now().date()-datetime.timedelta(days=15),
            comments="",
            patient=pt3)
Exemplo n.º 31
0
 def setUp(self):
     self.provider = log_in_provider(self.client, build_provider())
Exemplo n.º 32
0
    def setUp(self):

        self.clinical_student = build_provider(roles=["Clinical"],
                                               email='*****@*****.**')
        log_in_provider(self.client, self.clinical_student)
Exemplo n.º 33
0
Arquivo: tests.py Projeto: wwick/osler
 def setUp(self):
     from pttrack.test_views import log_in_provider, build_provider
     log_in_provider(self.client, build_provider())
Exemplo n.º 34
0
 def setUp(self):
     self.provider = log_in_provider(
         self.client,
         build_provider())