Open elray1 opened 3 years ago
This proposal looks pretty good; it always takes me some trial and error to get all the pandas commands right.
An alternate way would be load the hospital data separately (not in jhu.py
) and add it in the higher-level utils in util.py
. E.g., for states, you could add it around here:
https://github.com/dsheldon/mechbayes/blob/c51d09038c040d1a18baa8b6da595aa6b4e6fad8/mechbayes/util.py#L58-L69
After running this code, you would need to add a hosp
column to data[place]['data']
for each relevant place.
No strong opinion here on which approach is better.
to start, only support US states and national, getting data from the covidcast API.
For states:
target_variable
("cases", "hospitalizations", or "deaths"), and an optionalas_of
parameter. It should return a pandas data frame with the date as an index and one column for each state-level location. The column names should match the location names returned byjhu.get_state_info()
. The values in the columns will be the case/hospitalization/death counts (just one for a single call to the function) in each state on the given date.load_us_time_series
or call the new function above. For now, when calling the utility function for covidcast, just omit theas_of
parameter to get the latest available data, matching current behavior for cases and deaths. If data source is covidcast, addhosps
to theconcat
call a couple lines down.For US national:
hosp
. For now, it should have observed value for the US only, andnan
's for all other locationsFor counties:
nan
's