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

# Electronic Consents

> Capture, view, and revoke electronic patient consents and audit redisclosures at route /cl/electronic-consents.

The Electronic Consents screen (`/cl/electronic-consents`) provides a two-tab interface for managing patient consent records and auditing redisclosure events within the organization.

## Overview

The page has two tabs controlled by URL state (`?tab=`): **Consents** and **Redisclosure Audit**. The Consents tab displays a filterable table of records from the `cl_electronic_consents` table, showing patient ID, status badge, effective date, expiration date with proximity badges (`≤7 days`, `≤14 days`), and granted consent categories. The Redisclosure Audit tab shows records from the redisclosure log, filtered by recipient or purpose text. Users with `cl.electronic-consent.create` permission see a **Capture Consent** button that opens a `ConsentCaptureSheet`; users with `cl.electronic-consent.revoke` can revoke active consents via a `RevokeConsentDialog`. Users with `cl.redisclosure-log.create` can record new disclosures via a `RecordDisclosureSheet`.

## Who it's for

Requires permission `cl.electronic-consent.view` (to see the Consents tab) or `cl.redisclosure-log.view` (to see the Redisclosure Audit tab). Additional actions gate on `cl.electronic-consent.create`, `cl.electronic-consent.revoke`, and `cl.redisclosure-log.create`.

## Before you start

* You must hold at minimum `cl.electronic-consent.view` or `cl.redisclosure-log.view`.
* An organization must be selected; the hook will not fetch without a current `organization_id`.

## Steps

<Steps>
  <Step title="Navigate to Electronic Consents">
    Open `/cl/electronic-consents`. The **Consents** tab loads by default; switch to **Redisclosure Audit** via the tab bar or by appending `?tab=redisclosure` to the URL.
  </Step>

  <Step title="Filter the consent list">
    Use the **All statuses** dropdown (options: Draft, Active, Expired, Revoked) and the **Expiration window** dropdown (Within 7, 14, or 30 days) to narrow the list. The expiration-window filter is applied client-side after the Supabase query returns.
  </Step>

  <Step title="Capture a new consent (if permitted)">
    Click **Capture Consent** to open the `ConsentCaptureSheet`. Complete the sheet and submit; the list refreshes automatically.
  </Step>

  <Step title="Revoke an active consent (if permitted)">
    Locate an **Active** row and click the revoke icon (XCircle). Confirm in the `RevokeConsentDialog`. Only rows with `status = active` show the revoke button.
  </Step>

  <Step title="Record a redisclosure">
    Switch to the **Redisclosure Audit** tab. Click **Record Disclosure** to open the `RecordDisclosureSheet`. Entries appear in the table with recipient, purpose, timestamp, and linked consent ID (first 8 characters shown).
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Consent statuses">
    The `status` field on `cl_electronic_consents` takes one of four values visible in the filter: `draft`, `active`, `expired`, `revoked`. Badge variants differ: active = default, revoked = destructive, expired = secondary, draft = outline.
  </Accordion>

  <Accordion title="Expiration proximity badges">
    An `ExpirationBadge` appears beside the expiration date when `getExpirationStatus()` returns `urgent` (≤7 days, destructive) or `warning` (≤14 days, secondary). No badge renders when status is `ok` or the date is null.
  </Accordion>

  <Accordion title="Empty state — no consents">
    When no records match the current filters, the table shows "No electronic consents yet." Users with `cl.electronic-consent.create` see an inline **Capture Consent** action in the empty state.
  </Accordion>

  <Accordion title="Empty state — no redisclosures">
    When the redisclosure log is empty for the current filters, the table shows "No redisclosures recorded for this filter."
  </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/ElectronicConsentPage.tsx
  * src/cores/cl/hooks/useElectronicConsentList.ts
</Accordion>
