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

BREAKING CHANGE: InjectionDynamics #1296

Conversation

dbirman
Copy link
Member

@dbirman dbirman commented Mar 3, 2025

This PR introduces a new concept to the Injection class. InjectionDynamics wrap the volume, rate, and duration together into a single class that is shared across all injections. The dynamics comes in because the field Injection.dynamics accepts a List[InjectionDynamics], allowing people to describe in as much detail as they want the pattern of an injection -- if it's important. All existing injections can probably be ported simply as bolus injections.

In addition I added a concept InjectionProfile which provides an english-language description of the type of injection. I gave it three options bolus/continuous/pulsed for different types of injection I've seen. There are probably more. A validator prevents users from putting multiple injection events in while describing it as a bolus injection.

I also fixed several tests that turned out to not be working at all.

@dbirman dbirman marked this pull request as ready for review March 5, 2025 06:22
@dbirman dbirman requested a review from saskiad March 5, 2025 06:22
injection_eye: Side = Field(..., title="Injection eye")


class IntraperitonealInjection(Injection):
"""Description of an intraperitoneal injection procedure"""

time: Optional[AwareDatetimeWithDefault] = Field(default=None, title="Injection time")
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't remove the time here - it's not a duration field, it's the time when the injection is done. This is for the NBA project where they do timed injections prior to blood collection.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added back

injection_duration: Optional[Decimal] = Field(default=None, title="Injection duration")
injection_duration_unit: Optional[TimeUnit] = Field(default=None, title="Injection duration unit")
dynamics: List[InjectionDynamics] = Field(
..., title="Injection dynamics", description="List of injection events, pattern should match the profile"
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe indicate one per injection depth or location?

Copy link
Member Author

Choose a reason for hiding this comment

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

added to description

Copy link
Collaborator

@saskiad saskiad left a comment

Choose a reason for hiding this comment

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

a few small things

@dbirman dbirman requested a review from saskiad March 5, 2025 22:48
@dbirman dbirman merged commit eae6cf4 into release-v2.0.0 Mar 7, 2025
6 checks passed
@dbirman dbirman deleted the 1235-20-injections-replace-volumetimeconcentration-with-injectiondynamics-2 branch March 7, 2025 23:04
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