A8gent
All articles

Industry

Unscheduled Referral Follow-Up: The Lost Appointment

Every clinic has a population of patients who were referred, ordered a test, or were told to come back - and never did. Nothing in the system raises its hand about them, because the absence of an appointment is not an event. Here is how to make it one, and what the standard APIs will and will not tell you.

A8gentAutomation practiceAugust 5, 202613 min read
Contents
  1. The Problem Is a Non-Event
  2. What the Standards Give You - and the Gap in the Middle
  3. Defining the Cohort Without Fooling Yourself
  4. The Outreach, and the HIPAA Line
  5. A Worked Example, With the Arithmetic Shown
  6. The Failure Modes, Ranked by How Much Damage They Do
  7. FAQ

The Problem Is a Non-Event

Almost everything a clinic automates is triggered by something happening. An appointment is booked, so a confirmation goes out. A visit ends, so a survey goes out. A payment fails, so a chase goes out. The trigger is an event, the event has a timestamp, and the automation hangs off it.

The unscheduled referral has no such moment. A physician places an order or writes a referral, the patient leaves with a piece of paper or a portal message, and then nothing happens. Not a failure event, not an error, not a flag. Just an ordinary absence, indistinguishable from a patient who is booked for next month. Three weeks later the order is still open and nobody in the building has thought about it since the day it was written.

This is the same structural problem as lapsed-patient recall, which we cover in the veterinary recall build, and it produces the same organisational blindness: the clinic does not experience the loss, because a patient who never came back does not stand at reception being unhappy. They just quietly get their care somewhere else, or not at all.

So the first design principle is unusual: you are not automating a workflow, you are manufacturing an event. Something must run on a schedule, ask a question nobody asked, and produce a list. Everything downstream - the outreach, the booking, the escalation - is ordinary and easy by comparison. The query is the product.

Sourcing note. The standards and regulatory claims below are quoted from primary sources with URLs inline. Where a source refused our automated requests we say so rather than filling in from memory: HHS.gov returned HTTP 403 to every fetch we attempted, so HIPAA text here is quoted from the Cornell LII mirror of the CFR. None of this is legal advice.

What the Standards Give You - and the Gap in the Middle

This is the section worth reading before you promise anyone a closed-loop referral system, because there is a specific, documented gap that determines the architecture.

The federal certification criterion § 170.315(g)(10), "Standardized API for patient and population services", published on HealthIT.gov, requires certified health IT to support HL7 FHIR Release 4.0.1 with the US Core Implementation Guide STU 6.1.0 as the base (with US Core 7.0.0 and 8.0.1 approved through SVAP), SMART App Launch 2.0.0, OpenID Connect Core 1.0, Bulk Data Access v1.0.0 STU 1, and USCDI Version 3. Certified modules must "Respond to requests for a single patient's data according to adopted standards" and "Respond to requests for multiple patients' data as a group," over TLS 1.2 or higher with OAuth 2.0 for patient, user and system scopes.

Now look at what US Core STU 6.1.0 actually profiles. Its published profiles-and-extensions page lists, among others: AllergyIntolerance, CarePlan, CareTeam, Condition, Coverage, Device, DiagnosticReport, DocumentReference, Encounter, Goal, Immunization, Location, Medication, MedicationDispense, MedicationRequest, Observation, Organization, Patient, Practitioner, PractitionerRole, Procedure, Provenance, QuestionnaireResponse, RelatedPerson, ServiceRequest and Specimen.

Two things are present and two are conspicuously absent.

Present: ServiceRequest - the referral or order itself. And Encounter - the record that a visit occurred. Between them, those two resources are enough to define the entire cohort: an open ServiceRequest with no subsequent matching Encounter.

Absent from that US Core profile list: Appointment, and Task. There is no standardised profile for the booking, and none for the work item. So the standard will let you detect the problem and will not let you resolve it. You can find every patient who was referred and never seen. You cannot, through the same standardised surface, see whether they have an appointment scheduled for next Tuesday, and you certainly cannot book one.

That asymmetry drives the architecture, and it is why so many closed-loop referral products are heavier than they look. The consequences are concrete:

  • Your "never scheduled" cohort will contain patients who are scheduled. Unless you have vendor-specific scheduling access on top of the standard API, you cannot distinguish "never booked" from "booked for the 14th." Messaging the second group is not catastrophic but it is embarrassing and it erodes staff confidence fast.
  • The remedy is a lookahead, not a smarter query. Either get scheduling access from your specific EHR vendor, or accept the imprecision and word the outreach so it survives being wrong - a message that asks rather than asserts costs nothing and cannot be embarrassing.
  • Resolution needs a human or a vendor-specific write path. Plan for a human step from the start rather than treating it as a temporary compromise. See human-in-the-loop.

On the vendor side, Epic publishes its programme openly at fhir.epic.com, describing support for DSTU2, STU3 and R4, a testing sandbox to "Test APIs against example data," client registration, and separate documented processes for app creation and for "Implementing Apps at Epic Customers" - that second step being where project timelines actually go. We attempted to read athenahealth's developer documentation at docs.athenahealth.com/api/ and received HTTP 403, so we assert nothing about its API surface; check it directly.

Defining the Cohort Without Fooling Yourself

Write the query in English before anyone writes it in code, and make every clause defensible.

A starting definition: service requests with a status indicating they are still outstanding, authored more than N days ago, for patients who have no encounter of a matching type since the request date, excluding anything cancelled, revoked, completed, or superseded, and excluding patients flagged deceased, transferred or do-not-contact.

Now the parts that will bite.

N is a clinical decision, not a technical one. A routine screening referral might reasonably sit for six weeks before anyone worries. An urgent one should surface in days. If you use one N for everything, you will simultaneously nag people about routine referrals and be far too slow on urgent ones - the worst of both. Have a clinician set N per order category, in writing, and store it as configuration.

Matching an encounter to a request is genuinely hard. The patient may have been seen for something else entirely. Matching on "any encounter since" will close loops that are still open - a false negative, and the most dangerous error in this whole system, because it removes a patient from the list while telling everyone the system is working. Prefer matching on encounter type, service category or referenced request where the data supports it, and where it does not, fail open: leave the patient on the list and let a human clear them. A list that is slightly too long is a nuisance. A list that is silently too short is a clinical risk dressed up as an efficiency gain.

External completion is invisible. If the referral went to an outside specialist, the encounter happened in a system you cannot see. You will chase patients who have already been seen. There is no clean technical answer to this - the answers are the specialist sending a report back, or the outreach message asking rather than telling. Word it as "have you been able to book this yet?" and the false positive becomes a harmless question instead of a wrong statement.

Suppression before selection, again. Deceased, transferred, in a dispute, already contacted by another automation this week, or flagged by staff. Write these first. It is the same discipline as any outreach automation and it is the step most often skipped under time pressure.

Run the whole thing read-only for at least two weeks, sending the output to a spreadsheet and nowhere else, with a staff member marking every row that should not be there. That period is not a formality - it is where the query gets correct, and the project is effectively won or lost there.

The Outreach, and the HIPAA Line

The compliance question comes up immediately and has a reasonably clear answer for this specific case.

45 CFR 164.501 defines marketing as "a communication about a product or service that encourages recipients of the communication to purchase or use the product or service," and then excludes communications "for treatment of an individual by a health care provider, including case management or care coordination for the individual, or to direct or recommend alternative treatments, therapies, health care providers, or settings of care to the individual," where the covered entity receives no financial remuneration from a third party for making the communication.

The same section defines treatment as including "the provision, coordination, or management of health care and related services by one or more health care providers, including the coordination or management of health care by a health care provider with a third party" and "the referral of a patient for health care from one health care provider to another."

A message asking whether a patient has been able to book the referral their doctor ordered is care coordination about that patient's treatment by definition. That is a comfortable position - and it is only comfortable as long as you keep the message clean. The moment the same SMS mentions a service line, a package or a promotion, you have taken something excluded from marketing and made it arguable. There is no operational upside to that trade.

Content design, given the above:

  • Minimum necessary. The message should not name the condition, the specialty, or the test. "Your doctor asked us to follow up on something from your last visit" carries the meaning with none of the disclosure. This matters most where the specialty itself is sensitive - behavioural health, oncology, reproductive and infectious disease - and where an SMS preview on a lock screen is read by whoever is holding the phone.
  • Ask, do not assert. Given the false-positive problem in the previous section, phrase it as a question. It is more accurate, it is more human, and it makes the inevitable wrong sends harmless.
  • One clear next action. A booking link, or a reply keyword that creates a callback task. Not three options.
  • Escalate rather than repeat. Two unanswered messages should produce a human call, not a third message. For an outstanding clinical order this is a reasonable place to spend staff time, and it is where the actual conversions happen.

On the channel: if you send SMS over a US 10-digit long code you are inside A2P 10DLC. Twilio's compliance documentation describes it as "the standard that United States telecom carriers have put in place to ensure that SMS traffic to US end users through long code phone numbers is verified and consensual," requires creating a Brand and a Campaign, and notes unregistered senders "will receive additional carrier fees for sending unregistered traffic." Daily throughput to T-Mobile runs from 1,000 SMS segments for a Sole Proprietor brand, up to 2,000 for Low-Volume Standard, and from 2,000 upward for Standard brands "depending on your Trust Score." See our A2P 10DLC guide and the glossary entry. Every third party in this pipeline that touches PHI needs a business associate agreement - treat it as a hard gate, and see data processing agreement for the general shape.

A Worked Example, With the Arithmetic Shown

Illustrative model. We report no client results, and you should replace every input with your own.

Sizing the backlog. A specialty practice runs the read-only query for the first time and finds 310 open service requests older than 45 days with no matching encounter. Two weeks of staff review reduces that to 240 genuinely open - the other 70 were completed externally, cancelled, duplicated, or belonged to patients who should have been suppressed. That 23 percent shrinkage is the single most useful number the pilot produces, and it is why you run read-only first.

The outreach. 240 patients, released in tranches of 25 a day so the front desk can absorb the replies. At two SMS segments per message that is around 50 segments a day - nowhere near any carrier ceiling, confirming that throughput is not the constraint here. The constraint is reply-handling capacity, and it always is.

Break-even instead of a forecast. Suppose the contribution margin of a completed referral visit is $180 - your figure from your own numbers. Suppose the build costs $4,500 once and $90/month, replaced with your own quotes; automation build cost explains the drivers. First-year cost: $4,500 + (12 x $90) = $5,580.

Break-even: $5,580 / $180 = 31 completed visits. Against the initial 240-patient backlog alone, that is 31 / 240 = 12.9 percent. And unlike a cold marketing list, this cohort consists of people whose own physician told them to do this thing, who mostly intended to and did not get round to it. Whether 12.9 percent is achievable is a judgement your practice manager can make far better than any article can - but it is a judgement about a warm, clinically indicated list, which is a very different question from a cold one.

Two corrections that people routinely miss:

  • The backlog is one-time; the flow is not. Year one works a backlog that accumulated over years. Year two works only what falls out of the loop in year two. Model the ongoing case on your monthly rate of new unclosed referrals, which the pilot query will tell you directly if you bucket by author date. Modelling year two on year one's list is the most common error in this business case and it makes ongoing automation look like a failure when it is simply working a smaller queue.
  • Use contribution margin, not revenue. The clinician's time is a real cost and often the binding constraint. If your schedule is already full, a recovered referral displaces another appointment rather than adding one, and the true value is the difference between the two - possibly close to zero. If you are already at capacity, do not build this, or build it and accept that its value is clinical rather than financial. Our ROI of AI agents piece covers this class of error.

For general budget ranges before you get quotes, see AI automation cost.

The Failure Modes, Ranked by How Much Damage They Do

1. The false negative. A patient with an open, clinically important referral is silently removed from the list because a loose encounter match decided the loop was closed. Nobody sees it, nobody is alerted, and the system reports a clean queue. This is the only failure here with genuine clinical consequence and it is caused by exactly the design instinct that makes the list look good - tightening the match to reduce noise. Resist it. Fail open, keep the ambiguous cases visible, and let a human clear them.

2. Messaging patients who are already booked. Caused by the missing Appointment profile discussed above. Mitigated by asking rather than asserting, and eliminated only by vendor-specific scheduling access.

3. Messaging patients who should never have been messaged. Deceased or transferred. Prevented by writing the suppression list before the selection list and by gating the first month's sends behind a human eyeball. You will catch one. Everybody does.

4. Overwhelming the front desk. The backlog is large and the temptation is to clear it in a week. Replies arrive faster than anyone can handle them, patients get no answer, and the practice looks worse than if it had never messaged. Release in tranches sized to spare capacity and be willing to take three months over the backlog.

5. The silent stop. A token expires, a scheduled job fails, and nobody notices for two months because an empty list looks exactly like a healthy one. This is the specific hazard of any automation whose success state is "nothing to report." Alert on zero output, not only on errors. See observability and error handling. Note also that credentials here are short-lived by design - the same pattern as ezyVet's documented 12-hour token TTL discussed in our refill routing article - so token refresh is a first-class part of the build, not an afterthought.

6. Scope creep into everything adjacent. Recall, reminders, backfill and referral closure all look like the same project from a distance and are four different builds with four different triggers. Backfill in particular is a good next step and a separate one - see clinic cancellation backfill.

What to measure. Completed visits attributable to the cohort, the shrinkage rate between raw query and reviewed list (this is your data-quality metric and it should improve), median days from order to closure, and the size of the ambiguous bucket. Do not measure messages sent. Hold back a small control group for the first quarter if the clinical context allows it, because without one you cannot separate the automation from seasonality - though note that deliberately not contacting patients with open clinical orders is a decision for a clinician, not a marketer, and in many contexts the correct answer is that you may not hold a control at all.

If you want help deciding whether this or backfill is the better first build, the free automation audit works through it, and automation services covers how we scope regulated work. For where this fits among everything else, see AI automation for medical clinics.

FAQ

Can I find unscheduled referrals through a standard FHIR API?
Partly. US Core STU 6.1.0 publishes a ServiceRequest profile and an Encounter profile, so you can read the order and read whether a visit happened, and the certification criterion § 170.315(g)(10) requires certified health IT to respond to single-patient and group requests using FHIR R4 4.0.1 with US Core. What you cannot do through that same standardised surface is see or create the booking - there is no Appointment profile and no Task profile in the US Core profile list. Detection is standardised; resolution is vendor-specific.
Why does the missing Appointment profile matter so much?
Because it means your "never scheduled" list will contain patients who are scheduled. Without vendor-specific scheduling access you cannot distinguish a patient who never booked from one who is booked for next Tuesday. The practical mitigations are to obtain scheduling access from your specific EHR vendor, and to word the outreach as a question - "have you been able to book this yet?" - so that being wrong costs nothing.
Is this outreach marketing under HIPAA?
For a message about a patient's own outstanding referral, very likely not. 45 CFR 164.501 excludes from marketing any communication "for treatment of an individual by a health care provider, including case management or care coordination for the individual," absent third-party remuneration, and defines treatment to include "the referral of a patient for health care from one health care provider to another." That comfortable position depends on keeping the message clean - adding a promotional element to the same message makes the analysis much harder for no operational gain. Confirm with your privacy officer.
How old should a referral be before we chase it?
That threshold should be set per order category by a clinician and stored as configuration, not chosen by whoever builds the workflow. An urgent referral should surface in days; a routine screening one can reasonably sit for weeks. Using a single threshold across all categories guarantees you are simultaneously too slow on the urgent ones and too pushy on the routine ones.
What is the most dangerous bug in this kind of system?
A false negative caused by a loose encounter match - the system decides a loop is closed because the patient was seen for something unrelated, silently drops them from the list, and reports a clean queue. It is dangerous precisely because it makes the dashboard look better. Match on encounter type or referenced request where the data supports it, and where it does not, fail open and leave the patient visible for a human to clear.
How do we handle referrals completed at an outside practice?
You generally cannot see them, so you will contact some patients who have already been seen. There is no clean technical fix within your own system. The workable answers are process ones: closing the loop with the receiving practice so a report comes back, and phrasing the outreach as a question rather than a statement so that a wrong send is a harmless enquiry instead of an error.
Should we run a control group to prove it worked?
It is the only way to separate the automation from seasonality, and it is also a decision a clinician must make rather than an analyst. Deliberately withholding follow-up from patients with open clinical orders is not the same thing as withholding a marketing email. In many contexts the right answer is that you hold no control and accept a weaker measurement, using the shrinkage rate and median days-to-closure as your operational metrics instead.
What should we measure if not messages sent?
Four things: completed visits attributable to the cohort, the shrinkage between the raw query result and the human-reviewed list (a data-quality metric that should improve over time), median days from order to closure, and the size of the ambiguous bucket you could not resolve automatically. That last one tells you where the next increment of engineering should go, which no volume metric ever will.

If this resonated

Module 02 is the long version of this post.

Eval set, refusal pattern, kill switch. Build it in a weekend.

All postsLast verified 2026-08-05

Done for you

Want this built for your business?

Tell us the workflow. We scope, build, and ship the agent with guardrails and the numbers to prove it worked. The scoping call is free.

Free scoping call. You own the code.

Request a scoping call