# Phase: Pharmacy Network

| Field | Value |
| --- | --- |
| Identifier | `healthcare-13-6` |
| Status | Planned |
| Owner | Platform |
| Module(s) | `healthcare.pharmacies`, `healthcare.prescriptions`, `healthcare.prescription_orders` |
| Service(s) | `healthcare` |
| Depends On | `healthcare-13-0`, `healthcare-13-5` |
| ADR(s) | TBD |
| Manifest | [phase-manifest.yaml](../../ai-framework/phase-manifest.yaml) |
| Framework | [ADR-013](../../architecture/adr/ADR-013.md) · [ADR-018](../../architecture/adr/ADR-019.md) · [ADR-019](../../architecture/adr/ADR-019.md) |

## Objective

Build a pharmacy partner network within Healthcare: pharmacy registry, prescription orders routed from medical encounters, fulfillment status lifecycle, and events for downstream consumers — without drug inventory accounting, payment capture, or Delivery dispatch (Phase 13.7).

## Enterprise Phase Discovery

> **Required before Implementation.**

| Field | Value |
| --- | --- |
| Discovery date | TBD at implementation |
| Inputs reviewed | Phase 13.5 encounters · pharmacy actor workflows |

### Target Responsibility (this phase when Complete)

- Pharmacy aggregate (partner registry, contact, hours, service area refs)
- PrescriptionOrder + PrescriptionLine linked to Encounter/VisitSession
- Fulfillment lifecycle: submitted → accepted → preparing → ready → picked_up / cancelled
- Pharmacy staff permissions separate from clinic doctor permissions
- Events `healthcare.pharmacy.*`, `healthcare.prescription_order.*`
- Communication notifications on status changes (client only)

### Explicitly Excluded

- Drug wholesale inventory and Accounting COGS
- Payment gateway / POS
- Delivery driver assignment (13.7)
- CRM marketing to pharmacies
- Regulated e-prescription national gateway (future ADR)

## Business Analysis

| Item | Detail |
| --- | --- |
| Actors | Doctor (prescribe intent), pharmacy staff, patient (status view via 13.4) |
| Business capabilities | Route prescriptions to network pharmacies; track fulfillment |
| Success metrics | Order state machine enforced; tenant + pharmacy isolation |
| Non-goals | Controlled substance scheduling compliance (future) |

## Scope

### In Scope

- Aggregates: Pharmacy, PrescriptionOrder, PrescriptionLine, PrescriptionStatusHistory
- APIs for clinic submit and pharmacy accept/prepare/complete
- Validators: lines reference medication codes/shells from medical record
- Alembic `0007_phase_136_pharmacy_network`; version `0.13.6.0`

### Permissions

| Permission | Description |
| --- | --- |
| `healthcare.prescriptions.submit` | Clinic submits order |
| `healthcare.pharmacies.manage` | Admin registry |
| `healthcare.prescription_orders.fulfill` | Pharmacy staff updates status |

## Out of Scope

- Delivery integration (13.7)
- Accounting invoices
- Marketplace vendor model

## Completion Criteria

- [ ] Prescription lifecycle tests
- [ ] Pharmacy tenant isolation (partner sees only assigned orders)
- [ ] Handover + registry at `0.13.6.0`

## Related Documents

- [Phase 13.5](phase-13-5-medical-record.md)
- [Healthcare Roadmap](../../healthcare-roadmap.md)
- [Module Registry](../../module-registry.md#healthcare)
