Open annakrystalli opened 5 months ago
If not it creates a problem down the line when hubData::expand_model_out_val_grid() is run with required_vals_only = TRUE.
hubData::expand_model_out_val_grid()
required_vals_only = TRUE
e.g. with the following example config:
{ "schema_version": "https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v2.0.0/tasks-schema.json", "rounds": [ { "round_id_from_variable": true, "round_id": "origin_date", "model_tasks": [ { "task_ids": { "origin_date": { "required": null, "optional": [ "2023-11-12", "2023-11-19", "2023-11-26" ] }, "target": { "required": null, "optional": ["inc hosp"] }, "horizon": { "required": [1, 2], "optional": [0] }, "location": { "required": null, "optional": [ "US", "01", "02" ] }, "age_group":{ "required":["0-130"], "optional":["0-0.99","1-4","5-17","5-64","18-49","50-64","65-130"] } }, "output_type": { "quantile":{ "output_type_id":{ "required": [ 0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.975, 0.99 ], "optional":null }, "value":{ "type":"double", "minimum":0 } } }, "target_metadata": [ { "target_id": "inc hosp", "target_name": "Weekly incident RSV hospitalizations", "target_units": "count", "target_keys": { "target": ["inc hosp"] }, "target_type": "continuous", "is_step_ahead": true, "time_unit": "week" } ] }, { "task_ids": { "origin_date": { "required": null, "optional": [ "2023-11-12", "2023-11-19", "2023-11-26" ] }, "target": { "required": ["peak time hosp"], "optional": null }, "horizon": { "required": null, "optional": null }, "location": { "required": null, "optional": [ "US", "01", "02" ] }, "age_group":{ "required":["0-130"], "optional":["0-0.99","1-4","5-17","5-64","18-49","50-64","65-130"] } }, "output_type": { "cdf":{ "output_type_id":{ "required":null, "optional":[1] }, "value":{ "type":"double", "minimum":0, "maximum":1 } } }, "target_metadata": [ { "target_id": "peak time hosp", "target_name": "Peak timing of hospitalization", "target_units": "population", "target_keys": { "target": ["peak time hosp"] }, "target_type": "discrete", "is_step_ahead": true, "time_unit": "week" } ] } ], "submissions_due": { "relative_to": "origin_date", "start": -6, "end": 100 } } ] }
The following error is returned:
Error in `purrr::map()` at hubData/R/expand_model_out_val_grid.R:199:5: ℹ In index: 2. Caused by error in `value[[jvseq[[jjj]]]]`: ! subscript out of bounds Run `rlang::last_trace()` to see where the error occurred.
from:
hubData::expand_model_out_val_grid( config_tasks, round_id = "2023-11-26", required_vals_only = TRUE )
because the second modeling task has a required target but no required output type:
Perhaps we should also handle this exception somehow in the hubData::expand_model_out_val_grid()?
If not it creates a problem down the line when
hubData::expand_model_out_val_grid()
is run withrequired_vals_only = TRUE
.e.g. with the following example config:
The following error is returned:
from:
because the second modeling task has a required target but no required output type: