Conversation
…ime pipeline of simulants for waning effect
| @@ -1,21 +1,21 @@ | |||
| input_draw_count: 25 | |||
| random_seed_count: 100 | |||
There was a problem hiding this comment.
Don't merge any changes to this file
| WANING_EFFECT_SHORT_STATE: str = "waning_effect_short" | ||
| NO_EFFECT_AFTER_SHORT_STATE: str = "no_effect_after_short" | ||
| NO_EFFECT_AFTER_LONG_STATE: str = "no_effect_after_long" | ||
| TREATMENT_EFFECT: str = "treatment_effect" |
There was a problem hiding this comment.
Make sure to clarify these state name changes to Nathaniel b/c he'll need to update the notebook
| configuration: | ||
| input_data: | ||
| input_draw_number: 0 | ||
| artifact_path: '/mnt/team/simulation_science/pub/models/vivarium_csu_alzheimers/artifacts/model8.3/united_states_of_america.hdf' |
There was a problem hiding this comment.
Same here, probably best not to merge this change
|
|
||
| Parameters | ||
| ---------- | ||
| step_size : int |
There was a problem hiding this comment.
I know AI did this, but don't add the type hints in the docstring (both under Parameters and under Returns). That's not DRY since we already type hint both in the signature.
| "treatment_effect.dwell_time", | ||
| modifier=self.get_treatment_effect_duration, | ||
| component=self, | ||
| required_resources=[COLUMNS.TREATMENT_DURATION, "treatment_effect.dwell_time"], |
There was a problem hiding this comment.
Do you really need to add the very pipeline that you're modifying as a required resource? That seems silly and easy to fix
There was a problem hiding this comment.
I guess I am not sure but it seems like I would want it.
| self.population_view.subview(COLUMNS.TREATMENT_DURATION).get(index).squeeze() | ||
| ) | ||
| # Treatment length is in months, target is dwell time in days (float) | ||
| effect_duration = (treatment_length / 9.0) * target |
There was a problem hiding this comment.
The "9.0" should be added as a constant to date_values.py, e.g. FULL_TREATMENT_DURATION
| effect_duration = (effect_duration / self.step_size).round() * self.step_size | ||
| return effect_duration | ||
|
|
||
| def get_waning_effect_duration( |
There was a problem hiding this comment.
This is actually identical to the one above it. Delete this and rename the other one something like modify_dwell_time and then use that for both pipeline modifiers
| full_effect_states = [ | ||
| TREATMENT_DISEASE_MODEL.FULL_EFFECT_LONG_STATE, | ||
| TREATMENT_DISEASE_MODEL.FULL_EFFECT_SHORT_STATE, | ||
| # TODO: update to combine states, check artifact |
|
|
||
| # Dwell times are number of days in waning effect | ||
| dwell_times = self.waning_dwell_time_pipeline(waning_mask[waning_mask].index) | ||
| dwell_times = dwell_times / (self.step_size() / pd.Timedelta(days=1)) |
There was a problem hiding this comment.
This is confusing. Would this work?
dwell_times = dwell_times / pd.Timedelta(days=self.step_size())
There was a problem hiding this comment.
No, doing the division is getting rid of the Timedelta units so it is then just 182 since dwell time is a series of floats for number of days.
| return pop.squeeze(axis=1).dt.date.apply(semesterize) | ||
|
|
||
| def map_treatment_durations(self, pop: pd.DataFrame) -> pd.Series: | ||
| durations = pop.fillna(0.0) |
There was a problem hiding this comment.
If you just set everyone who didn't get treated to have a treatment duration of 0 instead of np.nan, you wouldn't need any mapping at all.
There was a problem hiding this comment.
The idea is that in the interactive sim it might be confusing if someone has 0 months of treatment duration but they have never tested positive or ultimately had the chance to be treated. Maybe you wouldn't find that confusing? I do not feel strongly.
Albrja/mic 6764/treatment update
Update treatment model
Changes and notes
-updates Treatment disease model to only have 1 state for each treatment effect and waning
-update treatment ramp up to be time specific and not time and location specific
-update how "short" treatment is sampled
-add observer for treatment duration
Verification and Testing
-validated component updates and observer in interactive simulation