Medical transcription intelligence
Unstructured medical transcripts processed into structured, usable data. Extraction and interpretation of vital information, reducing administrative load on healthcare professionals.
Healthcare
Document and data intelligence
OpenAI API · Structured outputs · ICD-10 mapping · pandas
Applied project
The problem
Medical transcriptions hold the information a clinic runs on (ages, treatments, procedures) locked inside free-form natural language. Extracting it by hand is administrative time taken from patient care.
What was engineered
A structured-extraction pipeline over a corpus of real medical transcriptions. The model is constrained by a defined schema (function calling), so every record returns the same fields in the same shape: patient age and recommended treatment or procedure. Missing information is declared as unknown rather than guessed; the system is built to never invent clinical data. A second stage maps each extracted treatment to its ICD codes, run at low temperature for consistency, and the results assemble into a clean, analysis-ready dataset alongside each record's medical specialty.
312 records · identical schema
"…recommended conservative care with rest, ice after longer walks…"
- Age
- unknown
- Treatment
- Rest, ice, physio referral
- Primary
- M25.561
- Secondary
- M25.461
Missing fields declared as unknown, never invented. Every record returns the same shape.
Key systems
Schema-enforced extraction
The model is constrained by a defined schema (function calling), so every record returns the same fields in the same shape: patient age and recommended treatment or procedure.
Unknown over invented
Missing information is declared as unknown rather than guessed; the system is built to never invent clinical data.
Automated ICD coding
A second stage maps each extracted treatment to its ICD codes, run at low temperature for consistency, and the results assemble into a clean, analysis-ready dataset.
From the build
tools = [{
class="code-string">"type": class="code-string">"function",
class="code-string">"function": {
class="code-string">"name": class="code-string">"extract_medical_data",
class="code-string">"description": class="code-string">"Return the patient's age and "
class="code-string">"recommended treatment from a transcription.",
class="code-string">"parameters": {
class="code-string">"type": class="code-string">"object",
class="code-string">"properties": {
class="code-string">"age": {class="code-string">"type": class="code-string">"integer"},
class="code-string">"recommended_treatment": {class="code-string">"type": class="code-string">"string"},
},
},
},
}]
class=class="code-string">"code-comment"># Schema-enforced output: every record returns the same
class=class="code-string">"code-comment"># fields. Missing information is declared as unknown;
class=class="code-string">"code-comment"># the system never invents clinical data. Why it matters
The pattern generalizes to any document-heavy operation: schema-enforced extraction, explicit handling of missing data, and automated coding against an external standard. Unstructured language in, dependable records out.
312 medical transcriptions extracted into identical structured records, gaps declared, never filled in.
Stack
All work has been anonymized.
Get in touch
Every business's work is unique. Contact us to make an educated decision.
We specialize in things that are unique to individual businesses. If that's you, contact us. A conversation is enough to make an educated decision.