예제 #1
0
    def setUp(self):
        from osler.core.test_views import build_provider

        build_provider(username='******',
                       password='******',
                       roles=["Attending"])

        self.selenium.get('%s%s' % (self.live_server_url, '/'))
        self.submit_login('timmy', 'password')
예제 #2
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)
예제 #3
0
    def setUp(self):
        models.EncounterStatus.objects.create(name="Active", is_active=True)
        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, 1, 1),
            patient_comfortable_with_english=False,
            preferred_contact_method=models.ContactMethod.objects.first(),
        )

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

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

        # Give pt2 a workup one day later.
        e1 = models.Encounter.objects.create(
            patient=pt2,
            clinic_day=now().date() + datetime.timedelta(days=1),
            status=models.EncounterStatus.objects.first())
        workupModels.Workup.objects.create(
            encounter=e1,  # 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.first(),
            author_type=models.ProviderType.objects.first(),
            patient=pt2)

        # Give pt3 a workup one day ago.
        e2 = models.Encounter.objects.create(
            patient=pt3,
            clinic_day=now().date() - datetime.timedelta(days=1),
            status=models.EncounterStatus.objects.first())
        workupModels.Workup.objects.create(
            encounter=e2,  # 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.first(),
            author_type=models.ProviderType.objects.first(),
            patient=pt3)

        # Give pt1 a signed workup five days ago.
        e3 = models.Encounter.objects.create(
            patient=pt1,
            clinic_day=now().date() - datetime.timedelta(days=5),
            status=models.EncounterStatus.objects.first())
        workupModels.Workup.objects.create(
            encounter=e3,  # 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.first(),
            author_type=models.ProviderType.objects.first(),
            patient=pt1,
            signer=models.Provider.objects.all().filter(
                clinical_roles=models.ProviderType.objects.all().filter(
                    short_name="Attending")[0])[0])

        self.ai_base_kwargs = {
            'author': models.Provider.objects.first(),
            'author_type': models.ProviderType.objects.first(),
            'instruction': models.ActionInstruction.objects.first(),
            'comments': 'comments go here',
        }

        # make pt1 have and AI due tomorrow
        pt1_ai = models.ActionItem.objects.create(due_date=now().date() +
                                                  datetime.timedelta(days=2),
                                                  priority=True,
                                                  patient=pt1,
                                                  **self.ai_base_kwargs)

        # make pt2 have an AI due yesterday
        pt2_ai = models.ActionItem.objects.create(due_date=now().date() -
                                                  datetime.timedelta(days=1),
                                                  priority=True,
                                                  patient=pt2,
                                                  **self.ai_base_kwargs)

        # make pt3 have an AI that during the test will be marked done
        pt3_ai = models.ActionItem.objects.create(due_date=now().date() -
                                                  datetime.timedelta(days=15),
                                                  patient=pt3,
                                                  **self.ai_base_kwargs)