covid19-etl/etl/idph_hospital_utilization.py
def parse_file(self, latest_submitted_date, 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:
            latest_submitted_date (date): the date of latest available "summary_clinical" for project
            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()
            last_reported_date = idph_last_reported_date(data)

            if (
                latest_submitted_date
                and last_reported_date == latest_submitted_date.strftime("%Y-%m-%d")
            ):
                print(
                    "Nothing to submit: latest submitted date and the last reported date from data are the same."
                )
                return

            summary_location_submitter_id = format_submitter_id(
                "summary_location",
                {
                    "project": self.project_code,
                },
            )
            summary_location = {
                "country_region": self.country,
                "submitter_id": summary_location_submitter_id,
                "projects": [{"code": self.project_code}],
                "province_state": self.state,
            }
            self.summary_locations.append(summary_location)

            for utilization in data:
                if (
                    latest_submitted_date is None
                    or get_date_from_str(utilization["ReportDate"])
                    > latest_submitted_date
                ):
                    summary_clinical = self.parse_historical(
                        summary_location_submitter_id, utilization
                    )
                    self.summary_clinicals.append(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:
            latest_submitted_date (date): the date of latest available "summary_clinical" for project
            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, latest_submitted_date, url):
        print("Getting data from {}".format(url))
        with closing(self.get(url, stream=True)) as r:
            data = r.json()
            last_reported_date = idph_last_reported_date(data)
            if (
                latest_submitted_date
                and last_reported_date == latest_submitted_date.strftime("%Y-%m-%d")
            ):
                print(
                    "Nothing to submit: latest submitted date and the last reported date from data are the same."
                )
                return
            summary_location_submitter_id = format_submitter_id(
                "summary_location",
                {
                    "project": self.project_code,
                },
            )
            summary_location = {
                "country_region": self.country,
                "submitter_id": summary_location_submitter_id,
                "projects": [{"code": self.project_code}],
                "province_state": self.state,
            }
            self.summary_locations.append(summary_location)
            for utilization in data:
                if (
                    latest_submitted_date is None
                    or get_date_from_str(utilization["ReportDate"])
                    > latest_submitted_date
                ):
                    summary_clinical = self.parse_historical(
                        summary_location_submitter_id, utilization
                    )
                    self.summary_clinicals.append(summary_clinical)
def parse_file ( self , latest_submitted_date , url ) : print ( "Getting data from {}" . format ( url ) ) with closing ( self . get ( url , stream = True ) ) as r : data = r . json ( ) last_reported_date = idph_last_reported_date ( data ) if ( latest_submitted_date and last_reported_date == latest_submitted_date . strftime ( "%Y-%m-%d" ) ) : print ( "Nothing to submit: latest submitted date and the last reported date from data are the same." ) return summary_location_submitter_id = format_submitter_id ( "summary_location" , { "project" : self . project_code , } , ) summary_location = { "country_region" : self . country , "submitter_id" : summary_location_submitter_id , "projects" : [ { "code" : self . project_code } ] , "province_state" : self . state , } self . summary_locations . append ( summary_location ) for utilization in data : if ( latest_submitted_date is None or get_date_from_str ( utilization [ "ReportDate" ] ) > latest_submitted_date ) : summary_clinical = self . parse_historical ( summary_location_submitter_id , utilization ) self . summary_clinicals . append ( 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:
            latest_submitted_date (date): the date of latest available "summary_clinical" for project
            url (str): URL at which the JSON file is available
        """
self
latest_submitted_date
the date of latest available "summary_clinical" for project
the date of latest available " summary_clinical " for project
url
URL at which the JSON file is available
URL at which the JSON file is available