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

# Housing Settings

> Configure Recovery Housing module settings including stay durations, program phases, compliance thresholds, and integrations. Requires settings admin.

The `/rh/settings` route renders `RHSettingsPage`, which loads and saves the organization's RH module settings from the `rh_module_settings` table via the `useRHModuleSettings` hook.

## Overview

The route `/rh/settings` is protected by `RH_PERMISSIONS.SETTINGS_ADMIN` (`rh.settings.admin`) inside the outer `RHViewGuard` (`rh.dashboard.view`). On load, `useRHModuleSettings` queries `rh_module_settings` filtered by `organization_id`; settings are seeded by migration and updated via an `UPDATE` mutation (no `INSERT` on read). The page renders `RHSettingsForm` with five tabs: **General**, **Phases**, **Compliance**, **Integrations**, and **Wizards**. A guided tour is available via the **Help** button; it can also be launched by appending `?tour=rh-settings-tour` to the URL. Changes are saved with the **Save** button and trigger a toast notification on success or failure.

## Who it's for

`RH_PERMISSIONS.SETTINGS_ADMIN` (`rh.settings.admin`), enforced by an inner `RequirePermission` wrapper. Users without this permission cannot access this route even if they hold `rh.dashboard.view`.

## Before you start

* Hold `rh.settings.admin` to access and save settings.
* Settings are per-organization. Ensure you are operating in the correct organization context.

## Steps

<Steps>
  <Step title="Open Housing Settings">
    Navigate to `/rh/settings`. The page loads your organization's current Recovery Housing configuration.
  </Step>

  <Step title="Configure general settings">
    On the **General** tab, set the **Default Stay Duration** (days) and **Discharge Planning Initiation** (days before discharge to start planning).
  </Step>

  <Step title="Configure program phase durations">
    On the **Phases** tab, set the expected duration (days) for each program phase (phases 1–4).
  </Step>

  <Step title="Configure compliance thresholds">
    On the **Compliance** tab, set license expiry warning lead time, minimum attendance percentage, curfew grace period, outcome follow-up intervals, and audit response time targets by severity.
  </Step>

  <Step title="Configure integrations">
    On the **Integrations** tab, toggle connections to the Finance & Revenue (FA) and Human Resources (HR) modules.
  </Step>

  <Step title="Configure wizards">
    On the **Wizards** tab, adjust wizard behavior settings.
  </Step>

  <Step title="Save changes">
    Click **Save** at the bottom of the form. A success toast confirms the settings were persisted; an error toast is shown if the update fails.
  </Step>
</Steps>

## Key concepts

| Setting                      | Field                                                   |
| ---------------------------- | ------------------------------------------------------- |
| Default stay duration        | `default_stay_duration_days` (1–365 days)               |
| Discharge planning lead time | `discharge_planning_initiation_days` (7–90 days)        |
| Phase durations              | `phase_1_duration_days` through `phase_4_duration_days` |
| Minimum attendance           | `minimum_attendance_percentage` (0–100%)                |
| Curfew grace period          | `curfew_grace_period_minutes` (0–60 min)                |
| FA integration               | `integrate_with_fa` (boolean)                           |
| HR integration               | `integrate_with_hr` (boolean)                           |

## Related

<Columns cols={2}>
  <Card title="Recovery Housing" icon="house" href="/rh/references">
    Recovery Housing references and overview.
  </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/rh.tsx
  * src/cores/rh/pages/RHSettingsPage.tsx
  * src/cores/rh/components/RHSettingsForm.tsx
  * src/cores/rh/hooks/useRHModuleSettings.ts
</Accordion>
