def add_to_report(self, report, key, dictionary): if report.drill_to_facility: val = active_facility_reporters(report.start_date, report.end_date, report.location, roles=self.roles, period=self.period) reorganize_hc(key, val, dictionary) else: val = active_reporters(report.start_date, report.end_date, report.location, roles=self.roles, period=self.period) reorganize_location(key, val, dictionary)
def add_to_report(self, report, key, dictionary): val = total_submissions(self.keyword, report.start_date, report.end_date, report.location, self.extra_filters) for rdict in val: rdict["value"] = ( rdict["value"] / Location.objects.get(pk=rdict["location_id"]) .get_descendants(include_self=True) .aggregate(Count("schools"))["schools__count"] ) reorganize_location(key, val, dictionary)
def add_to_report(self, report, key, dictionary): if report.drill_to_facility: val = registered_facility_reporters(report.location, roles=self.roles) if 'HC' in self.roles: # add all health facilities, so we can show unregistered ones too from healthmodels.models import HealthFacility locations = report.location.get_descendants(include_self=True) for hc in HealthFacility.objects.filter(catchment_areas__in=locations): dictionary.setdefault(hc.id, \ {'location_name': "%s (%s)" % \ (hc.name, hc.type.name)}) reorganize_hc(key, val, dictionary, facility_base='facility') else: val = registered_reporters(report.location, roles=self.roles) reorganize_location(key, val, dictionary)
def add_to_report(self, report, key, dictionary): val = total_attribute_value(self.keyword, self.start_date, self.end_date, report.location, self.extra_filters) reorganize_location(key, val, dictionary)
def add_to_report(self, report, key, dictionary): val = alerts_report(report.location, date_range=self.date_range, type=self.type) reorganize_location(key, val, dictionary)