FlowRunner
Features Pricing
Theme
Start Free

Faxed pharmacy fill histories checked against the Healthie medication list

Reads each fill history faxed to Phaxio with Textract, matches the Healthie patient on name and birth date, and sends medications not on the chart to the prescriber in Slack to confirm.

The prompt

When a fax comes in on our Phaxio line, read every page with AWS Textract, table by table. If it's a pharmacy fill history, copy each fill exactly as printed: the drug, strength, quantity, days supply, directions, fill date, prescriber and pharmacy, plus the patient's name and date of birth. Never correct a drug name or a number. Find the patient in Healthie by name and date of birth. With exactly one match, file the fax on that chart. With two matches, a close match or none, ask our intake coordinator in Slack which chart it is, with a button for each chart and one to handle it by hand, and wait. Never create a patient from a fill history. Compare the fills with the patient's Healthie medication list, and send the medications that aren't on it to the patient's provider as a Slack direct message. Show each one with its directions, quantity, last fill, prescriber and pharmacy, and let them add all, add just one, add none, or say they'll do it in Healthie. Only add the medications the provider confirms. If we can't find the provider in Slack, post the list in our clinical team's channel with no buttons and create a Healthie task to review it by hand. If the fax can't be read or came with no file, an AI step fails, or Healthie refuses a step, tell our intake coordinator 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 Yes No No Yes Yes Yes Yes Yes No No Repeats for each item Wait for Textract tofinish Repeats for each item Add each confirmedmedication Code Gather what Textractread Action Not read yet Action Tell intake: fax notread Condition Read every page? AI agent Read the fill history If a step fails Textract could notstart Starts the flow New fax onPhaxio Action Start readingevery page Condition Fax PDF saved? Condition Fill history? Condition One clear match? Code Write the question forthe coordinator Action Get the Healthiemedication list Action Find the patient inHealthie Action File the fill historyon the chart If a step fails Healthie or Phaxiorefused Asks a person Wait for thecoordinator's answer Action Search by last nameand birth date Condition Chart picked? AI agent Compare with thechart Action Search by namewithout birth date Code Check the match Code Settle on the chart Condition Anything new for thechart? Asks a person Ask the intakecoordinator Action Tell the coordinator:not filed Action Search by firstname and birth date Asks a person Wait for theprescriber's answer Action Find the prescriberin Slack Condition Any to add? Asks a person Ask theprescriber If a step fails Prescriber not found Action Get the patient'sprescriber Code Pick the confirmedmedications Condition Prescriber in Slack? Code Write the card for theprescriber Action Tell the clinicalteam Action Get a fresh copyof the fax Action Task: review thelist by hand Action Tell the coordinator:not compared Condition Could it be read? If a step fails AI step failed

Inside the loop: Wait for Textract to finish

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

Inside the loop: Add each confirmed medication

Action Tell the coordinator:not added If a step fails Healthie refused themedication Action Add the medicationin Healthie

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 Phaxio Checks your Phaxio line 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 with the reason.
  2. Start reading every page Textract reads every page of the fax for its tables and for the patient's name and birth date, the pharmacy and the date range. The flow checks back every 10 seconds for up to 15 minutes. An AI step then lines up each fill as drug, strength, quantity, days supply, directions, fill date, prescriber and pharmacy, copied as printed, and marks any row with a cell Textract was unsure of. A fax Textract returns an error on, reads almost no text from, or that the AI step finds illegible goes to intake with the reason, and any other kind of document ends the run.
  3. Ask the intake coordinator The patient is matched in Healthie on first name, last name and birth date. Two matching charts, a close match or none goes to the intake coordinator in Slack with a link to each chart that may be the patient and why, a button for each, and one to handle it by hand.
  4. Wait for the coordinator's answer The run waits for the click. A picked chart goes on. Handle it by hand ends the run. No patient is ever created from a fill history.
  5. Compare with the chart A fresh copy of the fax is filed on the chart. An AI step compares each fill with the patient's Healthie medication list and lists the medications that are not on it. If every one is already there, the run ends. If Healthie refuses a step, the coordinator gets Healthie's reason in Slack, and if an AI step fails, the coordinator gets the fax with the error.
  6. Ask the prescriber The patient's provider in Healthie is found in Slack by email and gets a direct message with each medication not on the chart: its directions, quantity, days supply, last fill date, prescriber and pharmacy, and a note on any row Textract was unsure of. The buttons add all of them, add only one, add none, or leave some to be added in Healthie by hand. Only the prescriber gets these buttons.
  7. Tell the clinical team When the provider cannot be found in Slack, your clinical team's channel gets the list with no buttons and a note why, and Healthie gets a task on the patient, assigned to the provider, to review the list by hand. Nothing is added to the chart.
  8. Wait for the prescriber's answer The run waits for the click. Only the medications confirmed are added to the chart with Add Medication, each with a comment naming the fill history and the last fill. The flow records the medication history and never writes or changes a prescription. A medication Healthie refuses goes to the coordinator 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 Phaxio API key and secret, your Healthie API key, 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 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 prescriber's answer into Prescriber answer link. The Slack buttons open them.
  • Pick the intake coordinator's channel in Ask the intake coordinator, Tell intake: fax not read, Tell the coordinator: not filed, Tell the coordinator: not compared and Tell the coordinator: not added, and your clinical team's channel in Tell the clinical team.