{"id":16571567,"url":"https://github.com/hrbrmstr/cdcfluview","last_synced_at":"2025-03-16T20:31:19.541Z","repository":{"id":25642101,"uuid":"29077478","full_name":"hrbrmstr/cdcfluview","owner":"hrbrmstr","description":":mask: R package to Retrieve U.S. Flu Season Data from the CDC FluView Portal (WHO \u0026 ILINet)","archived":false,"fork":false,"pushed_at":"2023-08-27T00:42:36.000Z","size":16931,"stargazers_count":57,"open_issues_count":13,"forks_count":21,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-02-27T13:21:11.639Z","etag":null,"topics":["cdc","cdc-fluview-portal","national-influenza-statistics","r","rstats"],"latest_commit_sha":null,"homepage":"https://hrbrmstr.github.io/cdcfluview/index.html","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-01-11T01:26:20.000Z","updated_at":"2023-10-23T03:01:56.000Z","dependencies_parsed_at":"2022-08-24T14:10:12.897Z","dependency_job_id":"f8f1582b-e851-48d2-b97f-14586caec564","html_url":"https://github.com/hrbrmstr/cdcfluview","commit_stats":{"total_commits":84,"total_committers":6,"mean_commits":14.0,"dds":"0.38095238095238093","last_synced_commit":"60ffe50553371148e962daf5559fce8270ce3fdd"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fcdcfluview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fcdcfluview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fcdcfluview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fcdcfluview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/cdcfluview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdc","cdc-fluview-portal","national-influenza-statistics","r","rstats"],"created_at":"2024-10-11T21:24:27.469Z","updated_at":"2025-03-16T20:31:14.522Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: rmarkdown::github_document\neditor_options: \n  chunk_output_type: console\n---\n```{r pkg-knitr-opts, include=FALSE}\nhrbrpkghelpr::global_opts()\n```\n\n```{r badges, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::stinking_badges()\n```\n\nAll folks providing feedback, code or suggestions will be added to the DESCRIPTION file. Please include how you would prefer to be cited in any issues you file.\n\nIf there's a particular data set from https://www.cdc.gov/flu/weekly/fluviewinteractive.htm that you want and that isn't in the package, please file it as an issue and be as specific as you can (screen shot if possible).\n\n# :mask: cdcfluview\n\nRetrieve Flu Season Data from the United States Centers for Disease Control and Prevention ('CDC') 'FluView' Portal\n\n## Description\n\nThe U.S. Centers for Disease Control (CDC) maintains a portal \u003chttps://gis.cdc.gov/grasp/fluview/fluportaldashboard.html\u003e for accessing state, regional and national influenza statistics as well as Mortality Surveillance Data. The Flash interface makes it difficult and time-consuming to select and retrieve influenza data. This package provides functions to access the data provided by the portal's underlying API.\n\n## What's Inside The Tin\n\nThe following functions are implemented:\n\n- `age_group_distribution`:\tAge Group Distribution of Influenza Positive Tests Reported by Public Health Laboratories\n- `cdc_basemap`:\tRetrieve CDC U.S. base maps\n- `geographic_spread`:\tState and Territorial Epidemiologists Reports of Geographic Spread of Influenza\n- `get_weekly_flu_report`:\tRetrieves (high-level) weekly (XML) influenza surveillance report from the CDC\n- `hospitalizations`:\tLaboratory-Confirmed Influenza Hospitalizations\n- `ilinet`:\tRetrieve ILINet Surveillance Data\n- `ili_weekly_activity_indicators`:\tRetrieve weekly state-level ILI indicators per-state for a given season\n- `pi_mortality`:\tPneumonia and Influenza Mortality Surveillance\n- `state_data_providers`:\tRetrieve metadata about U.S. State CDC Provider Data\n- `surveillance_areas`:\tRetrieve a list of valid sub-regions for each surveillance area.\n- `who_nrevss`:\tRetrieve WHO/NREVSS Surveillance Data\n\nMMWR ID Utilities:\n\n- `mmwrid_map`:\tMMWR ID to Calendar Mappings\n- `mmwr_week`:\tConvert a Date to an MMWR day+week+year\n- `mmwr_weekday`:\tConvert a Date to an MMWR weekday\n- `mmwr_week_to_date`:\tConvert an MMWR year+week or year+week+day to a Date object\n\nDeprecated functions:\n\n- `get_flu_data`:\tRetrieves state, regional or national influenza statistics from the CDC (deprecated)\n- `get_hosp_data`:\tRetrieves influenza hospitalization statistics from the CDC (deprecated)\n- `get_state_data`:\tRetrieves state/territory-level influenza statistics from the CDC (deprecated)\n\nThe following data sets are included:\n\n- `hhs_regions`:\tHHS Region Table (a data frame with 59 rows and 4 variables)\n- `census_regions`:\tCensus Region Table (a data frame with 51 rows and 2 variables)\n- `mmwrid_map`:\tMMWR ID to Calendar Mappings (it is exported \u0026 available, no need to use `data()`)\n\n## Installation\n\n```{r eval=FALSE}\n# CRAN\ninstall.packages(\"cdcfluview\")\n\n# main branch\nremotes::install_git(\"https://git.rud.is/hrbrmstr/cdcfluview.git\")\nremotes::install_git(\"https://sr.ht/~hrbrmstr/cdcfluview\")\nremotes::install_git(\"https://gitlab.com/hrbrmstr/cdcfluview\")\nremotes::install_github(\"hrbrmstr/cdcfluview\")\n```\n\n## Usage\n\n```{r libs}\nlibrary(cdcfluview)\nlibrary(hrbrthemes)\nlibrary(tidyverse)\n\n# current version\npackageVersion(\"cdcfluview\")\n```\n\n### Age Group Distribution of Influenza Positive Tests Reported by Public Health Laboratories\n\n```{r age-group-dist}\nglimpse(age_group_distribution(years=2015))\n```\n\n### Retrieve CDC U.S. Coverage Map\n\n```{r cdc-basemaps}\nplot(cdc_basemap(\"national\"))\nplot(cdc_basemap(\"hhs\"))\nplot(cdc_basemap(\"census\"))\nplot(cdc_basemap(\"states\"))\nplot(cdc_basemap(\"spread\"))\nplot(cdc_basemap(\"surv\"))\n```\n\n### State and Territorial Epidemiologists Reports of Geographic Spread of Influenza\n\n```{r geographic-spread, message=FALSE, warning=FALSE}\nglimpse(geographic_spread())\n```\n\n### Laboratory-Confirmed Influenza Hospitalizations\n\n```{r surveillance-areas, fig.width=10, fig.height=7.5}\nsurveillance_areas()\n\nglimpse(fs_nat \u003c- hospitalizations(\"flusurv\"))\n\nggplot(fs_nat, aes(wk_end, rate)) + \n  geom_line(aes(color=age_label, group=age_label)) +\n  facet_wrap(~sea_description, scales=\"free_x\") +\n  scale_color_viridis_d(name=NULL) +\n  labs(x=NULL, y=\"Rates per 100,000 population\",\n       title=\"FluSurv-NET :: Entire Network :: All Seasons :: Cumulative Rate\") +\n  theme_ipsum_rc()\n\nglimpse(hospitalizations(\"eip\", years=2015))\n\nglimpse(hospitalizations(\"eip\", \"Colorado\", years=2015))\n\nglimpse(hospitalizations(\"ihsp\", years=2015))\n\nglimpse(hospitalizations(\"ihsp\", \"Oklahoma\", years=2010))\n```\n\n### Retrieve ILINet Surveillance Data\n\n```{r ili-df}\nwalk(c(\"national\", \"hhs\", \"census\", \"state\"), ~{\n  \n  ili_df \u003c- ilinet(region = .x)\n  \n  print(glimpse(ili_df))\n  \n  ggplot(ili_df, aes(week_start, unweighted_ili, group=region, color=region)) +\n    geom_line() +\n    viridis::scale_color_viridis(discrete=TRUE) +\n    labs(x=NULL, y=\"Unweighted ILI\", title=ili_df$region_type[1]) +\n    theme_ipsum_rc(grid=\"XY\") +\n    theme(legend.position = \"none\") -\u003e gg\n  \n  print(gg)\n  \n})\n```\n\n### Retrieve weekly state-level ILI indicators per-state for a given season\n\n```{r ili-weekly-activity, fig.width=10, fig.height=5}\nili_weekly_activity_indicators(2017)\n\nxdf \u003c- map_df(2008:2017, ili_weekly_activity_indicators)\n\ncount(xdf, weekend, activity_level_label) %\u003e% \n  complete(weekend, activity_level_label) %\u003e% \n  ggplot(aes(weekend, activity_level_label, fill=n)) + \n  geom_tile(color=\"#c2c2c2\", size=0.1) +\n  scale_x_date(expand=c(0,0)) +\n  viridis::scale_fill_viridis(name=\"# States\", na.value=\"White\") +\n  labs(x=NULL, y=NULL, title=\"Weekly ILI Indicators (all states)\") +\n  coord_fixed(100/1) +\n  theme_ipsum_rc(grid=\"\") +\n  theme(legend.position=\"bottom\")\n```\n\n### Pneumonia and Influenza Mortality Surveillance\n\n```{r nat-pi-mortality}\n(nat_pi \u003c- pi_mortality(\"national\"))\n\nselect(nat_pi, week_end, percent_pni, baseline, threshold) %\u003e% \n  gather(measure, value, -week_end) %\u003e% \n  ggplot(aes(week_end, value)) + \n  geom_line(aes(group=measure, color=measure)) + \n  scale_y_percent() +\n  scale_color_ipsum(name = NULL, labels=c(\"Baseline\", \"Percent P\u0026I\", \"Threshold\")) +\n  labs(x=NULL, y=\"% of all deaths due to P\u0026I\",\n       title=\"Percentage of all deaths due to pneumonia and influenza, National Summary\") +\n  theme_ipsum_rc(grid=\"XY\") +\n  theme(legend.position=\"bottom\")\n\n(st_pi \u003c- pi_mortality(\"state\", years=2015))\n\n(reg_pi \u003c- pi_mortality(\"region\", years=2015))\n```\n\n### Retrieve metadata about U.S. State CDC Provider Data\n\n```{r state-data-providers}\nstate_data_providers()\n```\n\n### Retrieve WHO/NREVSS Surveillance Data\n\n```{r who-vrevss}\nglimpse(xdat \u003c- who_nrevss(\"national\"))\n\nmutate(xdat$combined_prior_to_2015_16, \n       percent_positive = percent_positive / 100) %\u003e% \n  ggplot(aes(wk_date, percent_positive)) +\n  geom_line() +\n  scale_y_percent(name=\"% Positive\") +\n  labs(x=NULL, title=\"WHO/NREVSS Surveillance Data (National)\") +\n  theme_ipsum_rc(grid=\"XY\")\n\nwho_nrevss(\"hhs\", years=2016)\n\nwho_nrevss(\"census\", years=2016)\n\nwho_nrevss(\"state\", years=2016)\n```\n\n## cdcfluview Metrics\n\n```{r echo=FALSE}\ncloc::cloc_pkg_md()\n```\n\n## Code of Conduct\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fcdcfluview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fcdcfluview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fcdcfluview/lists"}