# Project Plan

## Phase 0: Foundations

- Architecture runway: modular monolith, event bus, audit outbox, API gateway.
- Security baseline: tenant isolation, RBAC, JWT, 2FA design, audit logging.
- DevOps baseline: Docker Compose, CI checks, database migrations, observability skeleton.

## Phase 1: MVP

- Auth and RBAC for Super Admin, Pharmacy Manager, Pharmacist, Technician/Cashier.
- Pharmacy and tenant management.
- Inventory Hub:
  - Products, barcode, QR, RFID, lot number, expiry date.
  - Stock receiving, adjustment, transfer, and scan-based lookup.
  - Low-stock, near-expiry, and expired alerts.
- POS light:
  - Barcode cart, discounts, VAT calculation, payment record.
- Audit trail for all core actions.
- Arabic RTL and English web shell.

## Phase 2: Clinical and Patient Workflows

- e-Prescription intake API.
- Clinical decision support checks for interaction, allergy, duplicate therapy, and dose warnings.
- Patient profile, allergy, medication, adherence, refill reminders.
- Patient mobile app for orders, reminders, and pharmacist consultation.

## Phase 3: Integrations

- Insurance eligibility and claims.
- Supplier purchase order APIs.
- WhatsApp Business, SMS, and push notifications.
- Accounting export to Odoo/SAP/QuickBooks.
- IoT cold-chain temperature ingestion and alerting.

## Phase 4: AI and Analytics

- Time-series demand forecasting per pharmacy/product.
- Substitute recommendation engine based on availability, price, and clinical equivalence.
- Suspicious prescription and fraud detection.
- BI dashboards for sales, expiry waste, stock turnover, branch performance, and MOH reports.

## MVP Acceptance Criteria

- A tenant can manage multiple pharmacies.
- A pharmacy can receive stock by lot and expiry date.
- A pharmacist can identify low stock and near-expiry items.
- A cashier can scan a product and create a basic POS transaction.
- Every sensitive operation writes an audit event.
- Arabic RTL UI shell works without broken layout.
