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

# Healthcare Workflow Patterns Library — Integration

> Document how FW-57 extends existing Forms & Workflow infrastructure without new cross-core contracts in MVP.

**Status:** 📝 Planned\
**Spec:** `specs/fw/specs/FW-57-healthcare-workflow-patterns-library.md`\
**Last Updated:** 2026-03-22

***

## Purpose

Document how FW-57 extends existing Forms & Workflow infrastructure without new cross-core contracts in MVP.

***

## Platform Dependencies

| Component     | Role                                                               |
| ------------- | ------------------------------------------------------------------ |
| FW-28         | `fw_workflow_templates`; marketplace visibility; instantiation     |
| FW-06         | Workflow definition persistence; builder UI hooks for locked nodes |
| FW-43         | Audit events for template use and saves                            |
| FW-35         | SLA bindings on catalog nodes (where used)                         |
| FW-34 / FW-40 | Approval/quorum steps referenced by credentialing pattern          |
| PF-30         | `fw.healthcare_patterns.view`, `fw.healthcare_patterns.manage`     |

***

## Event Contracts (MVP)

**None required.** Reuse existing FW/FW-43 audit mechanisms. If a future release emits `fw.healthcare_pattern.instantiated` for analytics, add to `EVENT_CONTRACTS.md` and `KnownEventName`.

***

## API / RPC (Implementation)

| Area           | Contract                                                                                                                                  |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Workflow save  | Same endpoints as FW-06; add server-side `validateRequiredNodes` before commit                                                            |
| Regulatory log | Supabase client CRUD on `fw_regulatory_change_log` with RLS (no new edge function required for MVP unless product standardizes mutations) |

***

## Data Flow

1. **Catalog read:** Authenticated user queries `fw_workflow_templates` with `pattern_category IS NOT NULL` and marketplace visibility per existing RLS.
2. **Instantiate:** FW-28 copy path creates org workflow; copy or link `required_node_ids` / `source_template_id` per Clarification C-5.
3. **Save graph:** Validation layer ensures required node IDs remain.

***

## Security & Tenancy

* Change log rows are **org-scoped** (`organization_id`).
* Marketplace templates remain readable cross-tenant per existing FW-28 SELECT policy.
* Mutations to catalog seeds: service role or dedicated migration only (not end-user).

***

## Testing Notes

* RLS tests for `fw_regulatory_change_log` (see spec Testing Strategy).
* Integration test: save with missing required node → structured error.

***

## Related Documents

* [CROSS\_CORE\_INTEGRATIONS.md](/architecture/integrations/CROSS_CORE_INTEGRATIONS) — FW section
* [CONTRACT\_VALIDATION\_CHECKLIST.md](/architecture/integrations/CONTRACT_VALIDATION_CHECKLIST)
