Skip to main content
Version: 1.0
Last Updated: 2026-03-07
Status: 📝 Planned
Spec Reference: GR-16-accreditation-tracer-readiness.md
Constitution Reference: Section 1.3 (Integration Patterns)

Overview

GR-16 integrates intra-core (GR) and with Platform Foundation (PF) layers. It does not integrate directly with any other non-PF core. All cross-core data is accessed via PF platform layers.

Integration Summary


Platform Layer Usage

PF-11 (Documents) — Tracer Pack Export

Layer: @/platform/documents
Purpose: Creates a document bundle for tracer pack export.
API:
Tenant Isolation: Enforced by PF-11 platform layer; passes organization_id.

PF-27 (Platform AI) — Surveyor Question Simulator

Layer: @/platform/ai
Purpose: Generates 3–5 likely surveyor questions for a given accreditation standard.
API:
PHI Guardrail: Do NOT pass patient-identifying data (names, DOBs, record IDs) to the AI prompt. Pass only standard metadata and evidence summary (counts, dates, domains).

PF-12 (Reporting) — Readiness Score Report

Layer: @/platform/reports
Purpose: Generates board-level readiness score report with trend data.
API:
Output: PDF/Excel report suitable for board meeting.

PF-10 (Notifications) — CAP Deadline Alerts

Layer: @/platform/notifications
Purpose: Sends deadline notifications to responsible_party_id and org admins.
Trigger: Edge function gr-cap-deadline-alerts (daily cron).
Notification payload (CAP due):
Notification payload (CAP overdue):

Edge Function Contract

gr-cap-deadline-alerts

Function: /supabase/functions/gr-cap-deadline-alerts/index.ts
Schedule: Daily at 08:00 UTC (0 8 * * *)
Invocation: Cron (server-to-server); verify_jwt: false
Auth: Service role key; no JWT verification (cron invocation only)
Processing logic:
  1. Load gr_module_settings.cap_alert_lead_days per org
  2. Query gr_accreditation_caps WHERE status <> 'verified_closed' AND target_closure_date <= now() + (cap_alert_lead_days || ' days')::INTERVAL
  3. For each CAP: send gr.cap.deadline_approaching notification via PF-10
  4. For overdue CAPs (target_closure_date < today): send gr.cap.overdue notification
  5. Log results; retry failed notifications up to 3 times
CORS: Uses getCorsHeaders(req.headers.get('origin')) from _shared/cors.ts
Logger: createLogger('gr-cap-deadline-alerts') from _shared/logger.ts

Intra-Core Data Dependencies (GR-08 Tables)

GR-16 reads from GR-08 tables via direct DB queries (same core, not cross-core): RLS: All reads use existing GR-08 RLS policies; no policy changes to GR-08 tables required.

Contract Validation Checklist

  • Integration doc exists at canonical path
  • All integration points from spec covered
  • PF-11 document bundle creation API documented with tenant isolation note
  • PF-27 AI prompt interface documented with PHI guardrail
  • PF-10 notification payloads defined
  • Edge function documented with verify_jwt, CORS, logger
  • Integration matrix updated in CROSS_CORE_INTEGRATIONS.md
  • Event types added to KnownEventName in src/platform/events/types.ts (if events published — N/A; GR-16 does not publish events)

Cross-Core Integration Matrix Entry

Add to docs/architecture/integrations/CROSS_CORE_INTEGRATIONS.md: