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

# Follow-Ups

> Track, view, log contacts, and manage post-discharge follow-up schedules across the organization by overdue, upcoming, and completed status.

The Follow-Ups page lists all post-discharge follow-up schedules for the organization, tabbed by overdue, upcoming, and completed status, with search and status filter controls. Route: `/rh/follow-ups`

## Overview

The page uses `useFollowUpSchedulesDue(30)` to load schedules due within the next 30 days, along with already-overdue and completed records for the organization. Results are then filtered client-side by the search input and status dropdown.

The page is divided into three tabs:

| Tab           | Schedules shown                                                                                                    |
| ------------- | ------------------------------------------------------------------------------------------------------------------ |
| **Overdue**   | Status is not `completed` and `scheduled_date` is in the past. A red count badge appears when overdue items exist. |
| **Upcoming**  | Status is not `completed` and `scheduled_date` is today or in the future.                                          |
| **Completed** | Status is `completed`.                                                                                             |

Each tab renders a `FollowUpSchedulesTable`. Clicking a row navigates to `/rh/follow-ups/:id`.

Search matches against the `timepoint` and `notes` fields (case-insensitive). The status filter allows narrowing by: `scheduled`, `in_progress`, `completed`, or `cancelled`.

## Who it's for

Requires the `rh.dashboard.view` permission (applied to all RH routes via `RHViewGuard`). No additional inner permission gate exists on this route.

## Before you start

* Follow-up schedules are created from within episode discharge planning. If no schedules appear, confirm that discharge planning has been completed for the relevant episodes.
* Use the **Overdue** tab as the primary triage view for schedules requiring immediate action.

## Steps

<Steps>
  <Step title="Open Follow-Ups">
    Navigate to **Recovery Housing → Follow-Ups** (`/rh/follow-ups`). The page opens on the **Overdue** tab by default.
  </Step>

  <Step title="Triage overdue schedules">
    Review the **Overdue** tab. The red badge on the tab label indicates the count of schedules past their scheduled date that are not yet completed.
  </Step>

  <Step title="Filter by status or search">
    Use the **search input** (searches timepoint and notes text) or the **status dropdown** to narrow the list across any tab.
  </Step>

  <Step title="Switch to Upcoming or Completed tabs">
    Click **Upcoming** to see schedules not yet due, or **Completed** to review finished follow-ups.
  </Step>

  <Step title="Open a schedule record">
    Click any row to navigate to the Follow-Up Details page at `/rh/follow-ups/<id>` where you can log a contact or edit the schedule.
  </Step>
</Steps>

## Key concepts

* **Follow-up schedule** — a record in `rh_follow_up_schedules` that defines a planned post-discharge contact point for a resident episode.
* **Timepoint** — a label on the schedule indicating the stage after discharge (e.g., `30_day`). Searchable in the filter bar.
* **Overdue** — a schedule whose `scheduled_date` is in the past and whose status is not `completed` or `cancelled`.
* **Status filter** — filters across `scheduled`, `in_progress`, `completed`, and `cancelled` values.

## Viewing a follow-up

The Follow-Up Details page displays a single post-discharge follow-up schedule record, its contact history, and provides controls to edit the schedule or log a new contact attempt. Route: `/rh/follow-ups/:id`

The page resolves the follow-up schedule by matching the `id` URL parameter against the list returned by `useFollowUpSchedules`. It then loads contact history for that schedule via `useFollowUpContacts`.

Two cards are displayed side by side on medium-and-wider viewports:

| Card                 | Content                                                                         |
| -------------------- | ------------------------------------------------------------------------------- |
| **Schedule Details** | Scheduled date, timepoint, status badge, latest contact outcome (if any), notes |
| **Contact History**  | Table of contact attempts: date, method, result                                 |

Action controls:

* **Edit** — opens `FollowUpScheduleDialog` to update scheduled date, timepoint, or notes.
* **Log Contact** — opens `FollowUpContactDialog` to record a new contact attempt. This button is hidden when the schedule status is `completed`.

The page breadcrumb label is set to the formatted scheduled date.

Requires `rh.dashboard.view` (applied to all RH routes via `RHViewGuard`). Navigate here from the Follow-Ups list by clicking a row. Ensure the follow-up schedule was created for the correct episode before logging contacts.

<Steps>
  <Step title="Open the follow-up record">
    From **Recovery Housing → Follow-Ups** (`/rh/follow-ups`), click a row to navigate to `/rh/follow-ups/<id>`.
  </Step>

  <Step title="Review schedule details">
    The **Schedule Details** card shows the scheduled date, timepoint, current status, and any notes. If a contact has been logged, the latest outcome is also displayed.
  </Step>

  <Step title="Review contact history">
    The **Contact History** card lists all previously logged contact attempts with their date, method, and result.
  </Step>

  <Step title="Log a new contact attempt">
    Click **Log Contact** to open the contact dialog. Enter the contact date, method, and result, then save. The button is hidden if the schedule is already completed.
  </Step>

  <Step title="Edit the schedule">
    Click **Edit** to update the scheduled date, timepoint, or notes via the `FollowUpScheduleDialog`.
  </Step>
</Steps>

### Key concepts

* **Follow-up schedule** — a record in `rh_follow_up_schedules` that defines when a post-discharge contact should occur for a given episode.
* **Timepoint** — a label indicating the stage after discharge at which this follow-up is scheduled (e.g., `30_day`, `90_day`).
* **Contact attempt** — a record in `rh_follow_up_contacts` logging the date, method, and result of an actual outreach attempt against a schedule.
* **Contact method** — the channel used for outreach (stored in `contact_method`; displayed with underscores replaced by spaces).
* **Contact result** — the outcome of a contact attempt (stored in `contact_result`).

## Related

<Columns cols={2}>
  <Card title="Recovery Housing" icon="house" href="/rh/references" />

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index" />
</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/rh.tsx
  * src/cores/rh/pages/discharge/FollowUpsPage.tsx
  * src/cores/rh/pages/discharge/FollowUpDetailPage.tsx
  * src/cores/rh/hooks/discharge/useFollowUpSchedules.ts
  * src/cores/rh/hooks/discharge/useFollowUpContacts.ts
</Accordion>
