Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7490ee4
Add shared forecast pipeline utilities and tests
SamuelBrand1 Dec 11, 2025
1641e59
change to relative imports
SamuelBrand1 Dec 11, 2025
2e434ea
add Parquet dep
SamuelBrand1 Dec 11, 2025
fca72b0
reduce docstring bloat
SamuelBrand1 Dec 11, 2025
f89673e
Add PipelineOutput support for pipeline forecasts
SamuelBrand1 Dec 11, 2025
0cbc8fd
Add DEFAULT_TARGET_LETTER and update output filenames
SamuelBrand1 Dec 11, 2025
5156147
move utils and rename paths dataclass
SamuelBrand1 Dec 12, 2025
4401bef
Add use_percentage flag to EpiAutoGPInput and output logic
SamuelBrand1 Dec 12, 2025
44fa0af
Refactor EpiAutoGP pipeline and add end-to-end tests
SamuelBrand1 Dec 12, 2025
966f4d6
Update .gitignore
SamuelBrand1 Dec 12, 2025
02591bb
Refactor EpiAutoGP post-processing into utility function
SamuelBrand1 Dec 12, 2025
9b46362
Refactor forecast utils to use context methods
SamuelBrand1 Dec 12, 2025
ada1b74
Update README.md
SamuelBrand1 Dec 12, 2025
6cef44d
Add frequency to input and generalize forecast horizon
SamuelBrand1 Dec 12, 2025
74cbe8d
Add ed_visit_type to input and output handling
SamuelBrand1 Dec 12, 2025
b693b8f
Add ed_visit_type param for NSSP/ED visit modeling
SamuelBrand1 Dec 12, 2025
2d258cb
Add daily NSSP forecast tests and support for ED visit type
SamuelBrand1 Dec 12, 2025
6a4426e
Refactor forecast utils tests and remove prep_epiautogp tests
SamuelBrand1 Dec 12, 2025
ea73cd8
update epiautogp docstrings
SamuelBrand1 Dec 15, 2025
511cf26
Update prep_epiautogp_data.py
SamuelBrand1 Dec 15, 2025
0dd0f9f
Update output.jl
SamuelBrand1 Dec 15, 2025
ae9313e
add nhsn test coverage
SamuelBrand1 Dec 15, 2025
e16f115
reorg unit tests
SamuelBrand1 Dec 15, 2025
65e5d2d
Update pipelines/epiautogp/process_epiautogp_forecast.py
SamuelBrand1 Dec 15, 2025
551543a
caught anti-pattern
SamuelBrand1 Dec 15, 2025
6bb924c
Merge branch '780-add-forecast_epiautogp-function' of https://github.…
SamuelBrand1 Dec 15, 2025
bc5dbce
explain use of percentage
SamuelBrand1 Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add daily NSSP forecast tests and support for ED visit type
Expanded end-to-end and fit test scripts to include daily NSSP count and 'other ED visits' forecasts. Updated argument handling in test_epiautogp_fit.sh to support an optional ed_visit_type parameter and adjusted expected model counts accordingly.
  • Loading branch information
SamuelBrand1 committed Dec 12, 2025
commit 2d258cba420754c9a2f3e1dfc0034f472d3aed43
45 changes: 40 additions & 5 deletions pipelines/tests/test_epiautogp_end_to_end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ echo "========================================"
echo "Testing configurations:"
echo " Locations: ${LOCATIONS[*]}"
echo " Diseases: ${DISEASES[*]}"
echo " Targets: NHSN (weekly), NSSP (weekly percentage)"
echo " Targets: NHSN (weekly), NSSP (weekly percentage), NSSP (daily counts), NSSP (daily other ED visits)"
echo " Forecast date: $FORECAST_DATE"
echo ""

Expand Down Expand Up @@ -64,7 +64,7 @@ for location in "${LOCATIONS[@]}"; do
echo "-----------------------------------------"

# Test 1: Weekly NHSN (hospital admissions)
echo " [1/2] Running weekly NHSN forecast..."
echo " [1/4] Running weekly NHSN forecast..."
bash pipelines/tests/test_epiautogp_fit.sh \
"$BASE_DIR" \
"$disease" \
Expand All @@ -81,7 +81,7 @@ for location in "${LOCATIONS[@]}"; do
fi

# Test 2: Weekly NSSP percentage (ED visits as percentage)
echo " [2/2] Running weekly NSSP percentage forecast..."
echo " [2/4] Running weekly NSSP percentage forecast..."
bash pipelines/tests/test_epiautogp_fit.sh \
"$BASE_DIR" \
"$disease" \
Expand All @@ -97,6 +97,41 @@ for location in "${LOCATIONS[@]}"; do
echo " ✓ Weekly NSSP percentage forecast complete"
fi

# Test 3: Daily NSSP counts (ED visit counts, not percentages)
echo " [3/4] Running daily NSSP count forecast..."
bash pipelines/tests/test_epiautogp_fit.sh \
"$BASE_DIR" \
"$disease" \
"$location" \
"nssp" \
"daily" \
"false"

if [ "$?" -ne 0 ]; then
echo "TEST-MODE FAIL: NSSP daily count forecast failed for $disease, $location"
exit 1
else
echo " ✓ Daily NSSP count forecast complete"
fi

# Test 4: Daily NSSP other ED visits (non-target background)
echo " [4/4] Running daily NSSP other ED visits forecast..."
bash pipelines/tests/test_epiautogp_fit.sh \
"$BASE_DIR" \
"$disease" \
"$location" \
"nssp" \
"daily" \
"false" \
"other"

if [ "$?" -ne 0 ]; then
echo "TEST-MODE FAIL: NSSP daily other ED visits forecast failed for $disease, $location"
exit 1
else
echo " ✓ Daily NSSP other ED visits forecast complete"
fi

echo "✓ All forecasts complete for $disease, $location"
done
done
Expand All @@ -106,8 +141,8 @@ echo "========================================="
echo "Step 3: Verifying outputs"
echo "========================================="

# Count expected outputs (2 targets × number of locations × number of diseases)
EXPECTED_MODELS=$((2 * ${#LOCATIONS[@]} * ${#DISEASES[@]}))
# Count expected outputs (4 targets × number of locations × number of diseases)
EXPECTED_MODELS=$((4 * ${#LOCATIONS[@]} * ${#DISEASES[@]}))
ACTUAL_MODELS=$(find "$BASE_DIR/${FORECAST_DATE}_forecasts" -type d -name "epiautogp_*" | wc -l)

echo "Expected models: $EXPECTED_MODELS"
Expand Down
15 changes: 11 additions & 4 deletions pipelines/tests/test_epiautogp_fit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
# Called by test_epiautogp_end_to_end.sh
#
# Usage:
# bash test_epiautogp_fit.sh <base_dir> <disease> <location> <target> <frequency> <use_percentage>
# bash test_epiautogp_fit.sh <base_dir> <disease> <location> <target> <frequency> <use_percentage> [ed_visit_type]

if [[ $# -ne 6 ]]; then
echo "Usage: $0 <base_dir> <disease> <location> <target> <frequency> <use_percentage>"
if [[ $# -lt 6 || $# -gt 7 ]]; then
echo "Usage: $0 <base_dir> <disease> <location> <target> <frequency> <use_percentage> [ed_visit_type]"
echo " target: nhsn or nssp"
echo " frequency: daily or epiweekly"
echo " use_percentage: true or false"
echo " ed_visit_type: observed or other (optional, default: observed)"
exit 1
fi

Expand All @@ -20,6 +21,7 @@ location="$3"
target="$4"
frequency="$5"
use_percentage="$6"
ed_visit_type="${7:-observed}" # Default to "observed" if not provided

# Build command arguments
cmd_args=(
Expand All @@ -34,7 +36,7 @@ cmd_args=(
--frequency "$frequency"
--eval-data-path "$BASE_DIR/private_data/nssp-etl"
--nhsn-data-path "$BASE_DIR/private_data/nhsn_test_data/${disease}_${location}.parquet"
--n-forecast-weeks 4
--n-forecast-days 28
--n-particles 2
--n-mcmc 2
--n-hmc 2
Expand All @@ -47,6 +49,11 @@ if [ "$use_percentage" = "true" ]; then
cmd_args+=(--use-percentage)
fi

# Add ed-visit-type if not default
if [ "$ed_visit_type" != "observed" ]; then
cmd_args+=(--ed-visit-type "$ed_visit_type")
fi

uv run python pipelines/epiautogp/forecast_epiautogp.py "${cmd_args[@]}"

if [ "$?" -ne 0 ]; then
Expand Down
Loading