def get_report_data(cls, config):
        validate_report_parameters(["domain", "location_id", "datespan"],
                                   config)

        domain = config["domain"]
        location_id = config["location_id"]
        user = config["user"]

        sql_data = ProjectIndicatorsCaseSqlData(
            domain=domain, datespan=config["datespan"]).data
        locations = get_location_hierarchy_by_id(location_id,
                                                 domain,
                                                 user,
                                                 CCT_only=True)
        row_data = ProjectIndicatorsReport.get_initial_row_data()

        for key in sql_data:
            if key[2] not in locations:
                continue
            data = sql_data.get(key, {})
            for row_key in row_data:
                value = data.get(row_key, 0)
                if value is None:
                    value = 0
                if row_key == "women_delivering_within_6_weeks_attending_pnc_total" and value > 1:
                    value = 1
                row_data.get(row_key, {})["value"] += value
        return sorted([(key, row_data[key]) for key in row_data],
                      key=lambda t: t[1].get("s/n"))
    def get_report_data(cls, config):
        validate_report_parameters(["domain", "location_id", "datespan"], config)

        domain = config["domain"]
        location_id = config["location_id"]
        sql_data = ProjectIndicatorsCaseSqlData(domain=domain, datespan=config["datespan"]).data
        locations = get_location_hierarchy_by_id(location_id, domain, CCT_only=True)
        row_data = ProjectIndicatorsReport.get_initial_row_data()

        for key in sql_data:
            if key[2] not in locations:
                continue
            data = sql_data.get(key, {})
            for row_key in row_data:
                value = data.get(row_key, 0)
                if value is None:
                    value = 0
                if row_key == "women_delivering_within_6_weeks_attending_pnc_total" and value > 1:
                    value = 1
                row_data.get(row_key, {})["value"] += value
        return sorted([(key, row_data[key]) for key in row_data], key=lambda t: t[1].get("s/n"))
    def get_report_data(cls, config):
        validate_report_parameters(["domain", "location_id", "datespan"], config)

        domain = config["domain"]
        location_id = config["location_id"]
        sql_data = ProjectIndicatorsCaseSqlData(domain=domain, datespan=config["datespan"]).data
        top_location = Location.get(location_id)
        locations = [location_id] + [descendant.get_id for descendant in top_location.descendants]
        row_data = ProjectIndicatorsReport.get_initial_row_data()

        for key in sql_data:
            if key[2] not in locations:
                continue
            data = sql_data.get(key, {})
            for row_key in row_data:
                value = data.get(row_key, 0)
                if value is None:
                    value = 0
                if row_key == "women_delivering_within_6_weeks_attending_pnc_total" and value > 1:
                    value = 1
                row_data.get(row_key, {})["value"] += value
        return row_data