covid19-etl/etl/idph_zipcode.py
def parse_zipcode(self, zipcode_values):
        """
        From county-level data, generate the data we can submit via Sheepdog
        """
        date = datetime.datetime.strptime(
            zipcode_values["reportDate"], "%Y-%m-%dT%H:%M:%S"
        ).strftime("%Y-%m-%d")
        zipcode = zipcode_values["zip"]

        summary_location_submitter_id = format_submitter_id(
            "summary_location",
            {"country": self.country, "state": self.state, "zipcode": zipcode},
        )

        summary_location = {
            "submitter_id": summary_location_submitter_id,
            "country_region": self.country,
            "province_state": self.state,
            "zipcode": zipcode,
            "projects": [{"code": self.project_code}],
        }

        summary_clinical_submitter_id = derived_submitter_id(
            summary_location_submitter_id,
            "summary_location",
            "summary_clinical",
            {"date": date},
        )
        summary_clinical = {
            "submitter_id": summary_clinical_submitter_id,
            "date": date,
            "confirmed": zipcode_values["confirmed_cases"],
            "summary_locations": [{"submitter_id": summary_location_submitter_id}],
        }

        if "demographics" in zipcode_values:
            demographic = zipcode_values["demographics"]

            for k, v in fields_mapping.items():
                field, mapping = v
                demographic_group = demographic[k]

                for item in demographic_group:
                    dst_field = mapping[item[field]]
                    if dst_field:
                        if "count" in item:
                            age_group_count_field = "{}_{}".format(
                                mapping[item[field]], "count"
                            )
                            summary_clinical[age_group_count_field] = item["count"]
                        if "tested" in item:
                            age_group_tested_field = "{}_{}".format(
                                mapping[item[field]], "tested"
                            )
                            summary_clinical[age_group_tested_field] = item["tested"]

        return summary_location, summary_clinical

        From county-level data, generate the data we can submit via Sheepdog
        
From county-level data, generate the data we can submit via Sheepdog
From county - level data generate the data we can submit via Sheepdog
def parse_zipcode(self, zipcode_values):
        date = datetime.datetime.strptime(
            zipcode_values["reportDate"], "%Y-%m-%dT%H:%M:%S"
        ).strftime("%Y-%m-%d")
        zipcode = zipcode_values["zip"]
        summary_location_submitter_id = format_submitter_id(
            "summary_location",
            {"country": self.country, "state": self.state, "zipcode": zipcode},
        )
        summary_location = {
            "submitter_id": summary_location_submitter_id,
            "country_region": self.country,
            "province_state": self.state,
            "zipcode": zipcode,
            "projects": [{"code": self.project_code}],
        }
        summary_clinical_submitter_id = derived_submitter_id(
            summary_location_submitter_id,
            "summary_location",
            "summary_clinical",
            {"date": date},
        )
        summary_clinical = {
            "submitter_id": summary_clinical_submitter_id,
            "date": date,
            "confirmed": zipcode_values["confirmed_cases"],
            "summary_locations": [{"submitter_id": summary_location_submitter_id}],
        }
        if "demographics" in zipcode_values:
            demographic = zipcode_values["demographics"]
            for k, v in fields_mapping.items():
                field, mapping = v
                demographic_group = demographic[k]
                for item in demographic_group:
                    dst_field = mapping[item[field]]
                    if dst_field:
                        if "count" in item:
                            age_group_count_field = "{}_{}".format(
                                mapping[item[field]], "count"
                            )
                            summary_clinical[age_group_count_field] = item["count"]
                        if "tested" in item:
                            age_group_tested_field = "{}_{}".format(
                                mapping[item[field]], "tested"
                            )
                            summary_clinical[age_group_tested_field] = item["tested"]
        return summary_location, summary_clinical
def parse_zipcode ( self , zipcode_values ) : date = datetime . datetime . strptime ( zipcode_values [ "reportDate" ] , "%Y-%m-%dT%H:%M:%S" ) . strftime ( "%Y-%m-%d" ) zipcode = zipcode_values [ "zip" ] summary_location_submitter_id = format_submitter_id ( "summary_location" , { "country" : self . country , "state" : self . state , "zipcode" : zipcode } , ) summary_location = { "submitter_id" : summary_location_submitter_id , "country_region" : self . country , "province_state" : self . state , "zipcode" : zipcode , "projects" : [ { "code" : self . project_code } ] , } summary_clinical_submitter_id = derived_submitter_id ( summary_location_submitter_id , "summary_location" , "summary_clinical" , { "date" : date } , ) summary_clinical = { "submitter_id" : summary_clinical_submitter_id , "date" : date , "confirmed" : zipcode_values [ "confirmed_cases" ] , "summary_locations" : [ { "submitter_id" : summary_location_submitter_id } ] , } if "demographics" in zipcode_values : demographic = zipcode_values [ "demographics" ] for k , v in fields_mapping . items ( ) : field , mapping = v demographic_group = demographic [ k ] for item in demographic_group : dst_field = mapping [ item [ field ] ] if dst_field : if "count" in item : age_group_count_field = "{}_{}" . format ( mapping [ item [ field ] ] , "count" ) summary_clinical [ age_group_count_field ] = item [ "count" ] if "tested" in item : age_group_tested_field = "{}_{}" . format ( mapping [ item [ field ] ] , "tested" ) summary_clinical [ age_group_tested_field ] = item [ "tested" ] return summary_location , summary_clinical
From county-level data, generate the data we can submit via Sheepdog
From county - level data generate the data we can submit via Sheepdog
"""
        From county-level data, generate the data we can submit via Sheepdog
        """
self
zipcode_values