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
volumeDispensedrecorded 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 toterminatedvia thePUT /infusionendpoint. To update an infusion status toterminated, you must provide thetimeSpentandactualVolumeDispensedvalues along with the status update. TheactualVolumeDispensedis thevolumeDispensedrecorded by the device while thetimeSpentis the duration of the infusion in milliseconds. -
Ended: If an infusion stops when the
volumeDispensedrecorded 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 toendedvia thePUT /infusionendpoint. To update an infusion status toended, you must provide thetimeSpentvalue 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.