Extract ICD-10, CPT, and SNOMED codes from clinical encounters
The Sully.ai API extracts standardized medical codes from clinical text, enabling automated billing workflows and clinical documentation. This guide covers submitting coding requests, understanding results, and integrating with your clinical workflow.
Sully.ai analyzes clinical text (transcripts or notes) and extracts relevant medical codes with their source locations. The API supports three major coding systems:
The International Classification of Diseases, 10th Revision, Clinical Modification is the standard for diagnosis coding in the United States. Sully.ai extracts ICD-10-CM codes for conditions, symptoms, and diagnoses mentioned in clinical text.
Current Procedural Terminology codes describe medical procedures and services. Sully.ai identifies procedure codes based on the clinical context and services documented.
Systematized Nomenclature of Medicine - Clinical Terms provides comprehensive clinical vocabulary. SNOMED CT codes are included alongside ICD-10-CM codes for diagnoses to support clinical interoperability.
Submit clinical text to extract medical codes. The coding operation is asynchronous and returns a coding ID for result retrieval.
import SullyAI from '@sullyai/sullyai';const client = new SullyAI();// Submit clinical text for codingconst coding = await client.codings.create({ text: "Patient presents with migraine headache, experiencing throbbing pain on the right side for 3 days. Photophobia and nausea present. Started on sumatriptan 50mg as needed. Follow-up visit scheduled in 2 weeks.",});console.log('Coding ID:', coding.codingId);
Clinical text to analyze (transcript or note content)
You can submit either raw transcripts or generated clinical notes. Notes often produce more accurate coding results because they contain structured clinical information.
A common pattern is to transcribe audio, generate a clinical note, then extract codes. You can run coding on either the raw transcript or the generated note.
import SullyAI from '@sullyai/sullyai';import * as fs from 'fs';const client = new SullyAI();async function transcribeNoteAndCode() { // 1. Transcribe audio const transcription = await client.audio.transcriptions.create({ audio: fs.createReadStream('patient-visit.mp3'), }); // Poll for transcription... let txResult = await client.audio.transcriptions.retrieve( transcription.transcriptionId ); while (txResult.status === 'STATUS_PROCESSING') { await new Promise((resolve) => setTimeout(resolve, 2000)); txResult = await client.audio.transcriptions.retrieve( transcription.transcriptionId ); } const transcript = txResult.payload?.transcription; // 2. Generate clinical note const note = await client.notes.create({ transcript: transcript, noteType: { type: 'soap' }, }); // Poll for note... let noteResult = await client.notes.retrieve(note.noteId); while (noteResult.status === 'processing') { await new Promise((resolve) => setTimeout(resolve, 2000)); noteResult = await client.notes.retrieve(note.noteId); } const noteText = noteResult.payload?.markdown; // 3. Extract codes from the generated note const coding = await client.codings.create({ text: noteText, }); // Poll for coding... let codingResult = await client.codings.retrieve(coding.codingId); while (codingResult.status === 'pending' || codingResult.status === 'processing') { await new Promise((resolve) => setTimeout(resolve, 2000)); codingResult = await client.codings.retrieve(coding.codingId); } console.log('Diagnoses:', codingResult.result.diagnoses); console.log('Procedures:', codingResult.result.procedures);}
Medical codes extracted by Sully.ai are suggestions to assist clinical and billing workflows. They are not definitive and should not be submitted for billing without human review.