<jupyter_start><jupyter_text>COVID-19 Reopening / Recovery Indicators * [Federal Gating Criteria](https://www.whitehouse.gov/wp-content/uploads/2020/04/Guidelines-for-Opening-Up-America-Again.pdf)* [State Gating Criteria](https://covid19.ca.gov/roadmap-counties/)* [WHO Testing and Positivity Rate Guidelines](https://coronavirus.jhu.edu/testing/testing-positivity)* More [background articles](https://github.com/CityOfLosAngeles/covid19-indicators/blob/master/reopening-sources.md)* NY, Chicago, LA, and CA indicators [provided in our GitHub](https://github.com/CityOfLosAngeles/covid19-indicators/blob/master/Reopening_Indicators_Comparison.xlsx) This notebook gives helpful hints for working with our COVID-19 data in Jupyter Notebooks. It covers:* How to import CSVs hosted on ESRI* How to use functions `utils.py` to get the cases and deaths charts for any US county, state, or MSA.* How to use the functions in `utils.py` to get the hospitalizations charts for any CA county.<jupyter_code>import pandas as pd
import utils

from datetime import date<jupyter_output><empty_output><jupyter_text>Import data from ESRI CSVThe [README](https://github.com/CityOfLosAngeles/aqueduct/blob/master/dags/public-health/covid19/README.mdhelpful-hints) gave some helpful hints for how to read in CSVs that are hosted by ESRI.<jupyter_code>US_COUNTY_URL = "http://lahub.maps.arcgis.com/sharing/rest/content/items/782ca660304a4bdda1cc9757a2504647/data"
CROSSWALK_URL = (
    "https://raw.githubusercontent.com/CityOfLosAngeles/covid19-indicators/master/data/"
    "msa_county_pop_crosswalk.csv"
)
df = pd.read_csv(US_COUNTY_URL, dtype={"fips": "str"})
df.head(2)
crosswalk = pd.read_csv(CROSSWALK_URL)
crosswalk.head(2)<jupyter_output><empty_output><jupyter_text>County indicators for cases and deaths* Uses the `county_case_charts` function within `utils`* 7-day rolling average shown for new cases* 7-day rolling average shown for new deaths The function takes `COUNTY INFORMATION` as a string and `START_DATE` as a datetime variable, and returns the charts and the dataframe used to create the chart.`COUNTY_INFORMATION` takes form of {COUNTY_NAME, STATE_NAME} or {5-digit county FIPS code}:* {COUNTY_NAME}: with our without " County" e.g. "Alameda County" or "Alameda"* {STATE_NAME}: full state name or state abbreviation e.g. "California" or "CA"* {5-DIGIT COUNTY FIPS CODE}: a [list of county FIPS found here.](https://www.nrcs.usda.gov/wps/portal/nrcs/detail/national/home/?cid=nrcs143_013697) e.g. "06075" for San Francisco`START_DATE` takes form of a datetime variable* Use the `datetime` package* Put in form date(YYYY, M, D), such as (2020, 5, 1) or (2020, 4, 10)<jupyter_code>start_date = date(2020, 5, 1)
cook = utils.county_case_charts("Cook, Illinois", start_date)
cook.head()<jupyter_output><empty_output><jupyter_text>Other acceptable examples are:```start_date = date(2020, 5, 15)dallas = utils.county_case_charts("Dallas, TX", start_date)atlanta = utils.county_case_charts("Fulton, Georgia", start_date)```  State indicators for cases and deaths* Uses the `state_case_charts` function within `utils`* 7-day rolling average shown for new cases* 7-day rolling average shown for new deaths The function takes `STATE_INFORMATION` as a string and `START_DATE` as a datetime variable, and returns the charts and the dataframe used to create the chart.`STATE_INFORMATION` takes form of {STATE_NAME}:* {STATE_NAME}: full state name or state abbreviation e.g. "California" or "CA"<jupyter_code>start_date = date(2020, 3, 1)
ny = utils.state_case_charts("New York", start_date)
ny.head()<jupyter_output><empty_output><jupyter_text>Other acceptable examples are:```start_date = date(2020, 2, 15)tn = utils.state_case_charts("Tennessee", start_date)fl = utils.state_case_charts("FL", start_date)```  MSA indicators for cases and deaths* Uses the `msa_case_charts` function within `utils`* 7-day rolling average shown for new cases* 7-day rolling average shown for new deaths The function takes `METROPOLITAN_INFORMATION` as a string and `START_DATE` as a datetime variable, and returns the charts and the dataframe used to create the chart. [Our crosswalk makes this information available.](https://github.com/CityOfLosAngeles/covid19-indicators/blob/master/data/msa_county_pop_crosswalk.csv) `METROPOLITAN_INFORMATION` takes form of {CBSA NAME} or {CBSA CODE}:* {CBSA NAME}: full metropolitan area name or any subset of it e.g. "Boston-Cambridge-Newton, MA-NH" or "Boston-Cambridge"* {CBSA CODE}: e.g. "14460" for Boston-Cambridge-Newton, MA-NH or "31080" for Los Angeles-Long Beach-Anaheim, CA<jupyter_code>start_date = date(2020, 5, 1)
boston_msa = utils.msa_case_charts("Boston-Cambridge", start_date)
boston_msa.head()<jupyter_output><empty_output><jupyter_text>Other acceptable examples are:```start_date = date(2020, 4, 1)dfw = utils.msa_case_charts("19100", start_date)durham = utils.msa_case_charts("Durham-Chapel Hill", start_date)```  CA COVID-hospitalizations* Uses the `county_covid_hospital_charts` function within `utils`* 7-day rolling average shown for all COVID-related hospitalizations and COVID-ICU hospitalizations (subset of all hospitalizations)<jupyter_code>start_date = date(2020, 4, 30)
orange = utils.county_covid_hospital_charts("Orange, CA", start_date)
orange.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1089815858699737, 'fraction_numerical': 0.026681698609545283, 'mean_word_length': 6.444755244755245, 'pattern_counts': {'":': 1, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 9, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '429985', 'license': 'Unlicense', 'n_tokens_mistral': 1920, 'n_tokens_neox': 1723, 'n_words': 500, 'path': 'examples/Covid-19/LA-covid19-indicators/sample-indicators.ipynb', 'repo_name': 'gtoro29/gcp', 'size': '5322'}