@property
    def rows(self):
        soh_data = []

        if 'data_config' in self.config:
            data_config = self.config['data_config']
            late = data_config.soh_data_total.get('late', 0)
            on_time = data_config.soh_data_total.get('on_time', 0)
            soh_data.append(GroupSummary(
                title=SupplyPointStatusTypes.SOH_FACILITY,
                responded=late + on_time,
                on_time=on_time,
                complete=late + on_time,
                total=len(data_config.descendants)
            ))
            return soh_data

        if self.config['org_summary']:
            try:
                sohs = GroupSummary.objects.filter(
                    title=SupplyPointStatusTypes.SOH_FACILITY,
                    org_summary__in=self.config['org_summary']
                ).aggregate(Avg('responded'), Avg('on_time'), Avg('complete'), Max('total'))

                soh_data.append(GroupSummary(
                    title=SupplyPointStatusTypes.SOH_FACILITY,
                    responded=sohs['responded__avg'],
                    on_time=sohs['on_time__avg'],
                    complete=sohs['complete__avg'],
                    total=sohs['total__max']
                ))
            except GroupSummary.DoesNotExist:
                return soh_data
        return soh_data
dataset/ETHPy150Open dimagi/commcare-hq/custom/ilsgateway/tanzania/reports/mixins.py/SohSubmissionData.rows/original