> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Results

A succeeded job lists its results in `results`, each with the URL to download it from:

```json
"results": [
  { "name": "fhir",   "filename": "fhir_bundle.json", "content_type": "application/fhir+json",
    "size_bytes": 136319, "url": "/v1/jobs/…/results/fhir" },
  { "name": "notes",  "filename": "notes.zip",        "content_type": "application/zip",
    "size_bytes": 5848,   "url": "/v1/jobs/…/results/notes" },
  { "name": "result", "filename": "result.json",      "content_type": "application/json",
    "size_bytes": 63127,  "url": "/v1/jobs/…/results/result" }
]
```

Each result can be downloaded **once**; a second request returns `410 result_expired`. Results
not downloaded are deleted 24 hours after the job finishes (`results_expire_at`).

## FHIR bundle

`fhir_bundle.json` is a FHIR R4 **transaction** Bundle following US Core conventions.
Resources refer to each other by `urn:uuid` full URLs, so you can `POST` the bundle to a FHIR
server as one transaction.

| Resource                       | Holds                                                                                                                                                                                                                                                                                                               |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Patient`                      | Demographics, with a medical record number, address, and race and ethnicity (US Core extensions)                                                                                                                                                                                                                    |
| `Encounter`                    | Each visit or hospital stay: setting, dates, specialty, reason, facility and clinician. A hospital stay also has a `diagnosis` entry referencing the `Condition` chiefly responsible for it, with `rank` 1 and `use` `billing` (diagnosis-role)                                                                     |
| `Condition`                    | Problems, past and present, coded with SNOMED CT and ICD-10-CM. A cancer also has its body site, histology and stage                                                                                                                                                                                                |
| `Procedure`                    | Procedures, coded with SNOMED CT, including each course of radiation therapy with its site, dates, dose and number of fractions                                                                                                                                                                                     |
| `MedicationRequest`            | Medications and their dosage instructions, coded with RxNorm                                                                                                                                                                                                                                                        |
| `AllergyIntolerance`           | Allergies and reactions, or "no known allergy"                                                                                                                                                                                                                                                                      |
| `Immunization`                 | Vaccines, coded with CVX                                                                                                                                                                                                                                                                                            |
| `Observation`                  | Vital signs and laboratory results, coded with LOINC, with UCUM units, reference ranges and interpretation flags. Also measurements from diagnostic studies (such as left ventricular ejection fraction) and, for cancers, the items listed below                                                                   |
| `DiagnosticReport`             | A laboratory draw (US Core lab, category `LAB`) whose `result` lists its Observations; a culture (category `MB`); and the report of each diagnostic study (imaging, echocardiogram, stress test, catheterization, endoscopy, pulmonary function test, biopsy): its conclusion, the report text and its measurements |
| `DocumentReference`            | Each clinical document, its text attached as `text/plain`, typed with LOINC                                                                                                                                                                                                                                         |
| `Coverage`                     | Each health plan the patient has, with its payer as an `Organization` (US Core)                                                                                                                                                                                                                                     |
| `Practitioner`, `Organization` | The clinicians and facilities                                                                                                                                                                                                                                                                                       |

### Cultures, and study measurements

A culture is a `DiagnosticReport` with category `MB`. Its results are a Gram stain
`Observation` and one `Observation` per organism, each organism's
`valueCodeableConcept` carrying its SNOMED CT code. An organism's `hasMember` lists its
susceptibility Observations: the antibiotic's LOINC code, the MIC as a `valueQuantity` in
ug/mL with a comparator, and an S/I/R `interpretation`.

ECG and pulmonary function measurements are Observations with category `procedure`,
referenced by the study's `DiagnosticReport`:

| Measurement      | LOINC     |   | Measurement | LOINC     |
| ---------------- | --------- | - | ----------- | --------- |
| PR interval      | `8625-6`  |   | FEV1        | `20150-9` |
| QRS duration     | `8633-0`  |   | FVC         | `19870-5` |
| QT               | `8634-8`  |   | FEV1/FVC    | `19926-5` |
| QTc              | `8636-3`  |   | DLCO        | `19911-7` |
| QRS axis         | `8632-2`  |   |             |           |
| Ventricular rate | `76282-3` |   |             |           |

### Document types and their LOINC codes

Each `DocumentReference.type` carries the LOINC code for its kind of document, so you can map
a document back to the `document_types` value that asked for it:

| `document_types` value           | LOINC      |
| -------------------------------- | ---------- |
| `progress_note`                  | `11506-3`  |
| `history_and_physical`           | `34117-2`  |
| `consult_note`                   | `11488-4`  |
| `discharge_summary`              | `18842-5`  |
| `emergency_department_note`      | `34111-5`  |
| `operative_note`                 | `11504-8`  |
| `procedure_note`                 | `28570-0`  |
| `radiology_report`               | `18748-4`  |
| `pathology_report`               | `11526-1`  |
| `nursing_note`                   | `34746-8`  |
| `telephone_encounter`            | `34748-4`  |
| `preoperative_assessment`        | `34751-8`  |
| `social_work_note`               | `28653-4`  |
| `occupational_therapy_note`      | `28578-3`  |
| `physical_therapy_note`          | `28579-1`  |
| `palliative_care_note`           | `85435-6`  |
| `radiation_oncology_consult`     | `34831-8`  |
| `radiation_treatment_summary`    | `68602-2`  |
| `dietitian_note`                 | `34801-1`  |
| `speech_language_pathology_note` | `28571-8`  |
| `respiratory_therapy_note`       | `34838-3`  |
| `cardiac_rehabilitation_note`    | `103970-0` |
| `pulmonary_rehabilitation_note`  | `34830-0`  |
| `laboratory_report`              | `11502-2`  |
| `ecg_report`                     | `11524-6`  |
| `echocardiogram_report`          | `42148-7`  |
| `cardiac_study_report`           | `75425-9`  |
| `pulmonary_function_report`      | `58477-1`  |
| `microbiology_report`            | `18725-2`  |
| `insurance_coverage_summary`     | `52038-7`  |
| `prior_authorization_request`    | `51851-4`  |
| `letter_of_medical_necessity`    | `51852-2`  |

### Cancer

Each cancer's details follow the conventions of mCODE, the HL7 standard for oncology data:

* **Stage:** the clinical stage at diagnosis, and the pathologic stage after surgery. Each
  stage group (LOINC 21908-9 clinical, 21902-2 pathologic) links to its T, N and M
  categories. AJCC values are coded with SNOMED CT.
* **Biomarkers:** for example hormone receptors, HER2, PD-L1 or gene mutations, each with its
  result.
* **ECOG performance status** (LOINC 89247-1), at diagnosis and at each assessment.
* **Disease status** (LOINC 97509-4) at each restaging or surveillance assessment, coded with
  SNOMED CT (not detected, improved, stable, worsened).
* **Radiation therapy:** each course as a `Procedure` (SNOMED CT 1217123003), with its
  treated site, dates, dose and number of fractions.
* **Systemic therapy:** each drug as a `MedicationRequest` that gives the cancer as its reason.

Each of these refers to the cancer's `Condition`.

Resource ids are derived from the patient, so the same patient always produces the same ids.

## Documents

`notes.zip` holds one text file per document, numbered in date order:

```
001_2025-03-14_progress_note.txt
002_2025-09-02_history_and_physical.txt
003_2025-09-03_progress_note.txt
004_2025-09-05_discharge_summary.txt
manifest.json
```

`manifest.json` describes each document: its file, `note_type`, LOINC document type,
date written, author and specialty, facility, and the encounter's setting and id, which
match the FHIR bundle and `result.json`.

`notes_pdf.zip` (output `pdf`) holds the same documents as PDFs, laid out as a hospital's
clinical documents would be, plus `chart.pdf`: the whole chart in one file, with a bookmark
for each document. Every PDF is marked as synthetic.

## The full record

`result.json` is the patient's complete record as JSON:

```json
{
  "record": {
    "patient_id": "…",
    "demographics": { … },
    "social_history": { … },
    "conditions": [ … ], "procedures": [ … ], "medications": [ … ], "allergies": [ … ],
    "immunizations": [ … ], "encounters": [ … ], "observations": [ … ],
    "cultures": [ … ], "coverage": [ … ], "cancers": [ … ], "notes": [ … ]
  },
  "seed": 20260630,
  "complexity": 7,
  "requested_conditions": { "heart failure with reduced ejection fraction": { … } }
}
```

Each coded item has its text and its codings (system, code, display), and each item links to
the encounter it happened at. A condition the chart is mainly about carries `primary: true`,
and a hospital stay's encounter carries `diagnosis_condition_id` — the `id` of the condition
chiefly responsible for it, the principal diagnosis, or the most responsible diagnosis in
Canada. `notes` holds every document with its text, type, author and
dates. `requested_conditions` shows how each condition you asked for was coded.

`cancers` holds each cancer's course: primary site, histology and grade, clinical and
pathologic stage with TNM, biomarkers, performance status, each treatment (operations,
chemotherapy, endocrine, targeted and immunotherapy, and radiation with site, technique, dose
and fractions), with its dates, cycles, response and side effects, and each restaging
assessment. It also holds the `workup` — how the cancer was found, diagnosed and staged, and
the tests done before treatment, each with its date and its procedure — and, for breast and
gynecologic cancers in women, `menopausal_status`.

A diagnostic study in `procedures` carries its `result`: the findings, impression and key
measurements its report gives.

`cultures` holds each culture: the specimen, when it was collected and finally reported, the
Gram stain, the result, and each organism with its susceptibilities — organisms coded with
SNOMED CT, antibiotics with RxNorm, tests with LOINC. `coverage` holds the patient's health
plans, primary first: payer, plan, member ID, group, subscriber, relationship, dates and
benefits.

## Bulk Data

A cohort's `bulk` result, `cohort_fhir_bulk.zip`, is the whole cohort as
[FHIR Bulk Data](https://hl7.org/fhir/uv/bulkdata/), the format of a FHIR server's
population export:

```
AllergyIntolerance.ndjson
Condition.ndjson
DiagnosticReport.ndjson
DocumentReference.ndjson
Encounter.ndjson
…
Patient.ndjson
Practitioner.ndjson
manifest.json
```

Each `.ndjson` file holds one resource per line (NDJSON is the same as JSONL). References are
relative (`Patient/<id>`), as in a server export. The health system's clinicians and
facilities are shared by the cohort's patients and appear once. `manifest.json` follows the
Bulk Data export manifest, listing each file with its resource type and count.