covid19-etl/etl/idph_facility.py
def parse_file(self, url):
        """
        Converts a JSON files to data we can submit via Sheepdog. Stores the
        records to submit in `self.summary_locations` and `self.summary_clinicals`.

        Args:
            url (str): URL at which the JSON file is available
        """
        print("Getting data from {}".format(url))
        with closing(self.get(url, stream=True)) as r:
            data = r.json()

            if len(data) == 0:
                print(
                    "Nothing to submit: No new data available in the given date range."
                )
                return

            for facility in data:
                date = remove_time_from_date_time(facility["ReportDate"])
                (summary_location, summary_clinical) = self.parse_facility(
                    date, facility
                )
                summary_location_submitter_id = summary_location["submitter_id"]
                summary_clinical_submitter_id = summary_clinical["submitter_id"]

                self.summary_locations[summary_location_submitter_id] = summary_location

                if summary_clinical_submitter_id in self.summary_clinicals:
                    existed = self.summary_clinicals[summary_clinical_submitter_id]
                    summary_clinical["confirmed"] = max(
                        summary_clinical["confirmed"], existed["confirmed"]
                    )
                    summary_clinical["deaths"] = max(
                        summary_clinical["deaths"], existed["deaths"]
                    )

                self.summary_clinicals[summary_clinical_submitter_id] = summary_clinical

        Converts a JSON files to data we can submit via Sheepdog. Stores the
        records to submit in `self.summary_locations` and `self.summary_clinicals`.

        Args:
            url (str): URL at which the JSON file is available
        
Converts a JSON files to data we can submit via Sheepdog.
Converts a JSON files to data we can submit via Sheepdog .
def parse_file(self, url):
        print("Getting data from {}".format(url))
        with closing(self.get(url, stream=True)) as r:
            data = r.json()
            if len(data) == 0:
                print(
                    "Nothing to submit: No new data available in the given date range."
                )
                return
            for facility in data:
                date = remove_time_from_date_time(facility["ReportDate"])
                (summary_location, summary_clinical) = self.parse_facility(
                    date, facility
                )
                summary_location_submitter_id = summary_location["submitter_id"]
                summary_clinical_submitter_id = summary_clinical["submitter_id"]
                self.summary_locations[summary_location_submitter_id] = summary_location
                if summary_clinical_submitter_id in self.summary_clinicals:
                    existed = self.summary_clinicals[summary_clinical_submitter_id]
                    summary_clinical["confirmed"] = max(
                        summary_clinical["confirmed"], existed["confirmed"]
                    )
                    summary_clinical["deaths"] = max(
                        summary_clinical["deaths"], existed["deaths"]
                    )
                self.summary_clinicals[summary_clinical_submitter_id] = summary_clinical
def parse_file ( self , url ) : print ( "Getting data from {}" . format ( url ) ) with closing ( self . get ( url , stream = True ) ) as r : data = r . json ( ) if len ( data ) == 0 : print ( "Nothing to submit: No new data available in the given date range." ) return for facility in data : date = remove_time_from_date_time ( facility [ "ReportDate" ] ) ( summary_location , summary_clinical ) = self . parse_facility ( date , facility ) summary_location_submitter_id = summary_location [ "submitter_id" ] summary_clinical_submitter_id = summary_clinical [ "submitter_id" ] self . summary_locations [ summary_location_submitter_id ] = summary_location if summary_clinical_submitter_id in self . summary_clinicals : existed = self . summary_clinicals [ summary_clinical_submitter_id ] summary_clinical [ "confirmed" ] = max ( summary_clinical [ "confirmed" ] , existed [ "confirmed" ] ) summary_clinical [ "deaths" ] = max ( summary_clinical [ "deaths" ] , existed [ "deaths" ] ) self . summary_clinicals [ summary_clinical_submitter_id ] = summary_clinical
Converts a JSON files to data we can submit via Sheepdog.
Converts a JSON files to data we can submit via Sheepdog .
"""
        Converts a JSON files to data we can submit via Sheepdog. Stores the
        records to submit in `self.summary_locations` and `self.summary_clinicals`.

        Args:
            url (str): URL at which the JSON file is available
        """
self
url
URL at which the JSON file is available
URL at which the JSON file is available