Skip to content

Generate weekly visualization data #11

Generate weekly visualization data

Generate weekly visualization data #11

name: Generate weekly visualization data
on:
workflow_dispatch:
schedule:
- cron: '00 16 * * 4'
jobs:
update-visualization-data:
if: ${{ github.repository_owner == 'CDCgov' }}
runs-on: ubuntu-22.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v4
with:
application_id: ${{ vars.GH_APP_ID }}
application_private_key: ${{ secrets.GH_APP_KEY }}
- name: Checkout code
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- name: Install dependencies
run: |
install.packages(c("argparser", "fs", "readr", "dplyr", "remotes", "RcppTOML", "tidyr", "lubridate", "glue"))
remotes::install_github('cdcgov/forecasttools')
remotes::install_github("hubverse-org/hubData")
shell: Rscript {0}
- name: Generate data files
run: |
REF_DATE=$(Rscript -e "cat(strftime(lubridate::ceiling_date(lubridate::today(), 'week', week_start = 6, change_on_boundary = FALSE)))")
Rscript src/get_covid_hosp_data.R --reference_date "$REF_DATE" --base_hub_path "." --target_data FALSE
Rscript src/get_forecast_data.R --reference_date "$REF_DATE" --base_hub_path "." --horizons_to_include 0 1 2
Rscript src/get_map_data.R --reference_date "$REF_DATE" --base_hub_path "." --horizons_to_include 0 1 2
Rscript src/get_webtext.R --reference_date "$REF_DATE" --base_hub_path "."
env:
NHSN_API_KEY_ID: ${{ secrets.NHSN_API_KEY_ID }}
NHSN_API_KEY_SECRET: ${{ secrets.NHSN_API_KEY_SECRET }}
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "Update weekly data and web text"
default_author: github_actions
push: true
new_branch: add-viz-data
- name: Create pull request
run: |
gh pr create --base main --head add-viz-data --title "Weekly forecast visualization data" --body "This PR adds weekly visualization data files to the repo."
env:
GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }}