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

# Programs & Phases (120-Day Model) — Integration

> Version: 1.0.0 Last Updated: 2026-05-08 Spec: RH-02 Programs & Phases Constitution Reference: Section 1.2 (Core Independence), Section 1.3 (Integration Pattern…

**Version:** 1.0.0\
**Last Updated:** 2026-05-08\
**Spec:** [RH-02 Programs & Phases](../../../specs/rh/specs/RH-02-programs-phases.md)\
**Constitution Reference:** Section 1.2 (Core Independence), Section 1.3 (Integration Patterns)

***

## Overview

RH-02 owns recovery-program definitions, phase lifecycle progression, milestone gating, and phase-specific privilege rules. It publishes progression/milestone/completion events and consumes platform capabilities for notifications and forms.

***

## Integration Points

### Platform Foundation (PF) Dependencies

**Required PF Features:**

* **PF-08 (Forms Integration):** intake/assessment/exit form linkage at program level
* **PF-10 (Notifications):** phase progression and milestone notification delivery

**Integration Type:** Platform Integration Layer (Pattern 1)

### Consumer Core Dependencies (Downstream)

**Internal RH dependencies:**

* **RH-01:** episode lifecycle records required for enrollment/progression
* **RH-03:** significant events can trigger regression decisions
* **RH-04:** attendance/curfew outcomes influence progression readiness
* **RH-05:** discharge planning consumes program/phase completion outcomes

**Cross-core dependency:**

* **FA:** consumes `program_completed` event for downstream billing/financial workflows

### RBAC Dependencies (PF-02)

RH-02 role expectations:

* `rh_program_manager`: define programs/phases/privileges/milestones
* `rh_house_manager`: approve progression/regression decisions
* `rh_housing_tech`: record milestone completion events

RLS and permission checks are enforced via RH helper functions and PF role assignments.

***

## Event Contracts

### Event: `phase_progressed`

**Publisher:** RH (RH-02)\
**Subscribers:** PF-10\
**Status:** 📝 Planned

**Purpose:** Notify on phase lifecycle transitions for resident communication and operational awareness.

```typescript theme={null}
interface RhPhaseProgressedPayload {
  event_type: 'phase_progressed';
  organization_id: uuid;
  episode_id: uuid;
  resident_profile_id: uuid;
  old_phase: 'PHASE1' | 'PHASE2' | 'PHASE3' | 'EXTENSION';
  new_phase: 'PHASE1' | 'PHASE2' | 'PHASE3' | 'EXTENSION';
  progression_type: 'automatic' | 'manual' | 'regression';
  progression_date: timestamp;
  timestamp: timestamptz;
}
```

### Event: `milestone_completed`

**Publisher:** RH (RH-02)\
**Subscribers:** PF-10\
**Status:** 📝 Planned

**Purpose:** Trigger celebration/reminder notifications and progression workflow updates.

```typescript theme={null}
interface RhMilestoneCompletedPayload {
  event_type: 'milestone_completed';
  organization_id: uuid;
  episode_id: uuid;
  milestone_id: uuid;
  milestone_name: string;
  completed_date: timestamp;
  verified_by: uuid;
  timestamp: timestamptz;
}
```

### Event: `program_completed`

**Publisher:** RH (RH-02)\
**Subscribers:** FA, PF-10\
**Status:** 📝 Planned

**Purpose:** Notify finance and operations when program lifecycle is complete.

```typescript theme={null}
interface RhProgramCompletedPayload {
  event_type: 'program_completed';
  organization_id: uuid;
  episode_id: uuid;
  program_id: uuid;
  completion_date: timestamp;
  completion_type: 'normal' | 'early' | 'extension';
  timestamp: timestamptz;
}
```

***

## Security Considerations

### Multi-Tenancy

* All RH-02 entities are organization-scoped with RLS-enabled access.
* Cross-tenant reads/writes are blocked by policy and tested in RLS suites.

### PHI/PII and Auditability

* Event payloads use identifiers and lifecycle metadata only (no unnecessary PHI fields).
* Progression/regression/milestone actions must retain actor and timestamp in auditable records.

### Role-Gated Operations

* Progression/regression requires elevated RH manager roles.
* Milestone completion requires role-appropriate write permissions.

***

## Testing Requirements

* [ ] Event payload structure validation for all three RH-02 events
* [ ] Trigger condition verification (progression, milestone completion, program completion)
* [ ] `organization_id` inclusion and tenant isolation checks
* [ ] Subscriber compatibility checks for PF-10 and FA
* [ ] RLS policy tests for RH-02 tables and role-sensitive actions

***

## References

* [RH-02 Spec](../../../specs/rh/specs/RH-02-programs-phases.md)
* [CROSS\_CORE\_INTEGRATIONS.md](./CROSS_CORE_INTEGRATIONS.md)
* [EVENT\_CONTRACTS.md](./EVENT_CONTRACTS.md)
