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

# Discharge

> Manage discharge planning, aftercare follow-ups, and HEDIS FUH/FUM compliance tracking via a tabbed hub screen.

The Discharge screen is a tabbed hub for discharge and aftercare planning at route `/cl/discharge`.

## Overview

The Discharge Hub is a tabbed page with two tabs: **Overview** and **HEDIS Follow-Up**. The tab selection is persisted in the URL via `useTabUrlState` (query param `tab`). The HEDIS Follow-Up tab badge displays a count of open (non-met) denominator events from `useHedisOpenCount`, which queries `cl_aftercare_plans` for records where `hedis_fuh_denominator` or `hedis_fum_denominator` is true and the derived overall status is not `met`. The Overview tab currently shows three summary cards — Aftercare Plans, Warm Handoffs, and Follow-Up Contacts (7-day and 30-day) — all displaying a placeholder `—` value; the code comments direct users to the HEDIS Follow-Up tab for compliance details. The HEDIS Follow-Up tab is rendered by `HedisFollowUpTab`, which uses `useHedisWorklist` to fetch aftercare plans with follow-up contact records from `cl_aftercare_plans` and `cl_follow_up_contacts`.

## Who it's for

Requires permission `cl.hedis-tracking.view`.

## Before you start

You must hold the `cl.hedis-tracking.view` permission. The entire page, including the Overview tab, is wrapped in a `PermissionGate` for this permission.

## Steps

<Steps>
  <Step title="Open the Discharge Hub">
    Navigate to `/cl/discharge`. The page defaults to the Overview tab. A badge on the HEDIS Follow-Up tab indicates the count of open denominator events, if any.
  </Step>

  <Step title="Review the Overview tab">
    The Overview tab displays three summary cards: Aftercare Plans, Warm Handoffs, and Follow-Up Contacts. These cards currently show `—` as placeholder values. For compliance details, proceed to the HEDIS Follow-Up tab.
  </Step>

  <Step title="Switch to the HEDIS Follow-Up tab">
    Click the "HEDIS Follow-Up" tab (or navigate to `/cl/discharge?tab=hedis-follow-up`). The `HedisFollowUpTab` renders the worklist of aftercare plans that are in a HEDIS denominator.
  </Step>

  <Step title="Filter the worklist (optional)">
    Use the measure filter (`all`, `fuh`, `fum`) and status filter (`all`, `met`, `pending`, `overdue`) available in `useHedisWorklist` to narrow the displayed plans. The status filter is applied client-side after the server query.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="HEDIS denominator and numerator flags">
    The `cl_aftercare_plans` table stores boolean flags: `hedis_fuh_denominator`, `hedis_fum_denominator`, `hedis_fuh_numerator_7`, `hedis_fuh_numerator_30`, `hedis_fum_numerator_7`, `hedis_fum_numerator_30`. The `getNumeratorStatus` utility derives a status of `met`, `pending`, or `overdue` based on whether the numerator flag is true and the time elapsed since `plan_date` relative to `HEDIS_FOLLOW_UP_WINDOWS` (7-day and 30-day).
  </Accordion>

  <Accordion title="Tab URL state">
    The active tab is stored in the `tab` URL query parameter via `useTabUrlState`. Valid values are `overview` and `hedis-follow-up`. Navigating directly to `/cl/discharge?tab=hedis-follow-up` opens the HEDIS worklist tab directly.
  </Accordion>

  <Accordion title="Open count badge">
    The HEDIS Follow-Up tab badge is driven by `useHedisOpenCount`, which counts aftercare plans in any denominator whose derived status is not `met`. This count is fetched independently of the worklist to keep the badge lightweight.
  </Accordion>

  <Accordion title="Follow-up contacts">
    The worklist fetches `cl_follow_up_contacts` records (soft-delete filtered) grouped by `aftercare_plan_id` and joined in memory with their parent aftercare plans.
  </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/DischargeHubPage.tsx
  * src/cores/cl/hooks/useHedisWorklist.ts
</Accordion>
