NDP Microservices Documentation
Service Status Overview
✅ Completed - Healthcare Enhanced (P0)
| Service | Status | Lines | Key Features |
|---|---|---|---|
| Prescription Service | ✅ COMPLETE | 970 | 4-layer validation, FHIR, clinical safety |
| FHIR Server | ✅ COMPLETE | 549 | HAPI FHIR R4, CDS Hooks, SMART on FHIR |
| CDSS | ✅ COMPLETE | 843 | Drug interactions, allergies, dosing |
| Insurance Service | ✅ COMPLETE | 645 | UHIS integration, PA, claims |
🔄 Needs Update (P1)
| Service | Current | Needs |
|---|---|---|
| Patient Registry | Basic | Clinical data, consent, FHIR |
| Medicine Directory | Basic | FHIR Medication, extended data |
| Dispense Service | Basic | Inventory, insurance adjudication |
| HPR Registry | Basic | Enhanced authorization, specialties |
| Audit Service | Basic | Healthcare compliance, immutable |
📝 To Create (P1)
| Service | Priority | Purpose |
|---|---|---|
| Notification Service | HIGH | SMS, email, push, alerts |
| Analytics Service | HIGH | Public health, reporting |
| Master Data Management | MEDIUM | ICD-10, LOINC, SNOMED |
Architecture Overview
Click diagrams to zoom
All diagrams are interactive - click to expand to full screen
Critical Dependencies
🔄 Prescription Creation Flow
💊 Dispensing Flow
Safety-Critical Services
🚨 Tier 1 - CRITICAL (Cannot Function Without)
CDSS - Patient safety validations
- Drug-drug interactions
- Allergy checking
- Dosing validation
- Downtime Impact: Cannot prescribe safely
- SLA: 99.99% uptime
FHIR Server - Central data repository
- Single source of truth
- Patient clinical data
- Downtime Impact: System-wide outage
- SLA: 99.95% uptime
Patient Registry - Identity & clinical data
- Patient verification
- Allergies, conditions
- Downtime Impact: Cannot verify patients
- SLA: 99.9% uptime
⚠️ Tier 2 - HIGH PRIORITY
- Insurance Service - Cannot dispense without
- Prescription Service - Core functionality
- HPR Registry - Prescriber validation
- Dispense Service - Pharmacy operations
📊 Tier 3 - SUPPORTING
- Medicine Directory - Reference data (can cache)
- Audit Service - Logging (can queue)
- Notification Service - User experience (can delay)
- Analytics Service - Reporting (batch processing)
Performance Targets
| Service | Throughput | P95 Latency | Uptime |
|---|---|---|---|
| FHIR Server | 10,000 req/s | 100ms | 99.95% |
| CDSS | 5,000 req/s | 200ms | 99.99% |
| Prescription | 5,000 req/s | 300ms | 99.9% |
| Insurance | 3,000 req/s | 500ms | 99.9% |
| Dispense | 3,000 req/s | 300ms | 99.9% |
| Patient Registry | 10,000 req/s | 100ms | 99.9% |
Data Flow
FHIR Resource Mappings
yaml
NDP Service → FHIR Resource: Patient Registry → Patient
Patient Registry → AllergyIntolerance
Patient Registry → Condition
Patient Registry → Observation (labs)
HPR Registry → Practitioner
HPR Registry → PractitionerRole
HPR Registry → Organization
Pharmacy Registry → Location
Pharmacy Registry → Organization
Medicine Directory → Medication
Prescription Service → MedicationRequest
Dispense Service → MedicationDispense
Insurance Service → Coverage
Insurance Service → Claim
Audit Service → AuditEvent
Audit Service → ProvenanceSecurity Model
Authentication & Authorization
yaml
External Clients:
- Prescriber Apps: OAuth 2.0 / SMART on FHIR
- Pharmacy Systems: mTLS + API keys
- Patient Apps: OAuth 2.0 / OIDC
Service-to-Service:
- mTLS (mutual TLS)
- JWT tokens
- Service mesh (Istio)
Data Protection:
- PHI: Encrypted at rest (AES-256)
- PHI in transit: TLS 1.3
- PII: Field-level encryption
- Audit: All access loggedDeployment Strategy
Stack Organization
yaml
1. Infrastructure Stack (stack-infra):
- Traefik (gateway)
- Portainer (management)
2. Data Stack (stack-data):
- PostgreSQL (relational data)
- MongoDB (document data)
- Redis (caching)
3. Monitoring Stack (stack-monitor):
- Prometheus (metrics)
- Grafana (visualization)
- Loki (logs)
4. Discovery Stack (stack-discovery):
- Consul (service discovery)
- Vault (secrets)
5. Application Stack (stack-apps):
- FHIR Server
- Prescription Service
- CDSS
- Insurance Service
- Dispense Service
- Patient Registry
- HPR Registry
- Medicine Directory
- Audit Service
- Notification Service
- Analytics ServiceNext Steps
Phase 1: Complete P0 Services ✅
- [x] Prescription Service with clinical safety
- [x] FHIR Server (HAPI FHIR)
- [x] CDSS (drug interactions, allergies)
- [x] Insurance Service (UHIS integration)
Phase 2: Update Existing Services (In Progress)
- [ ] Patient Registry (clinical data, consent)
- [ ] Medicine Directory (FHIR compliance)
- [ ] Dispense Service (inventory, insurance)
- [ ] HPR Registry (enhanced authorization)
- [ ] Audit Service (healthcare compliance)
Phase 3: Create Supporting Services
- [ ] Notification Service
- [ ] Analytics & Public Health Service
- [ ] Master Data Management Service
Phase 4: Integration & Testing
- [ ] End-to-end testing
- [ ] Load testing
- [ ] Security audit
- [ ] FHIR compliance validation
Getting Started
Read the Architecture Review:
- Architecture Review - Critical issues and recommendations
Understand the Critical Services:
- Prescription Service - Start here
- CDSS - Patient safety
- FHIR Server - Data model
- Insurance - Coverage
For Healthcare Professionals
Clinical Decision Support:
- CDSS Documentation - How safety checks work
Prescription Workflow:
- Prescription Service - Prescribing process
Insurance & Coverage:
- Insurance Service - UHIS integration
Support
- Slack: #ndp-services
- Email: ndp-dev@healthflow.eg
- Wiki: https://wiki.healthflow.eg/ndp
- Issues: Internal Issue Tracker
License
Proprietary - Egyptian Ministry of Health and Population