Ejemplo n.º 1
0
    def test_clinic_report_is_generated_if_none_existent_v3(self):
        count = ClinicReport.count()
        clinic = Clinic.get(Clinic.id == 4)
        period = ReportingPeriod.get(ReportingPeriod.title == 'Period 2017')

        ClinicReport.get_or_generate(clinic, period)

        self.assertEqual(ClinicReport.count(), count + 1)
Ejemplo n.º 2
0
    def key_indicators(self, period):
        from whoahqa.models import ClinicReport
        if self._cached_key_indicators is None:
            report = ClinicReport.get_or_generate(self, period)

            if report:
                self._cached_key_indicators = report.get_key_indicators()

        return self._cached_key_indicators
Ejemplo n.º 3
0
    def national_report(self, period):
        clinics = Clinic.all()
        clinics = [
            c for c in clinics
            if c.has_clinic_submissions_for_period(period.form_xpath)
        ]

        national_report = ClinicReport.get_clinic_reports(clinics, period)

        return national_report
Ejemplo n.º 4
0
 def test_clinic_report_catches_key_indicators_v3(self):
     self.create_clinic_report_v3()
     report = ClinicReport.newest()
     key_indicators = report.get_key_indicators()
     self.assertEqual(key_indicators['equitable'], 7.000407000407002)
Ejemplo n.º 5
0
    def create_clinic_report_v3(self):
        clinic = Clinic.get(Clinic.id == 4)
        period = ReportingPeriod.get(ReportingPeriod.title == 'Period 2017')

        with transaction.manager:
            ClinicReport.get_or_generate(clinic, period)