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

# Data Export & Compliance – Integration

> PF-44 provides a standardized data export and compliance framework. It depends on PF-04 (Audit Logging), PF-11 (Document Management), and PF-30 (Permissions).…

**Feature ID:** PF-44\
**Spec:** [PF-44-data-export-compliance](https://github.com/Encore-OS/encoreos/blob/development/specs/pf/specs/PF-44-data-export-compliance.md)\
**Status:** ✅ Implemented\
**Spec Reference:** [PF-44-data-export-compliance.md](https://github.com/Encore-OS/encoreos/blob/development/specs/pf/specs/PF-44-data-export-compliance.md)\
**Last Updated:** 2026-02-14

***

## Overview

PF-44 provides a standardized data export and compliance framework. It depends on PF-04 (Audit Logging), PF-11 (Document Management), and PF-30 (Permissions). Export events are published to PF-04 for compliance auditing.

***

## Dependencies

| Dependency                  | Type     | Status       | Purpose                                                                                    |
| --------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------ |
| PF-04 (Audit Logging)       | Platform | ✅ Integrated | All export requests and completions audited via `pf_audit_logs`                            |
| PF-11 (Document Management) | Platform | ✅ Integrated | Export files stored in Supabase Storage (`pf-exports` bucket)                              |
| PF-30 (Permissions)         | Platform | ✅ Integrated | Pages gated via `PermissionGate` (`pf.export_requests.view`, `pf.export_templates.manage`) |
| PF-12 (Reporting Engine)    | Platform | 🔄 Deferred  | Report generation logic for exports (can integrate when PF-12 matures)                     |
| PF-10 (Notifications)       | Platform | 🔄 Deferred  | Email notification on export completion                                                    |

***

## Event Contracts (PF-04)

PF-44 publishes the following audit events to `pf_audit_logs`:

| Event                          | Publisher              | Payload (abbreviated)                                                                                                                                           | PII/PHI note                                 |
| ------------------------------ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| **`export_request_completed`** | process-export edge fn | `organization_id`, `export_request_id`, `export_type`, `export_format`, `entity_types`, `row_count`, `file_size_bytes`, `execution_time_ms`, `pii_phi_filtered` | Filter criteria sanitized; no raw PII logged |
| **`export_request_failed`**    | process-export edge fn | `organization_id`, `export_request_id`, `error` (sanitized)                                                                                                     | Error messages sanitized                     |

***

## API / Edge Functions

* **`process-export`** – Async export processor: fetches data, applies PII/PHI filtering, generates CSV/JSON, uploads to storage, creates signed URLs, logs audit events.

***

## Permission Keys

| Permission Key               | Description                         | Roles                             |
| ---------------------------- | ----------------------------------- | --------------------------------- |
| `pf.export_requests.view`    | View export history                 | org\_admin, finance\_admin, staff |
| `pf.export_requests.create`  | Create new export requests          | org\_admin, finance\_admin        |
| `pf.export_templates.manage` | Create/edit/delete export templates | org\_admin, finance\_admin        |

***

## Integration Matrix

PF-44 is Platform Foundation only (no cross-core integration). This doc satisfies spec integration documentation requirements.
