> ## Documentation Index
> Fetch the complete documentation index at: /developers/llms.txt
> Use this file to discover all available pages before exploring further.

# Put the workflows together

> Build a follow-up note, a referral, or a complete review-and-save journey from the API guides.

Combine the API calls into common clinical workflows. Use the same grant for
each consultation and wait for required inputs to finish processing.

## Record a consultation and produce a note

1. [Open the patient and session](/developers/session-workflow.md) using your EHR's IDs.
2. [Add background text or reports](/developers/context.md). Wait for required files to be ready.
3. Upload audio chunks through [segmented transcription](/developers/segmented-transcription.md),
   process each returned transcript, then finish the recording.
4. [Generate a consult note](/developers/notes.md) with the clinician's selected template.
5. [Consume the stream](/developers/streaming.md) and use the saved `output.ready` document for clinician review.
6. Save reviewed edits and write the result to your EHR's encounter.

If the full recording already exists, replace step 3 with the
[complete recording upload](/developers/recordings.md) workflow.

## Produce a referral from the same consultation

1. Reopen the existing session instead of creating another encounter.
2. Select a [document template](/developers/templates.md).
3. [Create a document](/developers/documents.md#create-an-empty-document) titled for the referral.
4. Request [content generation](/developers/documents.md#generate-or-regenerate-content) and wait for `output.ready`.
5. Let the clinician review and edit the document, then save it through your EHR.

For a new prompt-based output, such as patient instructions, use
[Custom template responses](/developers/custom-templates.md). That endpoint creates a private
template and queues its document in one request.

## Reopen and edit a completed note

1. Look up the saved Cortexa session ID for the current grant and encounter.
2. List its documents and retrieve the selected document.
3. Retain `current_version` while the clinician edits the text.
4. PATCH the document with that value as `base_version` and the edited content.
5. If you receive `409`, retrieve the newer document and resolve the conflict.
6. Save the accepted text through your EHR API and retain the new Cortexa version.

## Add coding to a completed encounter

1. Complete the consult-note workflow and have the clinician review the note.
2. Request [clinical code suggestions](/developers/clinical-coding.md) for enabled code systems.
3. For supported US office/outpatient visits, request an E/M assessment with the
   correct new/established patient type.
4. Present supporting evidence and any insufficient-documentation result.
5. Let the clinician choose what to use in your billing workflow.

Editing the note changes its version and invalidates cached E/M assessment.
Obtain the assessment for the reviewed version before displaying it as current.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.