-
Notifications
You must be signed in to change notification settings - Fork 0
Add Function For Generating Forecast Webpage Text #38
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #38 +/- ##
========================================
- Coverage 8.74% 6.65% -2.09%
========================================
Files 10 11 +1
Lines 743 976 +233
========================================
Hits 65 65
- Misses 678 911 +233 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This can be reviewed @dylanhmorris (tagging since notification may have been buried or perceived as stale). |
|
Thank you for flagging. Will review. |
dylanhmorris
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes needed, and one decision to make about refactor now versus later (I favor now): https://github.com/CDCgov/hubhelpr/pull/38/files#r2603084226
R/get_webtext.R
Outdated
| reporting_rate_flag <- if ( | ||
| length(latest_reporting_below80$location_name) > 0 | ||
| ) { | ||
| location_list <- cli::ansi_collapse( | ||
| latest_reporting_below80$location_name, | ||
| sep = ", ", | ||
| last = ", and " | ||
| ) | ||
|
|
||
| glue::glue( | ||
| "The following jurisdictions had <80% of hospitals reporting for ", | ||
| "the most recent week: {location_list}. ", | ||
| "Lower reporting rates could impact forecast validity. Percent ", | ||
| "of hospitals reporting is calculated based on the number of active ", | ||
| "hospitals reporting complete data to NHSN for a given reporting week.\n\n" | ||
| ) | ||
| } else { | ||
| "" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style point: I think this is long enough that it shouldn't be a conditional assignment.
| reporting_rate_flag <- if ( | |
| length(latest_reporting_below80$location_name) > 0 | |
| ) { | |
| location_list <- cli::ansi_collapse( | |
| latest_reporting_below80$location_name, | |
| sep = ", ", | |
| last = ", and " | |
| ) | |
| glue::glue( | |
| "The following jurisdictions had <80% of hospitals reporting for ", | |
| "the most recent week: {location_list}. ", | |
| "Lower reporting rates could impact forecast validity. Percent ", | |
| "of hospitals reporting is calculated based on the number of active ", | |
| "hospitals reporting complete data to NHSN for a given reporting week.\n\n" | |
| ) | |
| } else { | |
| "" | |
| } | |
| any_locations_flagged <- nrow(latest_reporting_below80) > 0 | |
| if (any_locations_flagged) { | |
| location_list <- cli::ansi_collapse( | |
| latest_reporting_below80$location_name, | |
| sep = ", ", | |
| last = ", and " | |
| ) | |
| reporting_rate_flag <- glue::glue( | |
| "The following jurisdictions had <80% of hospitals reporting for ", | |
| "the most recent week: {location_list}. ", | |
| "Lower reporting rates could impact forecast validity. Percent ", | |
| "of hospitals reporting is calculated based on the number of active ", | |
| "hospitals reporting complete data to NHSN for a given reporting week.\n\n" | |
| ) | |
| } else { | |
| reporting_rate_flag <- "" | |
| } | |
This PR:
get_webtext.Rfrom https://github.com/CDCgov/covid19-forecast-hub/blob/main/src/get_webtext.R.get_webtext.Rminorly:glueinstead ofpaste.pull_nhsn()topull_data_cdc_gov().get_webtext, removing the argument parsing logic and allowing use ofdevtools::document().pre-commitwithpre-commit autoupdate.