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

# Compliance Report

> Aggregate-only 42 CFR Part 2 consent compliance statistics: SUD chart count, active consent count, coverage percentage, disclosures, and redisclosures.

The Compliance Report screen displays aggregate consent compliance statistics for Substance Use Disorder (SUD) records under 42 CFR Part 2, accessible at route `/cl/compliance-report`.

## Overview

The page uses `PermissionGate` with `cl.compliance_report.view` to control access, rendering a fallback message "You do not have permission to view compliance reports." when the permission is absent. The main content is rendered by `DashboardContent`, which calls `useComplianceStats`. That hook invokes the `cl_part2_compliance_stats` Supabase RPC function with `p_org_id` set to the current organization's ID. The RPC returns aggregate counts only; no patient identifiers are returned or displayed. Five metric cards are rendered: SUD Charts, Active Consents, Consent Coverage (as a percentage with one decimal place), Disclosures, and Redisclosures. An "About This Report" card beneath the metrics states that no patient identifiers are shown, consistent with 42 CFR Part 2 requirements, and that all data is scoped to the organization. A loading skeleton of five cards is shown while data loads. If the RPC returns an error, an error card is shown.

## Who it's for

Requires permission `cl.compliance_report.view` (enforced by `PermissionGate` in the component and by `RequirePermission` in the route at `/cl/compliance-report`).

## Before you start

* You must hold the `cl.compliance_report.view` permission.
* Data is returned by the `cl_part2_compliance_stats` database RPC; if the RPC is unavailable or returns an error, an error card is displayed.

## Steps

<Steps>
  <Step title="Open the Compliance Report screen">
    Navigate to `/cl/compliance-report`. A skeleton of five metric cards is shown while the `cl_part2_compliance_stats` RPC is called.
  </Step>

  <Step title="Review the five aggregate metrics">
    The five cards display: SUD Charts, Active Consents, Consent Coverage (%), Disclosures, and Redisclosures. All values are organization-scoped aggregate counts — no patient identifiers are shown.
  </Step>

  <Step title="Review the About This Report card">
    A text card below the metrics describes the aggregate-only nature of the data and the organization scoping of the results.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Aggregate-only design">
    The component comment and the "About This Report" card both state that no patient identifiers are displayed. The RPC `cl_part2_compliance_stats` returns only aggregate counts. This design is described as consistent with 42 CFR Part 2 requirements — SME should confirm.
  </Accordion>

  <Accordion title="Error state">
    If `useComplianceStats` returns an error, the metric cards are replaced with a single card showing "Unable to load compliance statistics. Please try again later."
  </Accordion>

  <Accordion title="Zero-value defaults">
    If the RPC returns no rows, all five metrics default to zero (`sudChartCount: 0, activeConsentCount: 0, consentCoveragePct: 0, disclosureCount: 0, redisclosureCount: 0`).
  </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/Part2ComplianceDashboardPage.tsx
  * src/cores/cl/hooks/useComplianceStats.ts
</Accordion>
