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

# Audit Trail

> View a date-filtered billing change log and submit structured audit response cases via a step-by-step wizard.

The Audit Trail screen displays a searchable, date-filtered table of billing change history for your organization at route `/pm/audit`.

## Overview

The page defaults to the last 30 days. Users select a From and To date via date inputs; the `useAuditTrailList` hook re-fetches on filter change, scoped to `currentOrganization.id`. Each row shows the event timestamp, action verb (insert/update/delete), the entity type (Claim, Charge, Payment, or raw table name), a truncated Record ID, and a truncated User ID. If no events exist in the selected range, an empty state is shown. Access is gated by `pm.audit.view`; if lacking that permission a destructive alert is shown instead of the table.

## Who it's for

Requires permission `pm.audit.view` (checked via `useHasPermission`; if absent, an access-denied alert is rendered instead of the table).

## Before you start

* You need the `pm.audit.view` permission.
* The date range defaults to the last 30 days; adjust as needed for compliance reviews or investigations.

## Steps

<Steps>
  <Step title="Navigate to Audit Trail">
    Go to `/pm/audit`. The table loads with a default 30-day window.
  </Step>

  <Step title="Set date range">
    Use the **From** and **To** date inputs to scope the results. The table refreshes automatically when dates change.
  </Step>

  <Step title="Review the event table">
    Each row shows: Timestamp, Action, Entity (Claim / Charge / Payment), truncated Record ID, and truncated User ID (changed\_by).
  </Step>
</Steps>

## Key concepts

| Term         | Meaning in code                                                       |
| ------------ | --------------------------------------------------------------------- |
| `action`     | The database operation: insert, update, or delete                     |
| `table_name` | Source table; displayed as Claim, Charge, or Payment for known tables |
| `record_id`  | UUID of the affected record (truncated to 8 chars in UI)              |
| `changed_by` | UUID of the user who made the change (truncated to 8 chars in UI)     |
| `changed_at` | Timestamp of the change event                                         |

## Creating an audit response

The New Audit Response wizard guides authorized users through the structured process of creating an audit response case. Route: `/pm/audit-response/new`. Requires permission `pm.audit.view` (`PM_PERMISSIONS.AUDIT_VIEW`).

The page wraps `AuditResponseWizard` in a full-screen shell. On completion, the wizard navigates to `/pm/audit-trail`. On exit without completion, it navigates back. The breadcrumb label is set to "New Audit Response" via `useBreadcrumbLabel`.

**Before you start:** gather relevant case documentation before starting the wizard; the wizard form may not auto-save mid-session.

<Steps>
  <Step title="Launch the wizard">
    Navigate to **Practice Management → Audit → New Audit Response**, or go directly to `/pm/audit-response/new`.
  </Step>

  <Step title="Complete wizard steps">
    Follow the on-screen steps presented by the audit response wizard. Exact step titles are defined in `AuditResponseWizard`.
  </Step>

  <Step title="Submit the response">
    On the final review step, confirm all entries and submit. You will be redirected to `/pm/audit-trail` on success.
  </Step>

  <Step title="Exit without saving">
    Use the **Exit** control at any point to cancel; you will be returned to the previous page without saving.
  </Step>
</Steps>

## Related

<Columns cols={2}>
  <Card title="Practice Management" icon="briefcase" href="/pm/overview">
    Practice Management core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/pm.tsx
  * src/cores/pm/pages/AuditTrailPage.tsx
  * src/cores/pm/hooks/useAuditTrailList.ts
  * src/cores/pm/pages/AuditResponseWizardPage.tsx
  * src/cores/pm/components/wizards/audit-response/AuditResponseWizard.tsx
</Accordion>
