Faxed lab reports read page by page into DrChrono
Reads every page of a faxed lab report with Textract, records each value on the right DrChrono chart, gives the ordering doctor a review task and sends lab-flagged values to Slack.
The prompt
When a lab report comes in on our Documo fax line, read every page with AWS Textract, table by table: each test, its result, units, the lab's reference range and the lab's flag, plus the patient's name and birth date, the ordering provider, the lab and the collection date. Copy the values exactly as printed and never decide what a value means. If the lab flagged any value, post it to our lab alerts channel in Slack right away. Look the patient up in DrChrono by name and birth date. With exactly one match, record the result on that chart with every value, then give the ordering doctor a review task that lists the flagged values, any value outside the lab's printed range with no flag, and any cell Textract wasn't sure of, so they can check it against the page. If there are two matches, only a close match, or no match, ask our intake coordinator in Slack which chart it belongs to and wait. Never create a patient from a lab result. If the fax isn't a lab result or can't be read, tell intake in Slack.
FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.
The flow
Inside the loop: Wait for Textract to finish
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
- New lab fax Starts when Documo finishes receiving a fax on your lab results line, with the PDF already saved. A fax that arrives with no readable PDF goes to intake in Slack with Documo's reason.
- Start reading every page The fax is stored in your S3 bucket so Textract can read every page, for the result tables and for the patient's name and birth date, the ordering provider, the lab, the accession number and the dates. The flow checks back every 10 seconds for up to 15 minutes. A fax Textract cannot read, or does not finish in that time, goes to intake in Slack with the reason.
- Line up the results An AI step lines up each row as test, result, units, range and the lab's flag, copied as printed, and never adds a flag or says what a value means. Check every value then matches each value back to the cells Textract read and lists the cells it was unsure of. A fax that is not a lab result goes to intake.
- Tell the doctors now Any value the lab flagged goes to Slack at once, with the patient's name and birth date, the test, the value, the lab's range and flag, and a link to the fax.
- Find the patient in DrChrono Searches DrChrono by name and birth date, then by birth date alone and by last name. Only a single chart with the same first name, last name and birth date counts as a match.
- Ask the intake coordinator Two matching charts, a close match or no match goes to the intake coordinator in Slack with the name and birth date on the report and a link to each chart that looks close. No patient is ever created from a result.
- Wait for the coordinator's answer The run waits for the click. Picking a chart records the result there. Not in DrChrono leaves the report with the coordinator.
- Record the result in DrChrono Record Lab Result files the faxed PDF as the result document and adds each value with its units, range and the lab's flag. Review task for the ordering doctor then lists the flagged values, values outside the lab's printed range and the cells to check against the page. A value that could not be matched to the page is left off the record and listed on the task instead. When the report's doctor or lab has no DrChrono ID and no default is set, nothing is recorded and the coordinator gets the report 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 Documo API key, and an AWS access key and secret for Textract and for S3 with the same region in both. The key needs permission to write to your bucket and to run Textract on it.
- Enter the client ID and client secret of your DrChrono API application and connect your DrChrono and Slack accounts. Record Lab Result and List Sublabs need DrChrono's Lab Vendor permission on your API application: request it from [email protected], then turn on Lab Vendor Access in the DrChrono settings and reconnect.
- Add your Anthropic key in the flow setting Anthropic key. Set S3 bucket to a bucket in the same AWS region as Textract, and Confidence floor to the Textract confidence, from 0 to 100, below which a cell goes on the check list. It starts at 90.
- Fill the flow setting Ordering doctors with each ordering provider's last name as printed on reports, their DrChrono doctor ID and the DrChrono user who gets the review task, plus a default. Set Default sublab to the DrChrono lab to use when the lab on a report is not one of yours, or leave it at 0 if you have only one.
- Copy the URL of the block Wait for the coordinator's answer into the flow setting Answer link. The Slack buttons open it.
- Pick the task status in Review task for the ordering doctor, the channel your ordering doctors and on-call clinician watch in Tell the doctors now, and the intake coordinator's channel in Ask the intake coordinator, Tell intake the fax has no PDF, Tell intake it was not read, Send other faxes to intake and Tell the coordinator it was not recorded. Pick your lab results fax number in New lab fax if the account has more than one.