-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
At the moment,
pyrenew-hew/hewr/R/process_loc_forecast.R
Lines 355 to 375 in 115c9ef
| #' Detect model type from model name | |
| #' | |
| #' Internal helper function to infer model type from naming conventions | |
| #' | |
| #' @param model_name Character string with model name | |
| #' @return Character string with model type ("pyrenew", "timeseries", etc.) | |
| #' @keywords internal | |
| detect_model_type <- function(model_name) { | |
| if ( | |
| grepl("^ts_", model_name) || | |
| grepl("timeseries", model_name, ignore.case = TRUE) | |
| ) { | |
| return("timeseries") | |
| } else if (grepl("epiautogp", model_name, ignore.case = TRUE)) { | |
| return("epiautogp") | |
| } else { | |
| # Default to pyrenew for backward compatibility | |
| return("pyrenew") | |
| } | |
| } | |
is a pretty weak pattern since the point of introducing an S3 generic to handle model specific post-processing was to avoid needing to add new parameters to all the required post-processing functions for any new model.
I think we should move to passing the model_type to dispatch on, assuming that we need a model_name which is distinct e.g. model_name = pyrenew_he with model_type = pyrenew.
This is connected to #789 since it is effectively a code organisation decision.
Metadata
Metadata
Assignees
Labels
No labels