Skip to content

Conversation

@vpnagraj
Copy link

@hrbrmstr thank you for developing and maintaining this package!

i have been using the hospitalizations() function to retrieve FluSurv-NET data. it looks like a recent update may have had a minor bug in this function. the problem was discussed in an issue thread (#30 (comment)) ... i am putting together this PR to implement the suggestion from @IMcGovern-Seqirus

the code below should demonstrate the issue with the code currently on main branch => the fix as implemented on my fork (and incoming via this PR).

thanks again for creating this package. i am happy to make any adjustments to the PR as you see fit.

remotes::install_github("hrbrmstr/cdcfluview")
.rs.restartR()
packageVersion("cdcfluview")
#> [1] '1.0.0.9000'
library(cdcfluview)
all_hosp <- hospitalizations()
#> Error in hospitalizations(): object 'res' not found
remotes::install_github("vpnagraj/cdcfluview")
.rs.restartR()
packageVersion("cdcfluview")
#> [1] '1.0.0.9001'
library(cdcfluview)
all_hosp <- hospitalizations()
max(all_hosp$weekend)
#> [1] "2023-04-29"

and devtools::check() on local machine comes back clean with 0 ERRORs, 0 WARNINGs, 0 NOTEs

@dwchal
Copy link

dwchal commented Sep 11, 2023

This is great - is there any way to have this function retrieve the weekly hospitalization data that is published on the weekly report? Currently it is only updating through April, 2023.

@philipshirk
Copy link

philipshirk commented Nov 6, 2023

I haven't tested this thoroughly, but it appears that hospitalizations:

  1. only downloads FluSurv-NET data (not the individual component networks: EIP & IHSP)
    all.equal(hospitalizations(surveillance_area = 'flusurv', region = 'all')$rates, hospitalizations(surveillance_area = 'eip', region = 'all')$rates)
  2. duplicates the data 3x (once for each of "FluSurv-NET, EIP, IHSP) because of joining by "catchmentid" instead of c("networkid", "catchmentid") (link)
  3. drops the columns containing race and sex info, which results in multiple measurements for each category.

This might be a working fix for downloading only the FluSurv-NET data: https://github.com/philipshirk/cdcfluview/blob/master/R/hospital.r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants