Skip to content

Add Support For NHSN PRISM Thresholds - #251

Merged
dylanhmorris merged 36 commits into
mainfrom
250-add-prism-nhsn-thresholds-make-categorize_prism-handle-both-nhsn-and-nssp-thresholds
Aug 17, 2026
Merged

Add Support For NHSN PRISM Thresholds#251
dylanhmorris merged 36 commits into
mainfrom
250-add-prism-nhsn-thresholds-make-categorize_prism-handle-both-nhsn-and-nssp-thresholds

Conversation

@O957

@O957 O957 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This PR:

  • ...

@O957

O957 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

An example for prism_thresholds and get_prism_cutpoints.

pkgload::load_all(".")

str(prism_thresholds, max.level = 1)
lapply(prism_thresholds, dim)

# List of 2
#  $ nssp: num [1:6, 1:4, 1:53, 1:2] 0 0.12 0.158 0.195 0.233 ...
#   ..- attr(*, "dimnames")=List of 4
#  $ nhsn: num [1:6, 1:3, 1:49, 1, 1:2] 0 15 22 40 50.9 ...
#   ..- attr(*, "dimnames")=List of 5

wa_flu_nhsn <- get_prism_cutpoints("WA", "Influenza", signal = "NHSN")
print(wa_flu_nhsn)

# [[1]]
#    very_low         low    moderate        high   very_high upper_bound
#     0.00000    80.49482   184.53374   657.32177   928.29039         Inf

wa_flu_nhsn_rate <- get_prism_cutpoints(
  "WA",
  "Influenza",
  signal = "NHSN",
  unit = "rate"
)
print(wa_flu_nhsn_rate)

# [[1]]
#    very_low         low    moderate        high   very_high upper_bound 
#    0.000000    1.036759    2.376762    8.466189   11.956217         Inf 

wa_flu_nssp <- get_prism_cutpoints("WA", "Influenza", signal = "NSSP")
print(wa_flu_nssp)

# [[1]]
#    prop_very_low         prop_low    prop_moderate        prop_high 
#      0.000000000      0.002766458      0.030385827      0.058005195 
#   prop_very_high prop_upper_bound 
#      0.085624564      1.000000000 

Comment thread R/categorize_prism.R Outdated
Comment thread data-raw/prism_thresholds.R Outdated
@O957

O957 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Same r example from before but without unit = "rate"

pkgload::load_all(".")

str(prism_thresholds, max.level = 1)
lapply(prism_thresholds, dim)

# List of 2
#  $ nssp: num [1:6, 1:4, 1:53, 1:2] 0 0.12 0.158 0.195 0.233 ...
#   ..- attr(*, "dimnames")=List of 4
#  $ nhsn: num [1:6, 1:3, 1:49, 1] 0 2.11 3.09 5.62 7.15 ...
#   ..- attr(*, "dimnames")=List of 4

wa_flu_nhsn <- get_prism_cutpoints("WA", "Influenza", signal = "NHSN")
print(wa_flu_nhsn)

# [[1]]
#    very_low         low    moderate        high   very_high upper_bound
#     0.00000    80.49482   184.53374   657.32177   928.29039         Inf

wa_flu_nssp <- get_prism_cutpoints("WA", "Influenza", signal = "NSSP")
print(wa_flu_nssp)

# [[1]]
#    prop_very_low         prop_low    prop_moderate        prop_high
#      0.000000000      0.002766458      0.030385827      0.058005195
#   prop_very_high prop_upper_bound
#      0.085624564      1.000000000

@O957
O957 marked this pull request as ready for review August 6, 2026 16:07
@O957
O957 requested a review from damonbayer as a code owner August 6, 2026 16:07
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.22%. Comparing base (ee77c4a) to head (0cd3719).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #251      +/-   ##
==========================================
+ Coverage   74.92%   75.22%   +0.30%     
==========================================
  Files          36       36              
  Lines        2042     2067      +25     
==========================================
+ Hits         1530     1555      +25     
  Misses        512      512              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread data-raw/prism_thresholds.R Outdated
Comment thread inst/extdata/prism_thresholds/nhsn/2026-08-06.tsv
Comment thread data-raw/prism_thresholds.R Outdated
@dylanhmorris

Copy link
Copy Markdown
Collaborator

Flagging that I've added this requirement to the issue @O957

The signal argument should be vectorized, just as the location and disease arguments are.

Comment thread R/constants.R Outdated
Comment thread data-raw/prism_thresholds.R Outdated
Comment thread data-raw/prism_thresholds.R
@O957
O957 requested a review from dylanhmorris August 14, 2026 13:17
Comment thread data-raw/prism_thresholds.R Outdated
Comment thread data-raw/prism_thresholds.R Outdated
Comment thread R/categorize_prism.R Outdated
Comment thread R/categorize_prism.R Outdated
Comment thread R/categorize_prism.R Outdated
Comment thread R/categorize_prism.R Outdated
Comment thread tests/testthat/test_categorize_prism.R
Comment thread tests/testthat/test_categorize_prism.R Outdated
Comment thread tests/testthat/test_categorize_prism.R Outdated

@dylanhmorris dylanhmorris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @O957. A few more changes needed but I think this can land today.

@dylanhmorris dylanhmorris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @O957!

Comment thread R/categorize_prism.R

@dylanhmorris dylanhmorris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught one thing.

@O957
O957 requested a review from dylanhmorris August 17, 2026 18:03
Comment thread R/categorize_prism.R Outdated
@O957
O957 requested a review from dylanhmorris August 17, 2026 18:11

@dylanhmorris dylanhmorris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @O957!

@dylanhmorris
dylanhmorris merged commit f03923b into main Aug 17, 2026
12 checks passed
@dylanhmorris
dylanhmorris deleted the 250-add-prism-nhsn-thresholds-make-categorize_prism-handle-both-nhsn-and-nssp-thresholds branch August 17, 2026 19:52
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.

Add PRISM NHSN thresholds, make categorize_prism handle both NHSN and NSSP thresholds

3 participants