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

# OTP Programs

> Manage opioid treatment program billing configurations for your organization, including effective dates and billing frequency.

This page lists and manages OTP (Opioid Treatment Program) billing configurations for your organization at the route `/pm/otp-programs`.

## Overview

The OTP Programs page displays an org-scoped table of opioid treatment program billing configurations sourced from the `pm_otp_programs` table. Each program record includes a name, billing frequency, effective date range, and a derived status (Active or Expired). Status is computed in the browser: a program is **Active** when `effective_to` is null or in the future, and **Expired** when `effective_to` is a past date. Programs are sorted alphabetically by name. Users with the `pm.otp.manage` permission see an **Add Program** button; all other users with view access see the table in read-only mode.

## Who it's for

Requires permission `PM_PERMISSIONS.OTP_VIEW` (`pm.otp.view`), enforced via `RequirePermission` in `src/routes/pm.tsx`. Within the page, the **Add Program** action additionally requires `pm.otp.manage` (checked via `useHasPermission`).

## Before you start

* Your account must be assigned the `pm.otp.view` permission.
* At least one OTP program must exist in your organization for the table to be populated; otherwise an empty state is shown with an optional **Add Program** prompt (visible to users with `pm.otp.manage`).

## Steps

<Steps>
  <Step title="Navigate to OTP Programs">
    Go to **Practice Management → OTP Programs** (route `/pm/otp-programs`). The table loads all programs for the current organization, sorted by name.
  </Step>

  <Step title="Review program details">
    The table columns are: **Program Name**, **Frequency** (badge), **Effective From**, **Effective To** (displays "Ongoing" when null), and **Status** (Active / Expired badge).
  </Step>

  <Step title="Open a program for editing">
    Click any program name (rendered as a link button) to open the **OtpProgramDialog** in edit mode. Requires `pm.otp.manage`.
  </Step>

  <Step title="Add a new program">
    Click **Add Program** (visible only with `pm.otp.manage`) to open the dialog in create mode.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Active vs. Expired status">
    Status is derived client-side from `effective_to`: null or a future date = Active; a past date = Expired. There is no separate status field in `pm_otp_programs`.
  </Accordion>

  <Accordion title="Empty state">
    When no programs exist for the organization, an empty state is displayed with the message "No OTP programs yet — Create an OTP program to start managing MAT-specific billing." The Add Program action is shown only if the user holds `pm.otp.manage`.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Practice Management" icon="briefcase" href="/pm/overview">
    Overview of the Practice Management 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/pm.tsx
  * src/cores/pm/pages/OtpProgramsListPage.tsx
  * src/cores/pm/hooks/usePmOtpPrograms.ts
  * src/cores/pm/types/otp.ts
  * src/platform/permissions/constants.ts
</Accordion>
