@@ -5,6 +5,7 @@ use std::{fmt::Debug, path::PathBuf};
55use crate :: infection_importation:: ImportCasesFromFile ;
66use crate :: reports:: ReportParams ;
77use crate :: settings:: SettingProperties ;
8+ use crate :: symptom_status_manager:: { SymptomAgeGroupNames } ;
89
910#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
1011pub enum RateFnType {
@@ -36,14 +37,16 @@ pub struct Params {
3637 pub imported_cases_timeseries : ImportCasesFromFile ,
3738 /// A library of infection rates to assign to infected people.
3839 pub infectiousness_rate_fn : RateFnType ,
40+ /// age thresholds
41+ pub symptom_age_groups : HashMap < SymptomAgeGroupNames , u8 > ,
3942 /// Probability an infected person develops mild illness
4043 pub probability_mild_given_infect : f64 ,
4144 /// Mu parameter for log normal delay distribution from infection to mild illness
4245 pub infect_to_mild_mu : f64 ,
4346 /// Sigma parameter for log normal delay distribution from infection to mild illness
4447 pub infect_to_mild_sigma : f64 ,
4548 /// Probability a person with mild illness develops severe illness
46- pub probability_severe_given_mild : f64 ,
49+ pub probability_severe_given_mild : HashMap < SymptomAgeGroupNames , f64 > ,
4750 /// Mu parameter for log normal delay distribution from mild to severe illness
4851 pub mild_to_severe_mu : f64 ,
4952 /// Sigma parameter for log normal delay distribution from mild to severe illness
@@ -120,10 +123,13 @@ fn validate_inputs(parameters: &Params) -> Result<(), IxaError> {
120123 ) ) ;
121124 }
122125
123- if !( 0.0 ..=1.0 ) . contains ( & parameters. probability_severe_given_mild ) {
124- return Err ( IxaError :: IxaError (
125- "The probability of severe illness given mild illness must be between 0 and 1, inclusive." . to_string ( ) ,
126- ) ) ;
126+ for ( age_group, probability) in & parameters. probability_severe_given_mild {
127+ // we also want to check whether all of the values for age_group from the enum SymptomAgeGroupNames is specified
128+ if !( 0.0 ..=1.0 ) . contains ( probability) {
129+ return Err ( IxaError :: IxaError (
130+ format ! ( "The probability of severe illness given mild illness among {:?} must be between 0 and 1, inclusive." , age_group) . to_string ( )
131+ ) ) ;
132+ }
127133 }
128134
129135 if !( 0.0 ..=1.0 ) . contains ( & parameters. probability_critical_given_severe ) {
@@ -222,6 +228,7 @@ impl Default for Params {
222228 rate : 1.0 ,
223229 duration : 5.0 ,
224230 } ,
231+ symptom_age_groups : HashMap :: new ( ) ,
225232 probability_mild_given_infect : 0.0 ,
226233 infect_to_mild_mu : 0.0 ,
227234 infect_to_mild_sigma : 0.0 ,
0 commit comments