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

# Clinical Document Architecture (CDA) Generation — Integration Doc

> Spec: specs/cl/specs/CL-48-clinical-document-architecture-cda.md Status: 📝 Stub — expand after Phase 1 Created: 2026-05-10

**Spec:** `specs/cl/specs/CL-48-clinical-document-architecture-cda.md`\
**Status:** 📝 Stub — expand after Phase 1\
**Created:** 2026-05-10

***

## Integration Points

### Platform Foundation

| PF Spec | Integration Type           | What CL-48 Uses                             |
| ------- | -------------------------- | ------------------------------------------- |
| PF-01   | Direct dependency          | Organization context for tenant isolation   |
| PF-10   | Platform Integration Layer | Transmission failure/delivery notifications |
| PF-11   | Platform Integration Layer | CDA XML archival in `pf-documents` bucket   |
| PF-30   | Direct dependency          | Permission-gated access (`cl.cda.*`)        |

### CL Internal

| CL Spec | Relationship                         | Detail                                                                           |
| ------- | ------------------------------------ | -------------------------------------------------------------------------------- |
| CL-11   | Consumer                             | Part 2 consent enforcement via `cl_has_sud_consent(chart_id)`                    |
| CL-45   | Consumer                             | Reuses `buildCcdaAllergySection()` and `generateRedisclosureNotice()`            |
| CL-20   | Peer                                 | Shared clinical data assembly patterns (PDF export vs XML generation)            |
| CL-16   | Extends (C-CDA generation carve-out) | Logs transmissions to `cl_data_exchange_log`; C-CDA ingestion remains with CL-16 |

***

## Event Contracts

### Published Events

| Event Name                           | Payload                                                                            | Subscribers           | Status     |
| ------------------------------------ | ---------------------------------------------------------------------------------- | --------------------- | ---------- |
| `cl_cda_document_generated`          | `{ document_id, patient_id, document_type, contains_part2_data, organization_id }` | CL-25 Audit Dashboard | 📝 Planned |
| `cl_cda_transmission_status_changed` | `{ document_id, old_status, new_status, recipient_endpoint_id, organization_id }`  | PF-10 Notifications   | 📝 Planned |

### Consumed Events

None — CL-48 does not consume events from other specs.

***

## API / Edge Function Contracts

### `transmit-cda-document` (Edge Function)

* **Method:** POST
* **Auth:** Service-role or authenticated user with `cl.cda.transmit`
* **Request:** `{ document_id: string }`
* **Response:** `{ success: boolean, status: string, error?: string }`
* **HISP Adapter:** Abstracted behind interface for testability; mock mode available.

***

## Pending Items

* [ ] Expand event contract details after Phase 1
* [ ] Document HISP adapter interface after Phase 3
* [ ] Update `CROSS_CORE_INTEGRATIONS.md` row from placeholder to full contract

***

**Last Updated:** 2026-05-10
