fix to the HHD intervention in the event log#188
Conversation
|
Fixes #187 |
|
I haven't looked at the code yet but wouldn't it be better to stop it ever getting on the event log in the first place? Just a note to myself to investigate this. I think we shouldn't be messing with the event log if at all possible as it's our source of "truth" as to what's going on within the model |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
==========================================
+ Coverage 79.63% 79.81% +0.18%
==========================================
Files 9 9
Lines 815 857 +42
Branches 94 102 +8
==========================================
+ Hits 649 684 +35
- Misses 150 156 +6
- Partials 16 17 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Ideally I'd say yes - I was battling today to do exactly that, but at the moment we log at the point of scheduling the event instead of logging it after it happens so I think that would be a bigger change impacting pretty much everywhere we log. Happy to chat on this though |
|
The change here was to set up a new random number stream for the intervention scenario and a stream specific to arrivals. This made it easier to look for differences in the results as the number of arrivals should be the same across models. It reduces across scenario variation. |
yiwen-h
left a comment
There was a problem hiding this comment.
Thank you - looks good to me! I can see the logic in the separate random number streams and the methodology for tidying the event log makes sense.
Feel like we've learned a lot with the implementation of this HHD intervention functionality, thank you for all your hard work on this
Considerations for tidying in possible future developments. These are just stylistic - everything is working fine as is!
- model.py is now getting very long and it would be good to split this up a little and/or make it more DRY
- We could consider editing the event log when we interrupt the process, instead of cleaning the event log later? I can see the merits of doing it the current way though so this is definitely optional
I now log a new event if we're doing a HHD intervention to replace the bit of the log that would have played out before the interruption.
In the event log processing I then look for duplicate rows in the time_starting_activity_from and remove the first of these as that's the redundant one.