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

# Integration Notes

> Feature ID: CL-02-EN-60 Core: CL Status: ✅ Complete Last Updated: 2026-04-03

**Feature ID:** CL-02-EN-60\
**Core:** CL\
**Status:** ✅ Complete\
**Last Updated:** 2026-04-03

## Summary

CL-02-EN-60 replaces Arizona-specific intake assessment requirement checks with jurisdiction-profile-driven logic while preserving Arizona baseline behavior. This includes renaming TypeScript constants (`AHCCCS_SECTION_CODES` → `INTAKE_SECTION_CODES`), creating a generic SQL function (`cl_check_intake_elements`), and wiring UI components to read required elements from PF-96 jurisdiction profiles.

## Integration Pattern

* Pattern: Platform dependency through PF-96 jurisdiction profiles.
* CL consumes `useClinicalRules()` from `@/platform/jurisdiction` (convenience hook over `useJurisdictionProfile`).
* No direct core-to-core imports.
* No new external API contracts.
* No new events published or consumed.

## Upstream Dependencies

| Dependency                | Type                                      | Usage                                                                                       |
| ------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------- |
| PF-96                     | Platform configuration/profile resolution | Source of `clinical.assessment_required_elements` via `pf_resolve_jurisdiction_profile` RPC |
| PF-96 migration plan (A2) | Migration guidance                        | Generic function pattern (`cl_check_intake_elements`)                                       |
| PF-96 migration plan (B1) | Migration guidance                        | TypeScript constant rename (`AHCCCS_SECTION_CODES` → `INTAKE_SECTION_CODES`)                |

## Downstream Consumers

| Consumer                   | Impact                                                                                                             |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| CL-02 `AssessmentForm.tsx` | Uses `useClinicalRules().assessment_required_elements` for section rendering; falls back to `INTAKE_SECTION_CODES` |
| CL-40 intake workflow      | Reads `intake_element_complete` column (trigger-maintained) for completeness status                                |
| CL-25 audit dashboard      | Consumes `intake_element_complete` for compliance reporting (no code change needed)                                |
| Tests (unit/integration)   | Updated to use `INTAKE_SECTION_CODES` naming                                                                       |

## Data Changes

| Change            | Table/Function                                     | Details                                                           |
| ----------------- | -------------------------------------------------- | ----------------------------------------------------------------- |
| New function      | `cl_check_intake_elements(UUID, JSONB)`            | Generic completeness checker; `SECURITY DEFINER`                  |
| Updated function  | `cl_check_ahcccs_18_elements(UUID)`                | Now wraps `cl_check_intake_elements` with AZ defaults; deprecated |
| New column        | `cl_intake_assessments.intake_element_complete`    | Trigger-maintained BOOLEAN                                        |
| Deprecated column | `cl_intake_assessments.ahcccs_18_element_complete` | Retained during dual-read; to be dropped later                    |
| New trigger       | `trg_cl_intake_element_complete`                   | Fires on INSERT/UPDATE; evaluates completeness                    |

## Security Notes

* Organization-scoped profile resolution required for all lookups.
* `cl_check_intake_elements` uses `SECURITY DEFINER` with `SET search_path = public`.
* Existing RLS and tenant isolation patterns remain in force on `cl_intake_assessments`.
* No PHI is transmitted to AI systems for profile resolution.
* Profile data is non-PHI (jurisdiction configuration metadata only).

## Events and APIs

* Events published: None.
* Events consumed: None.
* API contracts changed: Yes — `cl_check_intake_elements` and `cl_check_ahcccs_18_elements` RPCs added/updated.
* RPC functions added:
  * `cl_check_intake_elements(UUID, JSONB)` — Generic intake element completeness checker (see [API\_CONTRACTS.md](../../../docs/architecture/integrations/API_CONTRACTS.md#cl-02-en-60-intake-element-completeness-checker-rpc))
  * `cl_check_ahcccs_18_elements(UUID)` — Legacy wrapper (DEPRECATED); updated to call generic function

**See also:**

* [API\_CONTRACTS.md — CL-02-EN-60 RPC contract](../../../docs/architecture/integrations/API_CONTRACTS.md#cl-02-en-60-intake-element-completeness-checker-rpc) for detailed contract specification
* [PLATFORM\_INTEGRATION\_LAYERS.md — PF-96](../../../docs/architecture/integrations/PLATFORM_INTEGRATION_LAYERS.md) for jurisdiction profile integration layer
* [EVENT\_CONTRACTS.md](../../../docs/architecture/integrations/EVENT_CONTRACTS.md) for event patterns

## Validation Checklist

* [ ] Arizona 18-element parity verified (legacy wrapper output matches generic function with AZ fixture).
* [ ] At least one non-Arizona profile test fixture verified.
* [ ] Existing CL-02 and CL-40 regression suites pass.
* [ ] `rg 'AHCCCS_SECTION_CODES' src/` returns zero results (excluding deprecated alias).
* [ ] `npm run validate` passes clean.
* [ ] Profile lookup adds \<50ms to form load p95.
