FlowRunner
Features Pricing
Theme
Start Free

Hospital discharge medication lists confirmed into CareTend

Reads each multi-page discharge medication list faxed to SRFax with Textract, matches the CareTend patient, and adds only the medications the admitting clinician confirms in Slack.

The prompt

When a fax comes in on our SRFax line, read every page with AWS Textract. If it's a hospital discharge medication list for a home health or infusion admission, copy each medication exactly as printed: the drug, strength, dose, route, frequency and directions, and whether the list says to continue it, start it, change it or stop it. Also copy the patient's name and date of birth, the hospital, the discharge date and the attending physician. Find the patient in CareTend by name and date of birth. With exactly one match, use that patient. With two matches, a close match or none, ask our intake coordinator in Slack which patient it is, showing each one's MRN, and wait. Never create a patient. File the fax on the patient in CareTend, then send the medications as a Slack direct message to the admitting clinician named in the flow settings, to check against the fax. If nobody is named or we can't find them in Slack, post the list in our clinical team's channel with no buttons and create a CareTend task to enter the medications by hand. Show the ones the list says to stop for information only, and never add those. Let the clinician add all, add just one, add none, or say they'll enter them in CareTend, and add only the medications they confirm to the patient's medication profile, with the printed directions in the comments. If the fax can't be read or came with no file, the AI step fails, or CareTend refuses a step, tell our intake team in Slack.

FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.

The flow

Yes No No Yes No Yes Yes Yes Yes No Yes No No Repeats for each item Wait for Textract tofinish Repeats for each item Add each confirmedmedication Condition Fax PDF saved? Starts the flow New fax onSRFax Action Not read yet Action Start readingevery page AI agent Read the medicationlist Code Gather what Textractread Condition Discharge medicationlist? If a step fails Textract could notstart Condition Read every page? Action Tell intake: fax notread Condition Any to add? Action Tell intake: notfiled Action Search by last nameand birth date Condition Patient picked? Code Write the card for theclinician If a step fails CareTend or SRFaxrefused Action Get a fresh copyof the fax Asks a person Wait for thecoordinator's answer Action Search by namewithout birth date Code Check the match Code Write the question forthe coordinator Asks a person Wait for theclinician's answer Action File the list on thepatient Code Settle on the patient Action Search by firstname and birth date Code Pick the confirmedmedications Condition One clear match? Action Find the patient inCareTend Asks a person Ask the intakecoordinator Action Find the admittingclinician in Slack If a step fails AI step failed Action Task: enter themedications by hand Action Tell intake: listnot read If a step fails Clinician not found Asks a person Ask the admittingclinician Condition Clinician in Slack? Action Tell the clinicalteam Condition Could it be read?

Inside the loop: Wait for Textract to finish

No Action Give Textract amoment Action Keep what Textractread Action Done reading Condition Still reading? Action Check the reading If a step fails Textract returned anerror Action Stop reading Action Keep the error

Inside the loop: Add each confirmed medication

Action Add it to themedication profile If a step fails CareTend refused themedication Action Tell the clinician:not added

Download the file, then in FlowRunner click + beside Flows, pick it under Import a Flow Version and click Create. How importing works

What each step does

  1. New fax on SRFax Checks your SRFax inbox every 5 minutes and starts once for each new fax, with its PDF saved. A fax that arrives with no PDF goes to intake in Slack.
  2. Start reading every page Textract's Start Document Analysis takes the fax by its file URL and reads every page for its tables and for the patient's name and birth date, the hospital, the discharge date, the attending physician and the discharge destination. The flow checks back every 10 seconds for up to 15 minutes, and a fax Textract cannot read, returns an error on or reads almost no text from goes to intake.
  3. Read the medication list An AI step lists each medication as drug, strength, dose, route, frequency and directions, with continue, new, changed or stop only where the list prints it. Everything is copied as printed, and a row with a cell Textract was unsure of is marked. A list the AI step finds illegible, or an AI step that fails, goes to intake, and any other kind of document ends the run.
  4. Ask the intake coordinator The patient is matched in CareTend on first name, last name and birth date. Two matching patients, a close match or none goes to the intake coordinator in Slack with each patient who may be the one, their birth date and MRN, a button for each, and one to handle it by hand.
  5. Wait for the coordinator's answer The run waits for the click. A picked patient goes on. Handle it by hand ends the run. No patient is ever created from a discharge list.
  6. File the list on the patient Takes a fresh copy of the fax from SRFax and uploads it to the patient in CareTend as a patient document, with a note on the hospital, the discharge date and how the patient was matched. If SRFax or CareTend refuses a step, intake gets the reason in Slack and nothing is added.
  7. Ask the admitting clinician The admitting clinician named in your flow settings is found in Slack and gets a direct message with each medication to check against the fax, with its dose, route, frequency, directions and what the list says to do with it, and a note on any row Textract was unsure of. Medications the list says to stop are shown for information and are never added. The buttons add all, add only one, add none, or leave some to be entered in CareTend by hand. If nobody is named or the clinician is not found in Slack, your clinical team's channel gets the list with no buttons, and CareTend gets a task for your department to enter the medications by hand.
  8. Wait for the clinician's answer The run waits for the click. Only the confirmed medications are added with Create Medication Profile, each with the printed dose, route, frequency and directions and a note that the named clinician confirmed it in Slack, with the date, in the comments. A medication CareTend refuses goes back to the clinician in Slack.

Before you turn it on

This flow assumes every service in it, FlowRunner included, has signed a business associate agreement (BAA) with you. Its messages to your staff include the patient details they need to decide.

  • Enter your SRFax account number and password, your CareTend Integration Hub client ID and secret, and an AWS access key, secret and region for Textract with a Staging S3 Bucket in that region, and connect your Slack account. The AWS key needs s3:PutObject and s3:GetObject on the bucket. Add a lifecycle rule that expires objects under flowrunner-textract/, because the staged faxes are not deleted.
  • Add your Anthropic key in the flow setting Anthropic key. Set Admitting clinician to the Slack member ID or email of the clinician who confirms the medications, CareTend department ID to the department that gets the task when nobody is found, CareTend company ID to the company the documents belong to, Therapy type to a value of your CareTend Therapy Type lookup, and Confidence floor to the Textract confidence, from 0 to 100, below which a row is marked for checking. It starts at 90.
  • Copy the URL of the block Wait for the coordinator's answer into the flow setting Answer link, and the URL of Wait for the clinician's answer into Clinician answer link. The Slack buttons open them.
  • Pick the intake coordinator's channel in Ask the intake coordinator, Tell intake: fax not read, Tell intake: list not read and Tell intake: not filed, and your clinical team's channel in Tell the clinical team and Tell the clinician: not added. Enter your discharge fax number in New fax on SRFax if the account has more than one.