-
Notifications
You must be signed in to change notification settings - Fork 5
nhsn
doesn't appear on covidcast_epidata()
source or signal lists
#300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
import requests ; print('nhsn' in {m['data_source'] for m in requests.get("https://api.delphi.cmu.edu/epidata/covidcast_meta/").json()['epidata']}) perhaps this is a caching issue? |
@melange396 this isn't based on covidcast_meta but covidcast/meta. Doesn't seem to be in the latter. |
Ah, ok! I should have checked to see which of the two covidcast meta endpoints you were using, but i presumed it was The endpoint you are using is restricted to only the signals that have individual write-ups in the "signals" google doc (which includes some description text and other details) -- and NHSN has apparently not been added to that doc yet. I will see what i can do about getting that attended to. If you are going to continue using this metadata endpoint, you might consider adding accessors in the epidatr client for some of the attributes it provides, like |
4 NHSN signals went into the description metadata with cmu-delphi/delphi-epidata#1599, and will be publicly available as soon as a |
This should be fixed on the server-side now... Can you verify? |
It's sort of fixed, sort of more broken client-side: library(epidatr)
#> ! epidatr cache is being used (set env var EPIDATR_USE_CACHE=FALSE if not
#> intended).
#> ℹ The cache directory is ~/.cache/R/epidatr.
#> ℹ The cache will be cleared after 14 days and will be pruned if it exceeds 4096
#> MB.
#> ℹ The log of cache transactions is stored at ~/.cache/R/epidatr/logfile.txt.
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
cce <- covidcast_epidata()
"hhs" %in% names(cce$sources)
#> [1] TRUE
"nhsn" %in% names(cce$sources)
#> [1] TRUE
"hhs" %in% (cce$signals %>% as_tibble() %>% .$source)
#> Error in `map_chr()` at epidatr/R/covidcast.R:80:3:
#> ℹ In index: 457.
#> ℹ With name: nhsn:confirmed_admissions_covid_ew.
#> Caused by error:
#> ! Result must be length 1, not 0.
"nhsn" %in% (cce$signals %>% as_tibble() %>% .$source)
#> Error in `map_chr()` at epidatr/R/covidcast.R:80:3:
#> ℹ In index: 457.
#> ℹ With name: nhsn:confirmed_admissions_covid_ew.
#> Caused by error:
#> ! Result must be length 1, not 0.
cce$sources
#> $chng
#> [1] "Change Healthcare"
#> [1] "chng"
#> [1] "Change Healthcare is a healthcare technology company that aggregates medical claims data from many healthcare providers. This source includes aggregated counts of claims with confirmed COVID-19 or COVID-related symptoms. All claims data has been de-identified in accordance with HIPAA privacy regulations. "
#> # A tibble: 8 × 2
#> signal short_description
#> <chr> <chr>
#> 1 smoothed_outpatient_cli Estimated percentage of outpatient doctor visit…
#> 2 smoothed_adj_outpatient_cli Estimated percentage of outpatient doctor visit…
#> 3 smoothed_outpatient_covid COVID-Confirmed Doctor Visits
#> 4 smoothed_adj_outpatient_covid COVID-Confirmed Doctor Visits
#> 5 smoothed_outpatient_flu Estimated percentage of outpatient doctor visit…
#> 6 smoothed_adj_outpatient_flu Estimated percentage of outpatient doctor visit…
#> 7 7dav_inpatient_covid Ratio of inpatient hospitalizations associated …
#> 8 7dav_outpatient_covid Ratio of outpatient doctor visits with confirme…
# [...]
# [...]
# [...]
#> $nssp
#> [1] "National Syndromic Surveillance Program"
#> [1] "nssp"
#> [1] "The National Syndromic Surveillance Program (NSSP) is an effort to track epidemiologically relevant conditions. This dataset in particular tracks emergency department (ED) visits arising from a subset of influenza-like illnesses, specifically influenza, COVID-19, and respiratory syncytial virus (RSV)."
#> # A tibble: 8 × 2
#> signal short_description
#> <chr> <chr>
#> 1 pct_ed_visits_covid Percent of ED visits that had a discharge di…
#> 2 pct_ed_visits_influenza Percent of ED visits that had a discharge di…
#> 3 pct_ed_visits_rsv Percent of ED visits that had a discharge di…
#> 4 pct_ed_visits_combined Percent of ED visits that had a discharge di…
#> 5 smoothed_pct_ed_visits_covid 3-week moving average of percent of ED visit…
#> 6 smoothed_pct_ed_visits_influenza 3-week moving average of percent of ED visit…
#> 7 smoothed_pct_ed_visits_rsv 3-week moving average of percent of ED visit…
#> 8 smoothed_pct_ed_visits_combined 3-week moving average of percent of ED visit…
#>
#> $nhsn
#> [1] "National Healthcare Safety Network"
#> [1] "nhsn"
#> [1] "The National Healthcare Safety Network (NHSN) is the nation’s most widely used healthcare-associated infection tracking system. "
#> Error in `map_chr()` at epidatr/R/covidcast.R:80:3:
#> ℹ In index: 1.
#> ℹ With name: confirmed_admissions_covid_ew.
#> Caused by error:
#> ! Result must be length 1, not 0.
cce$signals
#> Error in `map_chr()` at epidatr/R/covidcast.R:80:3:
#> ℹ In index: 457.
#> ℹ With name: nhsn:confirmed_admissions_covid_ew.
#> Caused by error:
#> ! Result must be length 1, not 0. Created on 2025-03-04 with reprex v2.1.1 |
The current issue, at least for printing the signal list, seems to be the lack of a "value_label" entry for nhsn signals. cce$signals %>% purrr::map("value_label")
#> $`chng:smoothed_outpatient_cli`
#> [1] "Value"
#>
#> $`chng:smoothed_adj_outpatient_cli`
#> [1] "Value"
# [...]
# [...]
# [...]
#> $`nssp:smoothed_pct_ed_visits_rsv`
#> [1] "Percentage"
#>
#> $`nssp:smoothed_pct_ed_visits_combined`
#> [1] "Percentage"
#>
#> $`nhsn:confirmed_admissions_covid_ew`
#> NULL
#>
#> $`nhsn:hosprep_confirmed_admissions_covid_ew`
#> NULL
#>
#> $`nhsn:confirmed_admissions_covid_ew_prelim`
#> NULL
#>
#> $`nhsn:hosprep_confirmed_admissions_covid_ew_prelim`
#> NULL
#>
#> $`nhsn:confirmed_admissions_flu_ew`
#> NULL
#>
#> $`nhsn:hosprep_confirmed_admissions_flu_ew`
#> NULL
#>
#> $`nhsn:confirmed_admissions_flu_ew_prelim`
#> NULL
#>
#> $`nhsn:hosprep_confirmed_admissions_flu_ew_prelim`
#> NULL
#>
#> $`nhsn:confirmed_admissions_rsv_ew`
#> NULL
#>
#> $`nhsn:hosprep_confirmed_admissions_rsv_ew`
#> NULL
#>
#> $`nhsn:confirmed_admissions_rsv_ew_prelim`
#> NULL
#>
#> $`nhsn:hosprep_confirmed_admissions_rsv_ew_prelim`
#> NULL |
I just added value labels in the spreadsheet. |
https://cran.r-project.org/web/checks/check_results_epidatr.html ok, so I guess we should check back on this next week; we've got until the 28th to have it functional. |
This newer problem should go away once cmu-delphi/delphi-epidata#1622 is approved and then released, but its not a bad idea to handle missing fields more gracefully, in case something like this happens again in the future. It looks like you can specify a Lines 72 to 83 in 0026856
Lines 187 to 191 in 0026856
|
Fixing #300 by giving default values for fields
but it seems from doc pages (nhsn, hhs) that it should appear? This might be an upstream metadata issue.
Created on 2025-01-29 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: