Healthcare & Life Sciences
Medical Document Extraction API
Most of the clinical record your software needs to act on arrives as prose, a fax or a scan. Somebody is retyping it, and that somebody is usually expensive.
- EHR vendors
- Health information exchanges
- Revenue cycle software
- Care coordination platforms
What your customers would see
example interfaceMockupIllustrative mockup of the interface we would build. Figures shown are examples, not results from a live deployment.
The problem this solves
A referral arrives as a three-page PDF. A lab result comes in as a scanned printout from a system that does not speak HL7. A discharge summary is free text with the medication list buried in the fourth paragraph. Downstream, your product needs a problem list, a medication list, a set of coded diagnoses and a few dates — and none of that is available as fields.
The usual answer is a data entry team, or clinical staff doing data entry between appointments. It is slow, it is costly per document, and the error rate is not zero. It also scales linearly with volume, which is exactly the wrong shape for a software business.
Extraction is tractable for a large share of real-world documents, and genuinely hard for the rest. Clean electronic text from a known sender is close to solved. Handwritten annotations, poor scans, overlapping stamps and faxes of faxes are not, and no amount of model work makes them so. The engineering that matters is therefore the confidence layer: knowing which fields are reliable, routing the rest to a human, and never presenting a guess as a fact.
Who buys this
EHR vendors, Health information exchanges, Revenue cycle software, Care coordination platforms
What the API returns
What comes back
- Coded diagnoses with the source span each code was derived from
- Medication entries with dose, route, frequency and prescriber where stated
- Lab results with analyte, value, unit and reference range
- Patient, encounter and provider identifiers as written in the document
- Dates normalised to ISO format, with ambiguous formats flagged rather than guessed
- Document classification: referral, discharge summary, lab report, imaging report, consent
- Per-field confidence plus the bounding box or character offset the value came from
- A review queue payload for every field below your configured confidence threshold
Endpoints
| Method | Path | Returns |
|---|---|---|
| POST | /v1/documents/extract | Extract structured fields from one document |
| POST | /v1/documents/batch | Submit a batch for asynchronous extraction |
| GET | /v1/documents/{id} | Extraction result with confidence and provenance |
| GET | /v1/documents/{id}/review-queue | Fields requiring human confirmation |
| POST | /v1/documents/{id}/corrections | Submit reviewer corrections for calibration |
| GET | /v1/schemas | Available extraction schemas and field definitions |
Request and response
illustrativeRequest
{
"document_id": "doc_914772",
"content_type": "application/pdf",
"schema": "referral_letter_v2",
"confidence_threshold": 0.90,
"return_provenance": true
}Response
{
"document_id": "doc_914772",
"document_type": "referral_letter",
"pages": 3,
"source_quality": { "text_layer": false, "scan_dpi": 200, "handwriting_detected": true },
"fields": {
"patient_name": { "value": "[redacted]", "confidence": 0.97, "page": 1 },
"date_of_birth": { "value": "1961-04-18", "confidence": 0.94, "page": 1 },
"referring_provider": { "value": "Dr A. Whitfield", "confidence": 0.88, "page": 1 },
"referral_date": { "value": null, "confidence": 0.41,
"note": "Handwritten, ambiguous between 03/11 and 08/11" }
},
"diagnoses": [
{ "text": "type 2 diabetes mellitus", "code": "E11.9", "system": "ICD-10",
"confidence": 0.93, "page": 2, "span": [412, 437] }
],
"medications": [
{ "name": "metformin", "dose": "1000 mg", "frequency": "BD",
"confidence": 0.91, "page": 2 }
],
"review_required": ["referral_date", "referring_provider"],
"clinician_review_status": "pending"
}Where the data comes from
| Your own document store | The faxes, PDFs and scans already arriving in your system — the only corpus that reflects your real senders and quality |
| Clinical terminologies | ICD-10, SNOMED CT, LOINC and RxNorm for coding; licensing varies by territory and some require a national licence |
| HL7 and FHIR feeds you already receive | Used as ground truth where the same encounter arrives both structured and unstructured |
| Reviewer corrections | Your staff's confirmations and fixes, which are the highest-value training signal and stay inside your environment |
| Provider and facility reference data | So sender identification is matched against real organisations rather than free text |
| Document layout samples per sender | High-volume senders use consistent templates; template-aware extraction is substantially more accurate than generic parsing |
The intelligence layer
The difference between a demo and a service is mostly in this section. These are the parts that keep the answer trustworthy once real traffic is hitting it.
- A document classifier first, because a lab report and a discharge summary want entirely different extraction schemas
- OCR with per-region quality assessment, so a model never applies a confident parse to an illegible region
- Template matching for recurring senders, with generic extraction as the fallback path
- Terminology mapping with candidate lists rather than a single forced code, surfaced for reviewer selection
- Calibrated confidence — a 0.9 must mean roughly nine correct in ten, measured against reviewer-confirmed ground truth, not a raw model logit
- Explicit abstention: ambiguous dates, conflicting medication entries and unreadable regions return null with a reason
- Provenance on every field so a reviewer can jump to the exact region on the page
- Monitoring for extraction drift when a sender changes template, which shows up as a confidence drop before it shows up as an error
What it changes for the business
Data entry displaced
Clean electronic documents stop consuming clinical and administrative time, and the remaining manual work concentrates on the genuinely hard cases.
Faster referral turnaround
Structured intake at the point of arrival shortens the gap between a referral landing and somebody acting on it.
Coding support
Candidate codes with source spans give coders a starting point rather than a blank field.
Review that is auditable
Every field carries its origin, so a disputed record can be traced to the page it came from.
How it fits into your product
How it embeds
- Deployed inside your own environment in most engagements, so patient documents never leave your infrastructure
- Synchronous endpoint for single documents, asynchronous batch for backfill and overnight loads
- FHIR resource output as an alternative to the flat JSON schema
- Review queue payloads your existing UI can render, or prebuilt review components with page highlighting
- Webhooks on extraction completion and on confidence-threshold breaches
- Configurable thresholds per field, so a date can be held to a stricter bar than a provider name
Included in every build
- Authentication, scoped API keys and per-customer rate limiting
- Input validation with predictable, documented error responses
- Versioned endpoints so your integration never breaks without notice
- Request and response logging for audit and dispute resolution
- Latency, error-rate and usage monitoring with alerting
- OpenAPI specification, sandbox environment and client examples
- Backups, failover design and a documented recovery procedure
- An agreed support arrangement once the service is live
How we would build it
about 20 weeksDiscovery and feasibility
Weeks 1–3
This one depends heavily on data access, so we start by proving the sources exist, can be licensed for your use, and actually carry the signal the model needs. If they do not, you find out here.
Architecture and baseline model
Weeks 4–6
A written architecture and a baseline model measured against a holdout period, so you know what accuracy you are buying before the full build starts.
Production build
Weeks 7–16
Data pipelines, model training and serving, historical archive, validation harness, API, security, monitoring and documentation.
Validation and integration
Weeks 17–20
Backtesting against held-out history, accuracy reporting your team can audit, integration support and an agreed retraining cadence.
Commercial models
There is no fixed price list, because the cost is driven by data complexity, integration count, model requirements, request volume and the support level you need. Scope is agreed in writing before development starts.
Fixed-scope prototype
A defined slice of the service, built and priced as one piece of work. The usual first step when the business case needs proving internally.
Fixed-price build
An agreed scope against a written architecture, delivered for an agreed price. Best when the requirements are already clear.
Build then retainer
We build the service, then operate and improve it under a monthly agreement covering monitoring, updates and model maintenance.
White-label product
The service runs under your brand, your domain and your pricing, with MLPivot invisible to your customers.
Questions buyers ask
How accurate is extraction on handwriting and poor scans?
Materially worse than on electronic text, and we will not pretend otherwise. Typed text from a known sender extracts reliably. Handwritten annotations, low-DPI faxes and stamped-over regions are genuinely unreliable — for those the API is designed to abstain and route to review rather than produce a plausible-looking guess. During the prototype we measure accuracy by document quality band on your own corpus so you see the real split before committing.
Can extracted clinical data go straight into the record without review?
No. Clinician review of extracted clinical content is not negotiable in this design, and we would decline to build a straight-through path for diagnoses, medications or results. Administrative fields — sender, document type, dates once validated — can be automated with threshold controls. Clinical content gets a human.
Does this interpret results or suggest a diagnosis?
No. It transcribes and codes what the document says. It does not assess what the values mean, flag clinical significance, or suggest what to do next. The output is a structured copy of a document, nothing more.
Where does patient data live?
For nearly every buyer, inside their own environment. The service is built to run next to your document store, process locally and emit nothing outward. Where a hosted option is wanted we minimise retention to what the review workflow needs and agree deletion timelines in writing.
Which terminologies can you code to?
ICD-10, SNOMED CT, LOINC and RxNorm are the common set. Several of these carry licensing conditions that depend on your territory and your intended redistribution — reading a terminology is not the same as shipping it inside your product. We confirm the licence position during discovery.
Related blueprints
Healthcare Billing Validation API
Pre-submission checks on coding consistency, missing documentation and billing anomalies, returned as review items for a human biller.
Clinical Trial Matching API
Candidate shortlists matching patient records against study protocol criteria, with every criterion shown as met, unmet or undetermined.
Appointment No-Show Prediction API
Cancellation and no-show probabilities per appointment, built to add capacity through reminders and overbooking rather than to ration care.
Want this built for your platform?
Tell us what your product does today and what you want another system to be able to ask it. We will come back with an approach, a scope and a price.