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 use_percentage flag to EpiAutoGPInput and output logic
Introduces a use_percentage boolean field to EpiAutoGPInput to distinguish between raw counts and percentage-based input for ED visits. Updates output logic to set the variable name and convert values to proportions when use_percentage is true for nssp targets. Test cases and input construction are updated accordingly.
  • Loading branch information
SamuelBrand1 committed Dec 12, 2025
commit 4401bef94ae7776ba92fcc403b07ce1eae61ed86
1 change: 1 addition & 0 deletions EpiAutoGP/src/input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct EpiAutoGPInput
pathogen::String
location::String
target::String
use_percentage::Bool
forecast_date::Date
nowcast_dates::Vector{Date}
nowcast_reports::Vector{Vector{Real}}
Expand Down
13 changes: 11 additions & 2 deletions EpiAutoGP/src/output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,20 @@ function create_forecast_output(
# Create basic forecast DataFrame with date, .draw, .value
forecast_df = create_forecast_df(results, output_type)

# Determine variable name based on target
# Determine variable name based on target and whether using percentages
variable_name = if input.target == "nhsn"
"observed_hospital_admissions"
else # nssp
"observed_ed_visits"
if input.use_percentage
"prop_disease_ed_visits"
else
"observed_ed_visits"
end
end

# Convert percentage to proportion if needed (R expects proportions for prop_ variables)
if input.use_percentage && input.target == "nssp"
forecast_df[!, Symbol(".value")] = forecast_df[!, Symbol(".value")] ./ 100.0
end

# Add .variable and resolution columns
Expand Down
19 changes: 10 additions & 9 deletions EpiAutoGP/test/test_input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function create_sample_input(output_path::String; n_weeks::Int = 30,
for _ in 1:10] # 10 realizations, each with 3 values

input_data = EpiAutoGPInput(
dates, reports, pathogen, location, "nhsn",
dates, reports, pathogen, location, "nhsn", false,
forecast_date, nowcast_dates, nowcast_reports
)

Expand All @@ -31,7 +31,7 @@ end
nowcast_reports = [[50.0, 36.0], [52.0, 38.0]]

input_data = EpiAutoGPInput(
dates, reports, "COVID-19", "CA", "nhsn",
dates, reports, "COVID-19", "CA", "nhsn", false,
Date("2024-01-03"), dates[2:3], nowcast_reports
)

Expand All @@ -50,7 +50,7 @@ end
valid_data = EpiAutoGPInput(
[Date("2024-01-01"), Date("2024-01-02")],
[45.0, 52.0],
"COVID-19", "CA", "nhsn",
"COVID-19", "CA", "nhsn", false,
Date("2024-01-02"),
[Date("2024-01-02")],
[[50.0], [52.0]]
Expand All @@ -59,7 +59,7 @@ end

# Test without nowcasts
no_nowcast = EpiAutoGPInput(
[Date("2024-01-01")], [10.0], "COVID-19", "TX", "nhsn",
[Date("2024-01-01")], [10.0], "COVID-19", "TX", "nhsn", false,
Date("2024-01-01"), Date[], Vector{Real}[]
)
@test validate_input(no_nowcast) == true
Expand All @@ -69,29 +69,29 @@ end
# Mismatched lengths
@test_throws ArgumentError validate_input(EpiAutoGPInput(
[Date("2024-01-01"), Date("2024-01-02")], [45.0],
"COVID-19", "CA", "nhsn", Date("2024-01-01"), Date[], Vector{Real}[]
"COVID-19", "CA", "nhsn", false, Date("2024-01-01"), Date[], Vector{Real}[]
))

# Empty data
@test_throws ArgumentError validate_input(EpiAutoGPInput(
Date[], Real[], "COVID-19", "CA", "nhsn", Date("2024-01-01"), Date[], Vector{Real}[]
Date[], Real[], "COVID-19", "CA", "nhsn", false, Date("2024-01-01"), Date[], Vector{Real}[]
))

# Unsorted dates
@test_throws ArgumentError validate_input(EpiAutoGPInput(
[Date("2024-01-02"), Date("2024-01-01")], [45.0, 52.0],
"COVID-19", "CA", "nhsn", Date("2024-01-02"), Date[], Vector{Real}[]
"COVID-19", "CA", "nhsn", false, Date("2024-01-02"), Date[], Vector{Real}[]
))

# Invalid nowcast structure
@test_throws ArgumentError validate_input(EpiAutoGPInput(
[Date("2024-01-01")], [45.0], "COVID-19", "CA", "nhsn", Date("2024-01-01"),
[Date("2024-01-01")], [45.0], "COVID-19", "CA", "nhsn", false, Date("2024-01-01"),
[Date("2024-01-01")], [[50.0, 55.0]] # Wrong length
))

# Negative values
@test_throws ArgumentError validate_input(EpiAutoGPInput(
[Date("2024-01-01")], [-5.0], "COVID-19", "CA", "nhsn", Date("2024-01-01"), Date[], Vector{Real}[]
[Date("2024-01-01")], [-5.0], "COVID-19", "CA", "nhsn", false, Date("2024-01-01"), Date[], Vector{Real}[]
))
end

Expand All @@ -104,6 +104,7 @@ end
"pathogen" => "COVID-19",
"location" => "CA",
"target" => "nhsn",
"use_percentage" => false,
"forecast_date" => "2024-01-02",
"nowcast_dates" => ["2024-01-02"],
"nowcast_reports" => [[50.0], [55.0]]
Expand Down
2 changes: 1 addition & 1 deletion EpiAutoGP/test/test_modelling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
end

return EpiAutoGPInput(
dates, reports, "COVID-19", "US", "nhsn",
dates, reports, "COVID-19", "US", "nhsn", false,
dates[end], nowcast_dates, nowcast_reports
)
end
Expand Down
1 change: 1 addition & 0 deletions EpiAutoGP/test/test_output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ end
"COVID-19",
"CA",
"nhsn",
false,
Date("2024-01-01"),
Date[],
Vector{Real}[]
Expand Down