Giter VIP home page Giter VIP logo

epiforecasts / covidregionaldata Goto Github PK

View Code? Open in Web Editor NEW
37.0 9.0 18.0 90.73 MB

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.

Home Page: https://epiforecasts.io/covidregionaldata/

License: Other

Dockerfile 0.74% R 86.43% TeX 6.89% Shell 5.94%
covid-19 rstats data regional-data open-science r6

covidregionaldata's Issues

problem with `get_regional_data` for UK

Tried the CRAN version and had the following error:

library(covidregionaldata)
get_regional_data("UK")
#> Error: Must group by variables found in `.data`.
#> * Column `level_1_region_code` is not found.

Created on 2020-07-27 by the reprex package (v0.3.0)

Improve test coverage

Test coverage is good for key areas of the code but some functions are untested. See here for areas missing tests.

A large number of the functions missing tests are those that map the package data standard into a wider standard (that may not be currently in use) - should consider if these are still required as add quite a lot of overhead to the code base.

Getting started vignette

The basic functionality of the package is fairly obvious but some features (like the optional support for memoise) could really do with being briefly explained. Some examples of combining the data set in a simple analysis would also be really nice.

This would be ideally suited to a simple getting started vignette that could then be linked to from the README, the package website, and the package description.

Small fixes and updates

  • get_regional_data :
    • alter code so less dependent on specific variable names
    • add option to ignore country specific naming in favour of "region" and "region_code" columns
  • uk : (#60)
    • switch back to avoid using phe R package
    • return clean, structured data with additional raw data columns

JOSS submission

Now that covidregionaldata is on (pending binaries being built) CRAN it makes sense to get it peer-reviewed. My preferred venue for this would be JOSS. The only potential issue with this is the package functionality may be considered too "thin" for their requirements. What do people think? Any other suggestions?

If JOSS is a good venue then all that is needed for submission is a short summary paper (like this). There is also a checklist that needs to be gone through to make sure the package is up to standard but from the top of my head, I think we have done everything required.

If we think there is a better venue then JOSS then I am all ears.

Author ping: @sbfnk, @kathsherratt, @ffinger, @PaulC91, @patrickbarks, @sophiemeakin, @hamishgibbs, @jhellewell14

Obvious missing feature is #41 which needs to be in place ahead of submission.

Deaths in German data are by reporting date of case, not death

Hi,

I couldn't test the package (same problem as in Issue #28), but I looked a bit into your code and wanted to let you know about a particularity of the German RKI data: The death variable (AnzahlTodesfall) refers to cases registered on a given day which subsequently led to death. So it is not new deaths registered on a given date as you might expect and as is provided in the ECDC data.

To see the difference you can run the following:

# rki data:
rki <- read.csv("https://opendata.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0.csv",
                stringsAsFactors = FALSE)
sum(rki$AnzahlTodesfall[rki$Meldedatum == "2020/07/10 00:00:00"]) # set to date close to current date
# 2 on 22 July, may still increase

# ecdc data:
ecdc <- read.csv("https://opendata.ecdc.europa.eu/covid19/casedistribution/csv", na.strings = "", fileEncoding = "UTF-8-BOM")
ecdc$deaths[ecdc$countriesAndTerritories == "Germany" & ecdc$dateRep == "10/07/2020"]
# 6

To get the deaths by reporting date one essentially has to read the file from RKI every day and compute the number of new deaths from the difference to the data from the previous day. We are doing that here (and are aware of several other people doing the same thing): https://github.com/KITmetricslab/covid19-forecast-hub-de/tree/master/data-truth/RKI

Otherwise great idea, looking forward to using the package :)

Add description

Add a description of what the package is to the README and to the description field of the description file.

NAs in un_region for national data

library(covidregionaldata)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

all_countries <- get_national_data()
all_countries %>% 
  filter(is.na(un_region)) %>% 
  group_by(country) %>% 
  tally()
#> # A tibble: 5 x 2
#>   country            n
#>   <chr>          <int>
#> 1 Greece           233
#> 2 Namibia          233
#> 3 Spain              1
#> 4 Taiwan           233
#> 5 United Kingdom   233

Created on 2020-08-19 by the reprex package (v0.3.0)

Undefined exports

When trying to install the package the following error message occurs

Error: package or namespace load failed for ‘covidregionaldata’ in namespaceExport(ns, exports):
 undefined exports: format_ecdc_data, get_total_cases
Error: loading failed
Execution halted

which seems to be related to changes made in 9e83c53

Additionally I think@export might have been omitted from functions in national.R

Review status of get_linelist and get_international_linelist

  • Functions need to be merged
  • Stability of file download needs to be reviewed (I assume the file is now extremely larger)
  • We need data on report delays (date onset and date confirmation) for website Rt estimates. Making this data as easy and reliable to access as possible is key.
  • This function is now quite out of the general utility of the package but I think still worth having

WHO data

  • In national.R, update get_who_data to download from WHO csv directly
  • Change function @description
  • Change DESCRIPTION WHO data source
  • Check tests pass on updated data

Error when using include_level_2_regions with UK data

library(covidregionaldata)  
uk_regional <- get_regional_data("UK", include_level_2_regions = TRUE)
|======================================================================| 100%
#> Error: Problem with `mutate()` input `region_level_1`.
#> x object 'region_level_1' not found
#> ℹ Input `region_level_1` is `stringr::str_trim(region_level_1, side = "both")`.

Data Issue: India

Running the following code:
covidregionaldata::get_regional_data(country = "India")

results in the following error:
Error: Can't combine 'Date_YMD' <date> and 'AN' <double>.

Update pkgdown site

Current function reference for the pkgdown site does not list several useful functions including all the utilities. It would be good if this was updated.

Check no data from the future

In some data sets there are issues with data being encoded as being from the future. This is obviously false.

It could either be dealt with using a message or with a filter.

Update README

  • "Date is not included if totals is FALSE" = should be TRUE
  • If easy could convert the "coverage" section into an automatically updating table (so we don't have to manually update README with each new country)

Review status of get_interventions

  • We don't currently use this
  • I don't know what data source it links to
  • There are now many interventions databases
  • Do other packages already link to this data in a nice way - are we adding anything of use

Download failure graceful error

Currently when data cannot be downloaded the failure is not graceful and the error is not explicit. It would be great to catch downloads failures and return a clear error to speed up debugging.

For example when downloading the Colombian subnational data we see the following error:

Backtrace:
     █
  1. ├─data.table::setDT(covidregionaldata::get_regional_data(country = "colombia"))
  2. └─covidregionaldata::get_regional_data(country = "colombia")
  3.   └─data %>% left_join_region_codes(region_codes_table, by = c(region_level_1 = "region"))
  4.     ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  5.     └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
  6.       └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
  7.         └─covidregionaldata:::`_fseq`(`_lhs`)
  8.           └─magrittr::freduce(value, `_function_list`)
  9.             ├─base::withVisible(function_list[[k]](value))
 10.             └─function_list[[k]](value)
 11.               └─covidregionaldata:::left_join_region_codes(...)
 12.                 ├─dplyr::left_join(data, region_codes_table, by = by, ...)
 13.                 └─dplyr:::left_join.data.frame(...)

Duplicate rows for some authorities in UK regional data

library(covidregionaldata)
library(dplyr)

uk_regional <- get_regional_data("UK", include_level_2_regions = TRUE)
#>  |======================================================================| 100%

uk_regional[duplicated(uk_regional), ] %>% 
  group_by(authority) %>% 
  tally()

#> # A tibble: 4 x 2
#>   authority                 n
#>   <chr>                 <int>
#> 1 Dumfries and Galloway   230
#> 2 Fife                    230
#> 3 Highland                230
#> 4 Powys                   230

Release 0.6.0

Updates for next release:

  • Increment version in description, dev badge in README and add new section to NEWS.md
  • Add download tracker to README
  • New regional data sources:
    1. get data in separate get_country_cases function
    2. add to get_region_codes
    3. add to get_regional_data
    • Austria: #30
    • Mexico
  • Fixes:
    • national.R - broken WHO data link : #39
    • germany.R - add option to switch data source for deaths to return by date of death
    • WORDLIST.md - update
    • Add package website and issues tracker to the description.

Move from NCoVUtils

Need to notify users of NCoVUtils that development has switched. This is mostly an internal issue for epiforecast packages.

Pinging @Jonnie-Bevan that we have changed to the new package. Your branch should also be here but unfortunately there will be quite a few merge conflicts I imagine (unfortunately lost the pull request).

Uk data CI tests failing

The API is timing out the UK data tests (likely due to protections around the number of hits from a single IP).

It would make sense to set up a single data pull and then run tests or to use memoise/mocking as in the other tests.

This is relatively high priority as it leads our CRAN check to show as FALSE which will make it harder to detect real issues.

Review author list

  • Many people have now contributed - authorship needs to be reviewed with ordering updated.

Meta issue: General package feedback

Opening this issue as a more general discussion thread for package users. Please use this to let us know what works or doesn't work in package use, beyond specific bugs/issues.

We have very limited resources, so provide for only a fairly basic use case (largely driven by how we use the package in our work). It would be good to hear how other users interact with the package and what could be improved.

Additional data sets meta issue

covidregionaldata currently supports only a small fraction of the available regional data sets. This issue is a good place to start the discussion on new data sets before opening individual issues.

Please note that we are very happy to have additional data sets be contributed but may need ongoing help supporting them if they are not stable in their availability. For contribution guidelines please see the package README.

JOSS/ROpenSci publication

Thread to discuss package peer review. Thoughts and assistance welcome. Looking everything over what is here seems solid and appears to still be a fairly valuable contribution.

  • Review package functionality and check working as intended
  • Review package is still needed given other packages that have been developed.
  • Review JOSS guidelines and check matches expectations/ an interesting alternative would be ROpenSci but need to check criteria
  • Add lifecycle badges to indicate functionality stability and sunset areas of the package the are maybe not in use.
  • Review package issues and fix is possible.
  • Write short paper as required (1 page)
  • Submit latest version to CRAN.
  • Finalise Authorship (my vote as is with SEA and KS switching positions).
  • Submit to JOSS/ROpenSci.

Integrate with Google open data.

A team at google compile an extensive open data source that is available here: https://github.com/GoogleCloudPlatform/covid-19-open-data

This has multiple data types many of which look useful. The easiest to integrate into our R tooling would be the epidemiology data (published as a csv) which is made up of case counts nationally and subnationally over multiple scales. This includes countries for which we already offer a data source as well as new countries.

A sensible first step would be to implement a function that downloads this data (using caching as elsewhere in the package) and allows filtering by country and geographic scale. This could then be linked to our other data extraction functions.

Simplify unit testing

The unit tests are very prone to failing.

Could we simplify to a set of tests that are applied to all countries (instead of having many individual unit tests for each country, as now)?

We now have the data_check() function / vignette which (should) automate some of the more advanced checks like how many regions are returned. (Should probably set up some king of flagging / alert system there too - just not one that causes everything else to fail along with it!)

Error on installing

I get the following error when trying to install from the development version onto my machine. Any ideas?

remotes::install_github("epiforecasts/covidregionaldata")

image

Automated checks to see if data is updating and downloadable

Currently, this is done via unit tests failing but this is not catching most data failures so needs to be expanded.

It would be sensible to add a data status vignette that records the last date of update and updates via GitHub Actions (using pkgdown).

Add new countries

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.