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

# Notification Audit

> Audit trail of dispatched clinical notifications with SLA outcome tracking, escalation steps, and CSV export up to 10,000 rows.

The Notification Audit screen provides a paginated, filterable audit log of dispatched clinical notification events at the in-app route `/cl/notifications/audit`.

## Overview

The page is gated behind the `cl.notification_audit.view` permission and behind the `cl.notification_service_enabled` feature flag; if the flag is off, a `NotificationServiceDisabledBanner` is shown instead. The audit log queries the `cl_notification_events` table filtered by the current organization, a date range (defaulting to the last 30 days), severity, and an optional signal type string. Results are paginated at 50 rows per page and displayed in a table showing dispatched time, signal type, severity, recipient role key, SLA deadline, acknowledgement time, computed SLA status (`on-time`, `breached`, `pending`), and escalation step. Each row has a "Trail" button that opens a `NotificationAttemptTrailSheet` side panel for delivery attempt details. Users with `cl.notification_audit.export` can preview and download a CSV of up to 10,000 matching rows.

## Who it's for

Requires permission `cl.notification_audit.view`. The `cl.notification_audit.export` sub-permission enables CSV export.

## Before you start

* Permission `cl.notification_audit.view` must be granted.
* The `cl.notification_service_enabled` feature flag must be active; otherwise a disabled-service banner is shown.

## Steps

<Steps>
  <Step title="Set the date range">
    Use the From and To date inputs to set the audit window. The default is the past 30 days ending today.
  </Step>

  <Step title="Filter by severity">
    Use the Severity select to filter to `critical`, `urgent`, or `informational` events, or leave on "All".
  </Step>

  <Step title="Filter by signal type">
    Type a signal type string (e.g., `lab_critical`) in the Signal Type input to narrow results to a specific signal.
  </Step>

  <Step title="Review audit rows">
    The table shows dispatched time, signal, severity, recipient role, SLA deadline, acknowledgement time, SLA status badge, and escalation step. Use Previous / Next to page through results.
  </Step>

  <Step title="View delivery trail">
    Click "Trail" on any row to open the `NotificationAttemptTrailSheet` side panel, which shows individual delivery attempts for that event.
  </Step>

  <Step title="Export to CSV (if permitted)">
    Click "Preview Export" (requires `cl.notification_audit.export`) to open the export preview dialog. Review the row count, date range, severity, and signal filters, then click "Download CSV". Export is capped at 10,000 rows. The file is named `clinical-notifications-{from}-to-{to}.csv`.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="SLA status values">
    SLA status is computed client-side from `acknowledged_at`, `sla_deadline`, and `sla_breached_at`: `on-time` (acknowledged at or before deadline), `breached` (acknowledged after deadline, or `sla_breached_at` is set, or deadline has passed without acknowledgement), `pending` (not yet acknowledged and deadline has not passed).
  </Accordion>

  <Accordion title="Severity values">
    `critical`, `urgent`, `informational` — from the Severity select options in the UI.
  </Accordion>

  <Accordion title="CSV export columns">
    The export includes these columns in order: `dispatched_at`, `signal_type`, `severity`, `recipient_role_key`, `sla_deadline`, `acknowledged_at`, `sla_status`, `escalation_step`.
  </Accordion>

  <Accordion title="Empty and error states">
    If no records match the filters, an "No audit records" empty state is shown. If the query fails (non-RLS/permission error), a retry action is presented. RLS and permission errors (codes `42501`, `PGRST301`) do not retry automatically.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Clinical" icon="stethoscope" href="/cl/overview">
    Overview of the Clinical core.
  </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/cl.tsx
  * src/cores/cl/pages/notifications/NotificationAuditPage.tsx
</Accordion>
