Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/infusion now #1131

Merged
merged 9 commits into from
Nov 30, 2023
Merged

Fix/infusion now #1131

merged 9 commits into from
Nov 30, 2023

Conversation

kylebaron
Copy link
Collaborator

@kylebaron kylebaron commented Nov 18, 2023

Summary

Users are allowed to trigger discontinuities in the simulation (e.g. doses) from within the model. This is done through an evdata object which can be scheduled at some time in the future or the user can ask for it to happen now.

There was a bug in this when an infusion was given by this now mechanism: there was no code to turn the infusion off.

As I was addressing this issue, I realized that there are some other expected behaviors for these doses that weren't getting implemented when these now doses were triggered.

Details

Workflow

  • I was testing github actions and got a workflow file committed; intent is to remove that where ever it shows up

test-cpp.R

  • Unit tests for events triggered from within the model

devtran.cpp

  • This is where most of the action is
  • prob.rate_main() can be called regardless of whether the record just came from the data or not; whenever the rate attribute is non-negative, this call will do nothing; added logic in rate_main() to make this clear
  • Added some logic to do nothing with the modeled event when evid is 0; this is an observation
  • After creating the event (new_ev) we have to process it like other event records; get and check the bioavailability, call rate_main(), etc
  • Added logic to turn off an infusion

odeproblem.cpp

  • Added code to return early if rate is not negative

@kylebaron kylebaron marked this pull request as draft November 18, 2023 06:15
@kylebaron kylebaron marked this pull request as ready for review November 28, 2023 02:22
Copy link
Contributor

@kyleam kyleam left a comment

Choose a reason for hiding this comment

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

Thanks for the summary and details. Some of devtran.cpp changes are a bit beyond my grasp but overall look good to me.

I confirmed that make test-cpp passes on this PR and fails as expected when I revert the code changes.

@kylebaron kylebaron merged commit c45f289 into refactor/fbio Nov 30, 2023
@kylebaron kylebaron deleted the fix/infusion-now branch November 30, 2023 03:17
@kylebaron kylebaron mentioned this pull request Dec 2, 2023
@kylebaron kylebaron linked an issue Dec 8, 2023 that may be closed by this pull request
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.

Infusion from inside model scheduled for "now" doesn't turn off
2 participants