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 the volumeToDispense(set when the infusion was created) of the infusion, then the status of the infusion should be updated to terminated via the PUT /infusion endpoint. To update an infusion status to terminated, you must provide the timeSpent and actualVolumeDispensed values along with the status update. The actualVolumeDispensed is the volumeDispensed recorded by the device while the timeSpent 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) the volumeToDispense(set when the infusion was created) of the infusion, then the status of the infusion should be updated to ended via the PUT /infusion endpoint. To update an infusion status to ended, you must provide the timeSpent 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.