Infusion Workflow - TREP-LABS/realdrip-backend GitHub Wiki
An infusion has three different distinct statuses: active
, ended
, terminated
.
-
Active: When you create an infusion via the endpoint
POST /infusion
, the infusion is automatically set to active. This implies that the infusion treatment is on-going. -
Terminated: If for any reason, an infusion needs to stopped before the
volumeDispensed
recorded by the device associated with the infusion is up to thevolumeToDispense
(set when the infusion was created) of the infusion, then the status of the infusion should be updated toterminated
via thePUT /infusion
endpoint. To update an infusion status toterminated
, you must provide thetimeSpent
andactualVolumeDispensed
values along with the status update. TheactualVolumeDispensed
is thevolumeDispensed
recorded by the device while thetimeSpent
is the duration of the infusion in milliseconds. -
Ended: If an infusion stops when the
volumeDispensed
recorded by the device associated with the infusion is equal(or greater than) thevolumeToDispense
(set when the infusion was created) of the infusion, then the status of the infusion should be updated toended
via thePUT /infusion
endpoint. To update an infusion status toended
, you must provide thetimeSpent
value along with the status update.
NOTE: The status of an infusion only progress forward, i.e, an infusion status can only be updated to terminated
if it's previous state was active
, the same thing applies for updating the status to ended
. You also can't manually update an infusion status to active
.