Overview
CL-39 implements 5 core platform hooks that provide cross-core data access without direct CL↔PM imports per constitution §1.3. CL-41 adds billing override composition (useBillingOverrides, applyBillingOverrides, useBillingWithOverrides) that reads pm_billing_suggestion_rules and layers on top of useBillingAdapter—listed in the table below for a single integration view (6 hook rows total: five CL-39 + CL-41 composition).
Platform Layer Usage
@/platform/clinical— Barrel export fromsrc/platform/clinical/index.ts@/platform/scheduling— Barrel export fromsrc/platform/scheduling/index.ts@/platform/types— Shared types:PatientContext,EncounterContextHookRow,BillingInput,BillingSuggestion,DocumentExportRequest,DocumentExportResult
Integration Points
Data Sources (Read)
Dependencies
Event Contracts
No new events published or consumed. CL-39 hooks are synchronous React Query hooks.API Contracts
No edge functions or REST APIs. All hooks are client-side React Query integrations.Security
- All DB-backed hooks enforce RLS via Supabase client (no service-role keys from browser)
- PHI (demographics, diagnoses, risk level) accessed only through
usePatientContext; never logged as raw field values - Export signed URLs: 15-minute TTL (
EXPORT_URL_TTL_MINUTES) - Error sanitization:
sanitizeErrorMessageon all error paths - Consent gate:
useConsentCheck(CL-11) enforced before any export
Contract Validation Checklist
- All CL-39 hooks (and CL-41 override hooks where in scope) exported from barrel files
- Shared types in
@/platform/types(no duplication in cores) -
npm run check-architecturepasses (0 cross-core violations) - RLS cross-org isolation verified (
npm run test:rls) - Billing adapter unit tests cover all CPT mapping scenarios
- Export audit log written to
cl_data_exchange_log