Skip to content

Conversation

@O957
Copy link
Collaborator

@O957 O957 commented Sep 22, 2025

This PR:

  • Adds over get_webtext.R from https://github.com/CDCgov/covid19-forecast-hub/blob/main/src/get_webtext.R.
  • Refactors get_webtext.R minorly:
    • Updates code and docstrings to use interchangeable hub prefixes and names.
    • Updates code to use glue instead of paste.
    • Updates the function pull_nhsn() to pull_data_cdc_gov().
    • Adds a function called get_webtext, removing the argument parsing logic and allowing use of devtools::document().
  • Updates pre-commit with pre-commit autoupdate.

@O957 O957 self-assigned this Sep 22, 2025
@O957 O957 linked an issue Sep 22, 2025 that may be closed by this pull request
@O957 O957 added this to the hubhelpr v0.1.0 milestone Sep 22, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 0% with 233 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.65%. Comparing base (02fe0c9) to head (0851315).

Files with missing lines Patch % Lines
R/write_webtext.R 0.00% 233 Missing ⚠️
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.
📢 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.

@O957 O957 changed the title Add And Update Script For Webtext Add Function To Generate Webpage Forecast Visualizations Nov 25, 2025
@O957 O957 changed the title Add Function To Generate Webpage Forecast Visualizations Add Function For Generating Webpage Forecast Visualizations Nov 25, 2025
@O957
Copy link
Collaborator Author

O957 commented Dec 8, 2025

This can be reviewed @dylanhmorris (tagging since notification may have been buried or perceived as stale).

@dylanhmorris
Copy link
Contributor

Thank you for flagging. Will review.

@dylanhmorris dylanhmorris changed the title Add Function For Generating Webpage Forecast Visualizations Add Function For Generating Forecast Webpage Text Dec 9, 2025
Copy link
Contributor

@dylanhmorris dylanhmorris left a 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

@O957 O957 requested a review from dylanhmorris December 9, 2025 20:48
@O957 O957 requested a review from dylanhmorris December 11, 2025 16:08
R/get_webtext.R Outdated
Comment on lines 86 to 104
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 {
""
}
Copy link
Contributor

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.

Suggested change
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 <- ""
}

@O957 O957 requested a review from dylanhmorris December 11, 2025 16:55
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 Function For Generating Webpage Forecast Visualizations

5 participants