> ## 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.

# Medical coding review

> Validate medical codes against clinical documentation to reduce claim denials and improve reimbursement accuracy

Medical coding errors are one of the largest sources of revenue leakage in healthcare. Mismatched diagnosis codes, missing modifiers, and unsupported procedure codes lead to claim denials, delayed reimbursements, and compliance risk. Coding teams review hundreds of encounters daily, and the complexity of ICD-10, CPT, and HCPCS coding systems makes manual review both slow and error-prone.

Wayak deploys an agent that cross-references coded claims against the clinical documentation in the EHR, flags discrepancies, and suggests corrections. A playbook runs Python-based validation logic to batch-check coding accuracy across your daily claim submissions, catching errors before claims go out the door.

***

## What you need

<CardGroup cols={2}>
  <Card title="Data sources" icon="database">
    * **Billing database** — submitted claims, assigned ICD-10 and CPT codes, modifiers, reimbursement amounts, and denial history
    * **EHR system** — encounter records, clinical notes, diagnoses, procedures performed, and order details
  </Card>

  <Card title="Knowledge spaces" icon="book-open">
    * **Coding manuals** — upload ICD-10-CM, CPT, and HCPCS reference materials with code descriptions, inclusion/exclusion notes, and coding guidelines
    * **Payer-specific rules** — upload billing requirements for major payers, including documentation standards, modifier rules, and bundling logic
  </Card>
</CardGroup>

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

| Component | Name                 | Definition                                                                                                                 |
| --------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Object    | Claim                | Maps to the `claims` table in the billing database. Represents a submitted insurance claim with codes, amounts, and status |
| Object    | Encounter            | Maps to `encounters` in the EHR. Represents the clinical visit that supports the claim                                     |
| Metric    | Coding Accuracy Rate | Percentage of claims where assigned codes match the documented diagnoses and procedures, validated by audit                |
| Metric    | Denial Rate          | Percentage of submitted claims that are denied by payers, segmented by denial reason                                       |
| Dimension | Payer                | Groups claims by insurance payer (Medicare, Medicaid, Blue Cross, Aetna, etc.)                                             |
| Dimension | Denial Reason        | Classifies denials by category (medical necessity, missing documentation, coding error, authorization)                     |

<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** | Coding Review Specialist                                                                                                                                              |
    | **Role** | Medical Coding Analyst                                                                                                                                                |
    | **Goal** | Validate medical codes against clinical documentation, identify coding errors, suggest corrections, and explain the rationale using coding guidelines and payer rules |
  </Step>

  <Step title="Set the description">
    > You are a certified medical coding analyst who reviews claims for accuracy before submission. You cross-reference assigned ICD-10 and CPT codes against the clinical documentation in the encounter record, checking for supported diagnoses, correct modifiers, and proper code sequencing. You flag discrepancies with specific references to coding guidelines and payer rules. You suggest corrected codes when errors are found and explain the rationale. You never submit or modify claims directly — you provide validated recommendations for the coding team.
  </Step>

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

    * Billing database (claims, codes, denial history)
    * EHR system (encounter records, clinical notes, diagnoses, procedures)
    * Coding manuals knowledge space
    * Payer-specific rules knowledge space
    * Claim and Encounter objects, Coding Accuracy Rate and Denial Rate metrics
  </Step>

  <Step title="Add skills">
    <AccordionGroup>
      <Accordion title="Claim code validation">
        **Trigger:** User asks the agent to review a specific claim or encounter for coding accuracy.

        1. Retrieve the claim record from the billing database, including all assigned diagnosis and procedure codes.
        2. Pull the corresponding encounter record from the EHR with clinical notes, diagnoses, and procedures performed.
        3. Cross-reference each assigned code against the clinical documentation to verify support.
        4. Check code specificity — ensure the most specific ICD-10 code is used (e.g., laterality, episode of care).
        5. Validate modifier usage against payer-specific rules from the knowledge space.
        6. Check for bundling issues — identify code pairs that should be bundled or require modifier 59.
        7. Return a validation report listing each code, its support status, any suggested corrections, and the guideline reference.
      </Accordion>

      <Accordion title="Denial root cause analysis">
        **Trigger:** User asks the agent to analyze a denied claim or a batch of denials.

        1. Retrieve the denial details from the billing database, including the payer's denial reason code and remarks.
        2. Pull the original claim codes and the supporting encounter documentation.
        3. Map the denial reason to the payer-specific rules to understand the requirement that was not met.
        4. Identify the root cause (missing documentation, unsupported code, authorization gap, or coding error).
        5. Recommend the corrective action — whether to appeal with additional documentation, recode, or write off.
      </Accordion>

      <Accordion title="Coding guidance lookup">
        **Trigger:** User asks a question about coding rules, guidelines, or payer requirements.

        1. Search the coding manuals knowledge space for the relevant code, guideline, or category.
        2. Extract the applicable coding rules, inclusion/exclusion notes, and sequencing guidance.
        3. Cross-reference with payer-specific rules if the query involves a particular insurance payer.
        4. Return the guideline text with a plain-language explanation and examples.
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

***

## Automation

### Playbook: Daily pre-submission coding audit

<Steps>
  <Step title="Set the trigger">
    Set the trigger to **Schedule — Daily** at 5:00 PM to audit all claims queued for submission the following business day.
  </Step>

  <Step title="Build the workflow">
    The workflow batch-validates coded claims against clinical documentation and flags errors for correction:

    1. **Query** all claims in "ready to submit" status from the billing database.
    2. **Query** the corresponding encounter records from the EHR system, including clinical notes and procedure details.
    3. **Python code block** — run a validation algorithm that cross-references each claim's codes against the encounter data. The code checks for: (a) diagnosis codes supported by the clinical documentation, (b) procedure codes matching documented services, (c) modifier accuracy per payer rules, and (d) bundling conflicts. Each claim receives a validation score and a list of flagged issues.

    <Info>
      The **coding validation** step uses a Python code block to perform rule-based cross-referencing of claim codes against encounter documentation. You can customize the validation rules, add payer-specific checks, and adjust the scoring thresholds.
    </Info>

    4. **Condition** — if a claim has any flagged issues, hold it from submission and route it to the coding team for correction.
    5. **Action** — update the claim status in the billing database (validated, held, or flagged).
    6. **Delivery** — distribute the audit results to the coding team.
  </Step>

  <Step title="Configure delivery">
    * **Email** — send the coding team a detailed audit report listing each flagged claim with the specific issues and suggested corrections
    * **Slack** — post a summary to `#revenue-cycle` with the count of validated, held, and flagged claims and the overall coding accuracy rate
  </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="Patient intake automation" icon="arrow-right" href="/use-cases/healthcare/patient-intake-automation">
    Automate patient registration with form validation, insurance checks, and department routing.
  </Card>

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