Skip to content

fix to the HHD intervention in the event log#188

Merged
morganle-48 merged 5 commits into
mainfrom
hhd_intervention_logging
Apr 28, 2026
Merged

fix to the HHD intervention in the event log#188
morganle-48 merged 5 commits into
mainfrom
hhd_intervention_logging

Conversation

@morganle-48
Copy link
Copy Markdown
Collaborator

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.

@morganle-48 morganle-48 requested a review from yiwen-h as a code owner April 22, 2026 15:40
@morganle-48
Copy link
Copy Markdown
Collaborator Author

Fixes #187

@yiwen-h
Copy link
Copy Markdown
Member

yiwen-h commented Apr 22, 2026

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
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 83.82353% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.81%. Comparing base (a014dd8) to head (cf56453).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
renal_capacity_model/model.py 89.28% 6 Missing ⚠️
renal_capacity_model/helpers.py 50.00% 4 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@morganle-48
Copy link
Copy Markdown
Collaborator Author

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

@morganle-48
Copy link
Copy Markdown
Collaborator Author

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.

Copy link
Copy Markdown
Member

@yiwen-h yiwen-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@morganle-48 morganle-48 merged commit ac0380d into main Apr 28, 2026
6 checks passed
@morganle-48 morganle-48 deleted the hhd_intervention_logging branch April 28, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants