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

# Clinical documentation

> Draft clinical notes and encounter summaries from EHR data and clinical guidelines to reduce physician documentation burden

Physicians spend a significant portion of their day on documentation — writing progress notes, discharge summaries, and referral letters. This administrative load contributes to burnout and takes time away from patient care. Clinical notes must be thorough, accurate, and compliant with coding requirements, which makes shortcuts risky. The challenge is reducing the effort without sacrificing quality.

Wayak deploys an agent that drafts clinical documentation by pulling structured data from your EHR and referencing clinical practice guidelines stored in a knowledge space. The agent produces note drafts that clinicians review and finalize, cutting documentation time while maintaining clinical accuracy and coding compliance.

***

## What you need

<CardGroup cols={2}>
  <Card title="Data sources" icon="database">
    * **EHR system** — patient encounters, diagnoses, orders, lab results, vital signs, medications, and problem lists
    * **Billing database** — historical claim codes, reimbursement outcomes, and denial reasons
  </Card>

  <Card title="Knowledge spaces" icon="book-open">
    * **Clinical practice guidelines** — upload condition-specific guidelines (e.g., AHA for cardiovascular, ADA for diabetes) that inform documentation standards
    * **Documentation templates** — upload your organization's note templates for progress notes, H\&P, discharge summaries, and referral letters
  </Card>
</CardGroup>

**Semantic layer:** Define these in your ontology before setting up the agent.

| Component | Name                          | Definition                                                                                                     |
| --------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------- |
| Object    | Encounter                     | Maps to the `encounters` table in the EHR. Represents a single patient visit with diagnoses, orders, and notes |
| Object    | Patient                       | Maps to `patients` in the EHR. Represents a patient with their complete medical record                         |
| Metric    | Documentation Completion Rate | Percentage of encounters with finalized notes within 24 hours of the visit                                     |
| Metric    | Average Note Turnaround       | Mean elapsed hours from encounter close to note finalization                                                   |
| Dimension | Visit Type                    | Categorizes encounters as office visit, inpatient, emergency, telehealth, or procedure                         |
| Dimension | Specialty                     | Groups encounters by clinical specialty (cardiology, orthopedics, primary care, etc.)                          |

<Tip>
  See [building a semantic layer](/quickstart/build-semantic-layer) for a step-by-step guide.
</Tip>

***

## Agent setup

<Steps>
  <Step title="Create the agent">
    Go to **Agent Space** → **New agent**.

    | Field    | Value                                                                                                                                                         |
    | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | **Name** | Clinical Documentation Assistant                                                                                                                              |
    | **Role** | Medical Documentation Specialist                                                                                                                              |
    | **Goal** | Draft clinical notes from EHR encounter data and clinical guidelines, structured according to organizational templates, for physician review and finalization |
  </Step>

  <Step title="Set the description">
    > You are a clinical documentation specialist who drafts medical notes from structured EHR data. You follow organizational note templates and reference clinical practice guidelines to ensure completeness and accuracy. You use precise medical terminology, include all relevant clinical data points (vitals, labs, medications, assessments), and structure notes for downstream coding compliance. You always produce drafts — never final notes — and flag any data gaps that the clinician should address during review.
  </Step>

  <Step title="Scope data access">
    Grant access to:

    * EHR system (encounters, diagnoses, orders, labs, vitals, medications)
    * Billing database (claim codes, denial reasons)
    * Clinical practice guidelines knowledge space
    * Documentation templates knowledge space
    * Encounter and Patient objects, Documentation Completion Rate metric
  </Step>

  <Step title="Add skills">
    <AccordionGroup>
      <Accordion title="Progress note drafting">
        **Trigger:** User asks the agent to draft a progress note for a specific encounter.

        1. Retrieve the encounter record from the EHR, including chief complaint, vitals, active medications, and orders.
        2. Pull the patient's problem list, recent lab results, and relevant prior encounters.
        3. Load the appropriate note template from the documentation templates knowledge space based on visit type.
        4. Reference clinical practice guidelines for the primary diagnosis to ensure documentation covers guideline-recommended elements.
        5. Draft the note following the SOAP structure (Subjective, Objective, Assessment, Plan) using data from the encounter.
        6. Flag any missing data points (e.g., vitals not recorded, labs pending) that the clinician should complete.
        7. Return the draft note with flagged items highlighted for review.
      </Accordion>

      <Accordion title="Discharge summary generation">
        **Trigger:** User asks the agent to draft a discharge summary.

        1. Retrieve the full inpatient encounter from the EHR, including admission diagnosis, procedures performed, and daily progress.
        2. Pull the patient's medication reconciliation, follow-up orders, and discharge instructions.
        3. Load the discharge summary template from the documentation templates knowledge space.
        4. Compile the hospital course narrative from daily progress entries.
        5. Include the discharge medication list, pending lab results, and follow-up appointment details.
        6. Return the draft discharge summary formatted for the receiving provider.
      </Accordion>

      <Accordion title="Referral letter drafting">
        **Trigger:** User asks the agent to draft a referral letter to a specialist.

        1. Retrieve the referring encounter and the reason for referral from the EHR.
        2. Pull the patient's relevant medical history, current medications, and recent diagnostics.
        3. Load the referral letter template from the documentation templates knowledge space.
        4. Include pertinent positive and negative findings related to the referral reason.
        5. Return the draft referral letter addressed to the receiving specialist with all supporting clinical data.
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

***

## Automation

### Playbook: End-of-day documentation reminder

<Steps>
  <Step title="Set the trigger">
    Set the trigger to **Schedule — Daily** at 6:00 PM to catch encounters with missing documentation before the end of the business day.
  </Step>

  <Step title="Build the workflow">
    The workflow identifies encounters with incomplete documentation and sends reminders:

    1. **Query** all encounters from the current day that do not have a finalized note in the EHR system.
    2. **Loop** — for each incomplete encounter, pull the encounter details and the assigned provider.
    3. **Condition** — check if a draft note already exists. If not, generate a draft using the encounter data and documentation template.
    4. **Action** — save the generated draft to the EHR system's note queue for the provider.
    5. **Delivery** — notify providers of their outstanding documentation.
  </Step>

  <Step title="Configure delivery">
    * **Email** — send each provider a list of their encounters pending documentation, with links to pre-populated drafts
    * **Slack** — post a department-level summary to `#clinical-ops` showing the count of incomplete notes by provider
  </Step>

  <Step title="Test and activate">
    Click **Run now** to test with live data, then toggle to **Active**.
  </Step>
</Steps>

***

## What's next

<CardGroup cols={2}>
  <Card title="Medical coding review" icon="arrow-right" href="/use-cases/healthcare/medical-coding-review">
    Validate medical codes against clinical documentation to reduce claim denials.
  </Card>

  <Card title="All Healthcare use cases" icon="list" href="/use-cases/healthcare">
    See the full list.
  </Card>
</CardGroup>
