Skip to main content

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.

Version: 2.1.0
Last Updated: 2026-03-23
Constitution Reference: Section 1.3 (Integration Patterns)
Note: This document consolidates content from the previous INTEGRATION_CONTRACTS.md (archived 2025-01-22). For detailed event and API contracts, see the specific contract files listed below.
This directory holds cross-core integration docs for the Encore Health OS Platform. Integrations should be documented here before implementation.

Status Legend

All integration documentation uses consistent status indicators:
  • Implemented - Fully implemented, tested, and production-ready
  • 🟡 In Progress - Partially implemented, actively being developed
  • 📝 Planned - Specified in specs but not yet implemented
  • Deprecated - No longer recommended, will be removed in future version
  • 🔄 Breaking Change - Recent breaking change, migration guide available
Last Verified Dates:
  • All implemented integrations include “Last Verified” date
  • Planned integrations include “Spec Reference” link
  • Breaking changes include migration guide link

Integration Doc Naming (Canonical)

Use CasePatternExample
Feature-specific (single core){CORE}-##-{feature-kebab-case}-INTEGRATION.mdCL-01-patient-chart-clinical-summary-INTEGRATION.md, HR-10-performance-management-INTEGRATION.md
Cross-core (two cores){CORE1}-{CORE2}-{feature-kebab-case}-INTEGRATION.mdCL-PM-ENCOUNTER-TO-BILLING.md, RH-HR-INTEGRATION.md
Core-wide contract bundle{CORE}_INTEGRATION_CONTRACTS.mdIT_INTEGRATION_CONTRACTS.md, HR_ATS_CONTRACTS.md
Use these patterns when creating new integration docs or when validate-spec / generate-tasks references integration doc paths. See specs/_templates/INTEGRATION_CONTRACT_TEMPLATE.md for the template. Maintenance and crosswalk: INTEGRATIONS_CROSSWALK.md (spec links, dedupe guidance, known gaps).

Bloat control for feature integration docs

For {CORE}-##-*-INTEGRATION.md files:
  • Keep them delta-focused (feature-specific integration details only).
  • Do not duplicate platform-wide rules that already live in PLATFORM_INTEGRATION_LAYERS.md, EVENT_CONTRACTS.md, or API_CONTRACTS.md.
  • Prefer links to canonical contract docs over repeated boilerplate sections.

Documentation Structure

Platform Integration Layers

Shared utilities in /src/platform/ that provide cross-core capabilities without violating architectural boundaries. Includes:
  • Forms Integration (PF-08)
  • Workforce Integration
  • Data Lookup (PF-15)
  • Custom Fields (PF-16)
  • Field Configuration (PF-17)
  • Notifications (PF-10)
  • Documents (PF-11)
  • Reports (PF-12)
  • AI Integration (PF-27)

LO Integration Contracts

Leadership OS entry point: lo_events, goals/event specs (LO-16), links to EVENT_CONTRACTS.md LO sections.

IT Integration Contracts

IT module event contracts, API contracts, and platform layer usage. Includes:
  • Asset lifecycle events (purchased, assigned, maintenance, disposed)
  • License management events (created, renewed, expiring, compliance)
  • Support ticketing events (created, status changed, SLA breached)
  • Security events (incident, vulnerability, patch overdue)
  • Procurement events (submitted, approved, received)
  • API contracts for asset/vendor lookup

Event Contracts

Asynchronous event-based integration patterns using PostgreSQL pg_notify and edge functions. Includes:
  • Event schema standards
  • Implemented events registry
  • Planned events registry
  • Event delivery mechanism
  • Event testing patterns

Event delivery guide

How to choose table-driven FW automation vs HTTP event-consumer vs realtime vs outbound webhooks (R-FW-12). Complements EVENT_CONTRACTS.md.

API Contracts

Synchronous request-response APIs for direct data queries between cores. Includes:
  • API contract standards
  • Implemented APIs
  • Planned APIs
  • Authentication and rate limiting
  • Error handling patterns

External Integrations

Catalog of external (out-of-platform) integrations: clearinghouse, payer ePA, PDMP, HIE, EPCS, lab. Status 📝 Planned until implemented. Includes:
  • Clearinghouse (X12 837/835/270-271/276-277)
  • Payer FHIR ePA (Da Vinci CRD/DTR/PAS)
  • Arizona CSPMP (PDMP), Contexture (HIE), EPCS/Surescripts, RTPB, Lab/LIS

Cross-Core Integrations

Integration matrix showing “who talks to whom” across all cores. Includes:
  • Integration matrix table
  • Integration by core (publisher/consumer)
  • Dependency graph
  • Quick reference guide

Data Models

Core data models and their integration points. Includes:
  • LO Core data model
  • Integration points per core
  • RLS security functions
  • Key design decisions

Source of Truth Precedence

For event names and schemas, the order of precedence is:
  1. Database/Registry: fw_workflow_events table (definitive registry)
  2. TypeScript Types: KnownEventName in src/platform/events/types.ts (must match registry)
  3. Documentation: EVENT_CONTRACTS.md (narrative and payload schemas)
  4. Matrix: CROSS_CORE_INTEGRATIONS.md (cross-references)
For API contracts:
  1. Implementation: Edge functions and RPC functions (definitive)
  2. Documentation: API_CONTRACTS.md (schemas and usage)
  3. Feature Docs: {CORE}-##-*-INTEGRATION.md (detailed contracts)

Integration Patterns Overview

The platform supports three integration patterns (Constitution Section 1.3):
  1. Pattern 1: Platform Integration Layer - Shared utilities in /src/platform/
  2. Pattern 2: Event-Based Integration - Async workflows via domain events
  3. Pattern 3: API Contracts - Synchronous request-response with versioned schemas
Prohibited: Direct imports between cores (e.g., import { x } from '@/cores/fa/...' inside RH) Cross-Core FK Exception: By default, cross-core references use UUID columns with no database FK. A scoped exception allows CL tables to reference pm_encounters.id via FK with ON DELETE RESTRICT. See ADR-002 and constitution §1.2, §5.2.7.

Quick Reference

When to Use Each Pattern

Use Platform Integration Layer when:
  • Multiple cores need the same functionality
  • You need reusable UI components or hooks
  • The functionality is domain-agnostic
  • Examples: Forms, Workforce, Data Lookup, Custom Fields
Use Event-Based Integration when:
  • You need loose coupling between cores
  • Workflows are asynchronous
  • You want audit trails of state changes
  • Examples: Resident admission → Billing account creation
Use API Contracts when:
  • You need synchronous request-response
  • Real-time data queries are required
  • Event-driven patterns are not suitable
  • Examples: Episode balance queries, Employee lookups

Integration Checklist

Before implementing a new integration:
  • Integration pattern chosen (Pattern 1, 2, or 3)
  • Contract documented in appropriate file
  • Schema defined (TypeScript types or JSON Schema)
  • Versioning strategy defined
  • RLS policies verified for tenant isolation
  • Integration tests written
  • Documentation updated
  • Breaking changes approved (if applicable)

Versioning Strategy

Breaking Changes

Breaking changes to integration contracts MUST:
  1. Be documented with version bump
  2. Include migration guide for consumers
  3. Maintain backward compatibility for 90 days minimum
  4. Require explicit approval from technical owner

Version Format

  • Platform Integration Layer: Semantic versioning (e.g., v1.0.0 → v2.0.0)
  • Event Schemas: Version in payload metadata (e.g., event_version: '1.0')
  • API Contracts: Version in URL path (e.g., /api/v1/fa/resident-balance)

Testing Requirements

All integrations MUST have:
  1. Unit Tests: Mock integration points
  2. Integration Tests: Test actual event/API flow
  3. RLS Tests: Verify tenant isolation
  4. E2E Tests: Test complete cross-core workflows

Anti-Patterns

❌ DO NOT:

  1. Direct Core Imports:
    // ❌ WRONG
    import { BillingService } from '@/cores/fa/billing';
    
  2. Shared Database Tables:
    -- ❌ WRONG: Table owned by multiple cores
    CREATE TABLE shared_resident_billing (...);
    
  3. Hidden Dependencies:
    // ❌ WRONG: Implicit dependency
    function getResidentBalance(id: uuid) {
      return supabase.from('fa_transactions').select(...); // Hidden FA dependency
    }
    

✅ DO:

  1. Use Platform Integration Layer:
    // ✅ CORRECT
    import { FormEmbed } from '@/platform/forms';
    
  2. Publish Domain Events:
    // ✅ CORRECT
    await publishEvent('rh_resident_admitted', { ... });
    
  3. Explicit API Contracts:
    // ✅ CORRECT
    const balance = await faApi.getResidentBalance(residentId);
    

Audit & Enforcement

Use npm run audit:integration-contracts to verify that every spec under specs/{core}/specs/ is referenced in at least one canonical integration contract surface (or explicitly allowlisted as intra-core only).
npm run audit:integration-contracts          # exit 1 on uncovered specs
npm run audit:integration-contracts:warn     # warn-only (used by validate:governance)
npm run audit:integration-contracts:report   # write reports/integration-contracts-gaps.json
Allowlist: docs/architecture/integrations/.intra-core-only.json. Each entry MUST include id, rationale, owner, and added (ISO date). The allowlist is reviewed quarterly by the Architecture team; default disposition is to add a contract row, not allowlist. Resolution per gap: choose ONE of:
  1. Add a row to EVENT_CONTRACTS.md, API_CONTRACTS.md, PLATFORM_INTEGRATION_LAYERS.md, or CROSS_CORE_INTEGRATIONS.md.
  2. Append to a core bundle doc (IT_INTEGRATION_CONTRACTS.md, FM_INTEGRATION_CONTRACTS.md, LO-INTEGRATION-OVERVIEW.md, HR_ATS_CONTRACTS.md).
  3. Create a feature-specific {SPEC-ID}-{slug}-INTEGRATION.md.
  4. Add an entry to .intra-core-only.json with rationale (intra-core only with no cross-core surface).
CI calls the hard-fail variant via npm run validate:governance (promoted from warn-only on 2026-04-17 once the Q2 closure waves brought open gaps to 0; historical record archived at docs/archive/integrations/_GAP_TRIAGE_2026Q2.md).

Maintenance Guidelines

Review Cycle

  • Quarterly: Review all integration documentation for accuracy and re-run npm run audit:integration-contracts; fold any new gaps into next-sprint planning.
  • After each release: Verify implemented integrations match documentation
  • Before breaking changes: Update documentation and notify consumers

Update Triggers

  • New integration added
  • Spec change affecting integration
  • Breaking change to existing integration
  • Implementation status change (Planned → Implemented)

Ownership

  • Platform Integration Layers: Platform Foundation team
  • Event Contracts: Core teams (publisher owns documentation)
  • API Contracts: Core teams (provider owns documentation)
  • Cross-Core Matrix: Architecture team

Quality Checklist

  • Status indicators accurate (✅ Implemented / 📝 Planned)
  • Code examples use real, working code
  • All required fields documented
  • Links to related specs and implementation code
  • Last verified date included
  • Breaking changes documented


Cross-References

Platform Integration Layers: Event Contracts: RH Integration Contracts:
  • RH-01 Bed Board & Census Integration - Bed board, facility_type (recovery_housing | psychiatric_residential | inpatient_unit), census data for HR/PM, event payloads (resident_admitted, resident_discharged, bed_assigned, bed_released, invoice_creation_requested), CL current-residence API - Spec: RH-01, RH-01.1
IT Integration Contracts: FA Bank Feed Integrations: FA Spend / Card Integrations: HR External Integrations:
  • HR-20: Checkr Background Check Integration — superseded by HR-09-P5.2; see Spec: HR-20 📋 (archived: docs/archive/architecture/integrations/HR-20-checkr-background-check-INTEGRATION.md)
API Contracts: Integration Matrix: Code Examples:
Next Review: 2026-04-22 (Quarterly)