Clinical summarization transforms raw EHR data into actionable discharge summaries, progress notes, and referral letters that highlight status changes, decision points, and follow-up needs. It is particularly useful for efficient handoffs, longitudinal care planning, and ensuring clear communication across multidisciplinary teams.
Prerequisites
- A Clinia workspace
- A Clinia API key (
$CLINIA_TOKEN) - Your workspace URL (
$CLINIA_WORKSPACE)
Overview
Generating a clinical summary with the AI Engine follows three steps:- Ingest patient data (FHIR bundle or PDF document)
- Poll the ingestion workflow until it completes
- Summarize by selecting a summary template and streaming the result
Step 1 — Ingest patient data
Submit a FHIR bundle scoped to the patient you want to summarize. ThepatientId is a stable identifier you control — it links ingested data to future summary requests.
runId you will use to track the workflow:
Ingesting a new FHIR bundle replaces any previously ingested bundle for that patient. Unstructured documents (PDFs) are additive and accumulate over time.
Step 2 — Poll ingestion status
Ingestion is asynchronous. Poll the status endpoint untilstatus is success or failed.
Step 3 — Pick a summary template
Summary templates define the structure and content of the generated document. Retrieve the available templates from your workspace:id of the template you want to use.
Step 4 — Create a summary
Submit a summary request with yourpatientId and summaryTemplateId. The response streams as Server-Sent Events (SSE).
SSE event stream
Each SSE event carries a JSON payload in itsdata field. Events arrive in the following sequence:
| Event type | Description |
|---|---|
text-start | Signals the start of a new section. Includes sectionTitle and sectionIndex. |
text-delta | A text chunk for the current section. Append to previous deltas for the same sectionIndex. |
text-end | Signals that all deltas for a section have been sent. |
summary-end | Signals end of generation. On success, includes a summaryId for later retrieval. |
Multiple sections can stream in parallel. Use
sectionIndex to correctly order and render sections as they arrive.Retrieving a saved summary
Once generation completes successfully, retrieve the persisted summary at any time using thesummaryId from the summary-end event: