@property
    def charts(self):
        data = self.rows
        chart_data = []
        if data:
            reported_percent = round((data['reported']) * 100 / float(data['total'] or 1))
            non_reported_percent = round((data['non_reported']) * 100 / float(data['total'] or 1))
            reported_formatted = ("%d" if reported_percent.is_integer() else "%.1f") % reported_percent
            non_reported_formatted = ("%d" if non_reported_percent.is_integer() else "%.1f") % non_reported_percent

            chart_data = sorted([
                dict(value=non_reported_percent,
                     label=_('Non-Reporting %s%%') % non_reported_formatted,
                     description=_(
                         "%(formatted_percent)s%% (%(raw_number)d) Non-Reported (%(date_range)s)"
                     ) % {
                         'formatted_percent': non_reported_formatted,
                         'raw_number': data['non_reported'],
                         'date_range': self.datetext(),
                     },
                     color='red'),
                dict(value=reported_percent,
                     label=_('Reporting %s%%') % reported_formatted,
                     description=_(
                         "%(formatted_percent)s%% (%(raw_number)d) Reported (%(date_range)s)"
                     ) % {
                         'formatted_percent': reported_formatted,
                         'raw_number': data['reported'],
                         'date_range': self.datetext(),
                     },
                     color='green'),
            ], key=lambda x: x['value'], reverse=True)
        pie_chart = EWSPieChart('', '', chart_data, [chart_data[0]['color'], chart_data[1]['color']])
        pie_chart.tooltips = False
        return [pie_chart]
dataset/ETHPy150Open dimagi/commcare-hq/custom/ewsghana/reports/specific_reports/reporting_rates.py/ReportingRates.charts/original