Beispiel #1
0
    def get(self):

        qParser = reqparse.RequestParser()

        qParser.add_argument("fromDate", type=dateInput, default=None)
        qParser.add_argument("toDate", type=dateInput, default=None)
        qParser.add_argument("doctor_id", type=int, default=None)
        qParser.add_argument("service_id", type=int, default=None)
        qParser.add_argument("state", type=str, default=None)

        args = qParser.parse_args()

        fromDate = args.get("fromDate")
        toDate = args.get("toDate")
        doctor_id = args.get("doctor_id")
        service_id = args.get("service_id")
        state = args.get("state")

        report = GroupedSessionsSummary()
        report.filterDateRange(fromDate, toDate)
        report.filterByDoctor(doctor_id)
        report.filterByService(service_id)
        report.filterByState(state)

        return report.result()
Beispiel #2
0
    def test_withDefaultDate_report(self):

        report = GroupedSessionsSummary()
        report.filterDateRange()
        result = report.result()
        print(result)
        expected = {'count': 5}
        self.assertEquals(expected, result)
Beispiel #3
0
    def test_done_sessions_count_report(self):

        report = GroupedSessionsSummary()
        # report.filterDateRange(datetime.date.today(), datetime.datetime.now() + datetime.timedelta(days=1) )
        report.filterDateRange()
        result = report.result()
        totalSessions = 0
        for item in result['details']:
            self.assertTrue(item["service_id"] is not None)
            self.assertTrue(item["stateCount"] is not None)
            # self.assertEquals(item["stateCount"])
            totalSessions += item["stateCount"]
            self.assertTrue(item["doctor_id"] is not None)
            self.assertTrue(item["serviceName"] is not None)
            self.assertTrue(item["doctorName"] is not None)
            self.assertTrue(item["state"] is not None)
            self.assertEquals(item["state"], 'done')
        self.assertEquals(totalSessions, result['totalNumberOfSessions'])
Beispiel #4
0
    def test_with_doctor_id_report(self):
        dr1_test = Doctor.query.filter(Doctor.name == 'dr1_test').one()
        report = GroupedSessionsSummary()

        report.filterDateRange(datetime.date.today(), datetime.datetime.now() + datetime.timedelta(days=1))
        report.filterByDoctor(dr1_test.id)

        result = report.result()
        # print(result)
        expected = {'count': 7}
        self.assertEquals(expected, result)