Skip to content

Commit

Permalink
231 establish table of active NPIs according to Corona Datenplattform…
Browse files Browse the repository at this point in the history
… and reported infection data (#443)

Establish table of active NPIs according to Corona Datenplattform and reported infection data.

---------

Co-authored-by: patricklnz <[email protected]>
Co-authored-by: Anna Wendler <[email protected]>
  • Loading branch information
3 people committed Sep 5, 2023
1 parent 124313a commit 0904a39
Show file tree
Hide file tree
Showing 12 changed files with 1,872 additions and 12 deletions.
7 changes: 5 additions & 2 deletions pycode/memilio-epidata/memilio/epidata/defaultDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
'read_data': False,
'make_plot': False,
'out_folder': default_file_path,
'start_date': date(2020, 4, 24),
'update_data': False,
'start_date': date(2020, 1, 1),
'end_date': date.today(),
'split_berlin': False,
'impute_dates': False,
Expand Down Expand Up @@ -103,7 +104,9 @@
'nuts3': 'NUTS3',
'total_volume': 'Unique_trips',
'region_name': 'County',
'region_id': 'ID_County'
'region_id': 'ID_County',
'desc': 'Description',
'incidence': 'Incidence'
}

GerEng = {
Expand Down
2 changes: 1 addition & 1 deletion pycode/memilio-epidata/memilio/epidata/getDIVIData.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_divi_data(read_data=dd.defaultDict['read_data'],
file_format=dd.defaultDict['file_format'],
out_folder=dd.defaultDict['out_folder'],
no_raw=dd.defaultDict['no_raw'],
start_date=dd.defaultDict['start_date'],
start_date=date(2020, 4, 24),
end_date=dd.defaultDict['end_date'],
impute_dates=dd.defaultDict['impute_dates'],
moving_average=dd.defaultDict['moving_average'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,10 @@ def write_dataframe(df, directory, file_prefix, file_type, param_dict={}):
- json
- json_timeasstring [Default]
- hdf5
- csv
- txt
The file_type defines the file format and thus also the file ending.
The file format can be json, hdf5 or txt.
The file format can be json, hdf5, csv or txt.
For this option the column Date is converted from datetime to string.
@param df pandas dataframe (pandas DataFrame)
Expand All @@ -428,6 +429,7 @@ def write_dataframe(df, directory, file_prefix, file_type, param_dict={}):
outForm = {'json': [".json", {"orient": "records"}],
'json_timeasstring': [".json", {"orient": "records"}],
'hdf5': [".h5", {"key": "data"}],
'csv': [".csv", {}],
'txt': [".txt", param_dict]}

try:
Expand All @@ -436,7 +438,7 @@ def write_dataframe(df, directory, file_prefix, file_type, param_dict={}):
except KeyError:
raise ValueError(
"Error: The file format: " + file_type +
" does not exist. Use json, json_timeasstring, hdf5 or txt.")
" does not exist. Use json, json_timeasstring, hdf5, csv or txt.")

out_path = os.path.join(directory, file_prefix + outFormEnd)

Expand All @@ -449,6 +451,8 @@ def write_dataframe(df, directory, file_prefix, file_type, param_dict={}):
df.to_json(out_path, **outFormSpec)
elif file_type == "hdf5":
df.to_hdf(out_path, **outFormSpec)
elif file_type == 'csv':
df.to_csv(out_path)
elif file_type == "txt":
df.to_csv(out_path, **outFormSpec)

Expand Down
Loading

0 comments on commit 0904a39

Please sign in to comment.