Last active
April 25, 2025 17:50
-
-
Save zkamvar/011f876ba85d1b46ed43d1be8c503875 to your computer and use it in GitHub Desktop.
Steps I took to fix a dashboard (dramatized)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
wd=$(pwd) | |
# Clone the hub and the dashboard | |
git clone https://github.com/reichlab/flu-metrocast.git | |
git clone https://github.com/reichlab/metrocast-dashboard.git | |
# Temporarily place the ptc/data and predevals/data branches as | |
# sub-directories of the dashboard. This allows us to quickly | |
# preview the changes using the site builder | |
# by making the data local | |
cd metrocast-dashboard | |
git worktree add data/ptc ptc/data | |
git worktree add data/evals predevals/data | |
cd $wd | |
# install hub-dashboard-predtimechart at the fix commit | |
git clone https://github.com/hubverse-org/hub-dashboard-predtimechart.git | |
cd hub-dashboard-predtimechart | |
git checkout 39068f47ad6bfc467290430e9fa359691d529786 | |
uv venv --seed | |
source .venv/bin/activate | |
pip install . | |
# Generate the target data for the hub | |
ptc_generate_target_json_files \ | |
$wd/flu-metrocast/ \ | |
$wd/metrocast-dashboard/predtimechart-config.yml \ | |
$wd/metrocast-dashboard/data/ptc/targets | |
#| 2025-04-25T15:23:57.357644Z [info ] main(hub_dir='/path/to/wd/flu-metrocast/', | |
#| target_out_dir='/path/to/wd/metrocast-dashboard/data/ptc/targets', | |
#| regenerate=False): entered filename=generate_target_json_files.py func_name=main version=0.0.1 | |
#| 2025-04-25T15:23:58.369043Z [info ] main(): done: 11 JSON files generated: [ | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/ILI-ED-visits_NYC_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/ILI-ED-visits_Bronx_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/ILI-ED-visits_Brooklyn_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/ILI-ED-visits_Manhattan_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/ILI-ED-visits_Queens_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/ILI-ED-visits_Staten-Island_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/Flu-ED-visits-pct_Austin_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/Flu-ED-visits-pct_Houston_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/Flu-ED-visits-pct_Dallas_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/Flu-ED-visits-pct_El-Paso_2025-04-26.json', | |
#| '/path/to/wd/metrocast-dashboard/data/ptc/targets/Flu-ED-visits-pct_San-Antonio_2025-04-26.json' | |
#| ]. | |
#| filename=generate_target_json_files.py func_name=main version=0.0.1 | |
# Preview the site to make sure it's no longer failing | |
cd $wd/metrocast-dashboard | |
docker pull ghcr.io/hubverse-org/hub-dash-site-builder:latest | |
docker run --platform=linux/amd64 --rm -it -v "$(pwd)":"/site" \ | |
ghcr.io/hubverse-org/hub-dash-site-builder:latest \ | |
render.sh -p data/ptc -e data/evals -o _site | |
python -m http.server 8080 -d _site | |
^D | |
# Commit the changes and create a pull request | |
# NOTE: remember that we have the `ptc/data` branch inside a worktree folder called `data/ptc` | |
# switching to this folder is the same as checking out the branch. | |
cd data/ptc | |
git switch -c znk/update-target-data | |
git add . | |
git commit -m '[hotfix] update target data' | |
git push --set-upstream origin znk/update-target-data | |
gh pr create --base ptc/data --fill | |
cd - | |
rm -rf _site data | |
git worktree prune -v | |
#| Removing worktrees/evals: gitdir file points to non-existent location | |
#| Removing worktrees/ptc: gitdir file points to non-existent location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment