epiforecasts / covidregionaldata

An interface to subnational and national level COVID-19 data. For all countries supported, this includes a daily time-series of cases. Wherever available we also provide data on deaths, hospitalisations, and tests. National level data is also supported using a range of data sources as well as linelist data and links to intervention data sets.
https://epiforecasts.io/covidregionaldata/
Other
37 stars 18 forks source link

Modify get available datasets #382

Closed joseph-palmer closed 3 years ago

joseph-palmer commented 3 years ago

Rather than initialising every class when calling get_available_datasets this PR moves the data produced by get_available_datasets to package data (contained in data/) called all_country_data (happy to change this name). Now calling get_available_datasets() returns the saved data (and also filters for type using the type argument). The previous version of get_available_data() is now in a new function called render_available_data() which, when called will create the table by initalising each class like the previous version did.

A new R file called render_available_datasets.R in data-raw/ writes the all_country_data to the package data (which is also defined in datasets.R). To ensure contributors run this after adding a new dataset class I have added a test which will compare the current available datasets with that outputed by running render_available_datasets(). This will fail if a dataset class is added or if something in the class which is used in the table is modified (such as number of levels or urls) but the all_country_data table has not be re-rendered by running the render_available_datasets.R script. If this fails it will highlight this and suggest to run render_available_datasets.R.

closes #372

github-actions[bot] commented 3 years ago

👋 Thanks for opening this pull request! Can you please run through the following checklist before requesting review (ticking as complete or if not relevant).

Thank you again for the contribution. If making large scale changes consider using our pre-commit hooks (see the contributing guide) to more easily comply with our guidelines.

seabbs commented 3 years ago

ah did we include this in the news and increment the dev version?

joseph-palmer commented 3 years ago

Ah no I forgot, sorry!

seabbs commented 3 years ago

No problem we can slip it in as a news update prior to release.