Exemplo n.º 1
0
def build_counties_summary(counties_data: List[APIOutput],
                           intervention) -> APIOutput:
    county_summaries = [
        output.data for output in counties_data
        # Don't love using type here, but CovidActNowCountyTimeseries inherits
        # CovidActNowCountySummary so `isinstance` returns true and fails to
        # filter out the timeseries records.
        if type(output.data) == CovidActNowCountySummary
    ]
    county_api_data = CovidActNowCountiesSummary(data=county_summaries)
    key = f"counties.{intervention.name}"
    return APIOutput(key, county_api_data)
Exemplo n.º 2
0
def build_counties_summary(counties_data: List[APIOutput],
                           intervention) -> APIOutput:
    county_summaries = [output.data for output in counties_data]
    county_api_data = CovidActNowCountiesSummary(__root__=county_summaries)
    key = f"counties.{intervention.name}"
    return APIOutput(key, county_api_data, intervention)