Recruitment · EHR data

Bulk FHIR for Clinical Trial Recruitment: What Breaks, and How to Build for It

An in-depth interview with Mahalo Health founder Prasanna Gopinath on bulk FHIR, SMART Backend Services, missing notes, code mismatches, and building EHR connections research sites can trust.

Mahalo Health

Interview recording

The recording will appear here when it is available.

Illustration of an EHR connected to Recruit over FHIR within a deployment's compliance boundary.

Part 1: Who and why

Interviewer: Prasanna, who are you and what do you build?

Prasanna: I'm Prasanna Gopinath, founder and CEO of Mahalo Health. We build a clinical research platform that runs studies end to end: consent, patient-reported outcomes, wearables, data capture. We've supported long-running psychiatric studies with thousands of participants. Our newest product is Recruit. It connects to the EHRs of a research site's partner practices, with their permission, reads each trial's eligibility criteria, and gives the coordinator a ranked, explained list of who to call.

Interviewer: What's your background before Mahalo?

Prasanna: I founded CognitiveClouds, a product engineering firm. For years my job was making two systems that were never designed to talk to each other actually talk. That's most of what healthcare integration is. It's why we treat the connector as a first-class product, not plumbing.

Interviewer: Why does recruitment need EHR data?

Prasanna: Because recruitment is where trials stall. Sites miss enrollment targets, studies run long, and the patients who'd fit are already being treated at practices nearby. Today, finding them means a coordinator reading charts one at a time against a 90-page protocol. That doesn't scale past a handful of patients. If a partner practice can connect once and let the site check every study against its population, safely, the math changes.

Part 2: Why bulk FHIR

Interviewer: So why bulk FHIR specifically?

Prasanna: Regular FHIR APIs are built around one patient: a patient app pulling one record, a clinician app opening one chart. Research is the opposite. You need every patient's diagnoses, medications, labs, encounters, and ideally notes, at once. Bulk FHIR, the FHIR Bulk Data Access standard, is designed exactly for that: export a whole population in one job.

Interviewer: And it's widely available?

Prasanna: It's required. Under the US certification rules, a certified EHR has to support a standardized API for population services, which includes bulk export for a group of patients. That's what makes the long tail reachable. Community psychiatry practices and small primary care clinics run dozens of different systems. Without a common standard, every one would be a custom project, and no small research site could afford that.

Interviewer: Walk us through what an export actually looks like.

Prasanna: There are four steps. First, you kick it off: a request to the server's export endpoint, either for everyone, for patients, or for a specific group. Most real deployments use a group, which is how the EHR defines "the patients this practice has authorized." You tell the server to work in the background. Second, the server answers right away with a status address. Third, you poll that address. The server says "still working," often with a hint for when to check back, until it finishes. Fourth, it returns a manifest: a list of files, one or more per data type, in a format called newline-delimited JSON, one record per line. You download those files and load them.

Interviewer: And then every night?

Prasanna: Every night we ask again, using a "since" parameter so the server only sends what changed. We also fingerprint every record we've seen, so even if a server resends everything, we only write what actually changed. In our tests, a second run skipped almost everything as unchanged and inserted one new record. That's the behavior you want at a partner practice: the population stays current without re-reading it every night.

Interviewer: Any catch in the nightly pattern?

Prasanna: Deletions. Incremental exports are good at telling you what's new or changed. Many servers are less clear about what was removed or corrected. So you can't run on increments forever. We plan a periodic full refresh per practice to catch anything an increment missed.

Part 3: How the connection is secured

Interviewer: How does a system like yours log in? There's no user.

Prasanna: Right. It uses SMART Backend Services, which is machine-to-machine authorization. Each customer's Recruit instance has its own key pair. We publish the public key at a fixed web address on that instance. The practice's EHR administrator registers us as an approved client, pointing at that address. When we connect, we sign a short-lived token with our private key and send it to the EHR's token endpoint. The EHR checks the signature against our public key and hands back an access token, usually valid for only a few minutes, limited to read access for what we're allowed to see.

Interviewer: Why does that matter to a practice?

Prasanna: Three reasons. No password is ever shared. The practice controls the registration, so they can revoke us from their side in one step. And because every customer has its own instance and its own keys, one customer's access can never be used to reach another customer's practices.

Interviewer: What usually goes wrong at this stage?

Prasanna: The community has been very open about this, and it matches what we prepare for: registration steps that differ by vendor, a token endpoint that isn't where the documentation says, a client that's registered but not linked to the right group, or a token that expires halfway through a long download. None of that is exotic. It's the "thousand small things" problem. So our connector handles token refresh mid-export and treats each failure as a specific, logged reason, not a generic error.

Part 4: What our test runs actually showed

Interviewer: You've tested this. What did you see?

Prasanna: We ran our connector end to end against the public SMART Bulk Data reference server, which serves synthetic patients through the real standard. One export brought in 100 patients, 639 conditions, 2,386 medication orders, and 16,315 observations, with zero errors. The plumbing worked. But three things in the data taught us more than the plumbing did.

Interviewer: Go through them.

Prasanna: First, notes. That entire export had two clinical documents, and one was a JPEG image. You can't screen a patient against a picture, so we skipped it, and logged why. That's a test server, but it matches what everyone in the field reports: structured data arrives reliably, documents are thin and inconsistent. When notes do come through, they arrive as PDFs, scanned images, rich text, plain text, sometimes embedded in the record, sometimes as a separate file you have to fetch with another authorized request. You need a full document pipeline just to turn that into readable text.

Second, codes. The test data coded diagnoses in SNOMED CT, a clinical terminology. Our protocol rules were written in ICD-10, the billing code system most community charts lean on. So our depression rule found almost nobody. The patients were there; the vocabularies didn't line up. The lesson is blunt: connecting to an EHR is not the same as understanding it. You need a translation layer between SNOMED, ICD-10, RxNorm for medications, and LOINC for labs and scores.

Third, appointments. One of the strongest recruitment signals is "this patient has a visit next week." You can approach them while they're already coming in. Appointments aren't part of the core data most systems export today, so you have to get them another way.

Interviewer: Were there positives in the data?

Prasanna: Labs and scores. Lab results and survey scores generally use LOINC codes, and those are consistent. In psychiatry that matters: PHQ-9 and GAD-7 totals have standard codes, so a routine depression score from a primary care visit can be read reliably. That's real signal.

Part 5: How many EHRs, and the honest answer

Interviewer: How many EHRs are you connected to today?

Prasanna: I'll be straight: Tebra is our first live practice connection, and we're registering with the other major vendors now. Our connector is built to the certified standard and proven against the reference server. I'd rather tell you that than put a number on a slide we can't back up.

Interviewer: But you've designed for many.

Prasanna: Yes, because the people ahead of us have said it clearly: the standard is the same, the implementations aren't. The same request can behave differently from vendor to vendor, and even practice to practice on the same vendor, depending on version and configuration. So we didn't build as if that won't happen.

Part 6: Designing for messy reality

Interviewer: What does designing for it look like concretely?

Prasanna: Six things.

One: ask before you assume. Every FHIR server publishes a capability statement, a description of what it supports. When a practice connects, we read it first: which data types, whether bulk export is supported, whether documents are available. That becomes the sync plan for that practice.

Two: one core, thin adapters. The connector is a single piece of code. Each vendor gets a small configuration layer for its quirks: how groups work, which parameters it honors, its rate limits. Fixing one vendor can never break another.

Three: earn the word "available." In our product, a vendor's badge only flips to "available now" after it passes our test suite on the vendor's sandbox and at one real practice. Until then it says "request connection." It keeps us honest about timelines with customers.

Four: assume the download will break. Large exports fail halfway. We resume where we left off, and every run records exactly how many records were inserted, updated, skipped, or failed, per data type. When something goes wrong, we see it in the numbers instead of guessing.

Five: fall back without drama. If FHIR isn't ready at a practice, every certified EHR can also export standard clinical documents, and almost any practice can produce a structured file. Some behavioral health systems don't offer a FHIR API at all yet. A practice should never have to wait on the standard to help its patients.

Six: keep the patient list honest. Patients appear at more than one practice, and there's no universal patient ID in the US. We keep each practice's records separate under that practice's permission, and never merge across practices without a reason and a record.

Part 7: Psychiatry makes it harder

Interviewer: Your first market is psychiatry. Why is that harder?

Prasanna: Because psychiatric eligibility mostly isn't in coded data. Look at a treatment-resistant depression protocol. It wants a HAM-D score of 18 or more. No community chart has a HAM-D; it's given at the research visit. It wants failure of two adequate antidepressant trials. The chart has medication history, which hints at it, but "adequate dose" and "failed" are clinical judgments in the notes. It wants no history of mania or psychosis, no significant suicide risk, nothing that would make safe participation hard. Most of that is prose.

Interviewer: So how do you get signal from the chart?

Prasanna: You squeeze the structured data hard, then route the rest honestly. Medication history is the best example. A single prescription tells you little. But reconstruct the courses, which drug, start date, stop date, how long, and you can see "three antidepressants, each six weeks or longer, all stopped." That's a strong hint of treatment resistance. Then add diagnosis codes for recurrent depression, PHQ-9 trends, and exclusion diagnoses like bipolar disorder or psychotic disorders. That's a pre-screen worth acting on.

Interviewer: And everything else?

Prasanna: Every criterion in Recruit is tagged by how it can be answered: the chart, the notes, or only a person. Chart rules are checked with plain, repeatable logic and show the date of the fact. Note rules use AI to find the relevant sentence and show it, with the date. If nothing is found, the answer is unknown. Person rules become questions for the coordinator's call. We never count unknown as a pass or a fail. That's the most important design decision we made.

Interviewer: Even for suicide risk?

Prasanna: Especially for suicide risk. Software can show a person what a clinician wrote, with the date, before they call. It should never decide that from codes or keywords. "Denies suicidal ideation" contains the words "suicidal ideation." Knowing what not to automate is part of the product.

Interviewer: Psychiatric data is also more sensitive.

Prasanna: Much more, and two rules get missed a lot. Records from federally assisted substance use disorder programs have extra federal protection under 42 CFR Part 2, so we never use them to target or contact anyone. And psychotherapy notes, a therapist's private session notes kept apart from the medical record, have special protection under HIPAA and shouldn't be part of recruitment at all. We design around both.

Part 8: Trust with practices

Interviewer: How do you get a practice to agree to this?

Prasanna: You give them control, in the software, not just in the contract. Connecting the EHR and giving permission are two separate steps in Recruit. Connecting is technical. Permission is per study: who signed, which study, what scope, when it expires. A practice can withdraw at any time and searching stops immediately. If they leave entirely, we can delete their patients' data and keep a record that we did.

Evidence stays inside the platform. When a candidate is sent on to the research site's systems, it carries a summary: which criteria were met, how each was known, and when. Not the notes. And every time anyone opens a record or a note, it's logged with who and why. When a practice owner asks, "Who looked at my patients?", we can show them.

Interviewer: And infrastructure?

Prasanna: Each customer gets its own instance with its own database and keys, in the region they choose. That's a deliberate choice for this kind of data. A security review becomes simple: your partners' data sits in your instance and nowhere else.

Part 9: Do you ever not use bulk FHIR?

Interviewer: Have you ever had to skip bulk FHIR entirely?

Prasanna: We built for it from the start, because some systems simply aren't there yet. In behavioral health especially, there are newer clinic platforms without a public FHIR API. For those, a structured file export is the honest path today, and we support it as a first-class connector, not a workaround. Standard clinical document exports are the second fallback. But FHIR is always the goal, because it's the only path that stays current every night without someone emailing a file.

Part 10: What we'd ask regulators for

Interviewer: If you could change one thing at the policy level?

Prasanna: Notes. Clear requirements for which clinical documents must be available through the standard, and in a readable form, not just images. Structured data is well covered, and that's genuinely good. But AI makes clinical notes useful for recruitment in a way they weren't five years ago, and notes are the most uneven part of the standard today.

Interviewer: A close second?

Prasanna: Real-world conformance. Certification testing exists and the open testing tools are excellent. But what matters to a site is whether one specific practice's setup actually works. Some way to confirm a bulk endpoint is live and usable before a customer is waiting on it would save everyone months.

Third, appointments in the core data. I'm glad to see the standards work moving that way.

And one more: a standard way to express research permission. Today every company invents its own. A common way to say "this practice authorized this use, for this study, until this date" would make trust portable between platforms.

Part 11: Credit where it's due

Interviewer: Anything in the ecosystem you'd praise?

Prasanna: The open tooling. The SMART Bulk Data reference server let a small team prove a real connector end to end before touching a single real chart. Synthetic patient generators let you test at volume without risk. The open testing tools give vendors and developers a shared yardstick. The fact that all of this exists, and that the community talks openly about what breaks, is a huge reason newer companies can build responsibly.

Part 12: Closing

Interviewer: Last word?

Prasanna: Research is care. For many patients a trial is a real treatment option, sometimes the only one left. And for the treatments of tomorrow, trials are the only way they come to exist. When an EHR connection works, a community psychiatrist can offer patients that option without drowning in paperwork. When it doesn't, the patient never hears about the study. Getting this right isn't an IT project. It's access to care. We're early, we're building it carefully, and we'll share what we learn.

Glossary

FHIR:
a standard for exchanging health data between systems.
Bulk FHIR (Bulk Data Access):
the part of FHIR for exporting data on many patients at once.
SMART Backend Services:
machine-to-machine authorization using signed tokens instead of passwords.
NDJSON:
a file format with one record per line, used for bulk exports.
Capability statement:
a FHIR server's description of what it supports.
SNOMED CT, ICD-10, RxNorm, LOINC:
code systems for clinical concepts, billing diagnoses, medications, and lab tests or scores.
42 CFR Part 2:
federal rules protecting substance use disorder treatment records.

Frequently asked questions

What is bulk FHIR used for in clinical trial recruitment?
Bulk FHIR lets a recruitment platform export a whole patient population from an EHR in one job, so trial criteria can be checked across all of a practice's patients and refreshed nightly.
Do certified EHRs have to support bulk FHIR?
US certification rules require certified EHRs to support a standardized API for population services, which includes bulk export for groups of patients.
How does a recruitment platform authenticate to an EHR without a user?
Through SMART Backend Services: the platform signs a short-lived token with its private key, and the EHR verifies it against a registered public key before issuing a limited access token.
Why are clinical notes hard to get through FHIR?
Document availability and formats vary widely. Notes may be missing, stored as images or PDFs, or require separate authorized downloads, so they need their own processing pipeline.
What happens when a practice's EHR doesn't support FHIR?
Fallbacks include standard clinical document exports and structured file exports, which many behavioral health systems can provide even without a FHIR API.

Move from insight to implementation

Explore the Mahalo workflow most closely aligned with this article, or discuss a regulated deployment with the team.