Clinical Decision Support Service (CDSS)
Pipeline-Managed Service
This service is deployed and managed by its CI/CD pipeline.
For current deployment status, configurations, and code:
- Repository:
https://repo.local/healthflow/ndp-cdss-service - Technology: Python/FastAPI with ML models
- Version: v2.0.0
Overview
The Clinical Decision Support Service (CDSS) is a CRITICAL PATIENT SAFETY service that provides real-time clinical validations for prescriptions. It performs drug-drug interaction checking, allergy verification, dosing validation, and provides clinical recommendations.
CRITICAL SERVICE
This is a patient safety-critical service. Any downtime or errors can result in:
- ❌ Missed drug interactions → Patient harm
- ❌ Missed allergies → Anaphylaxis
- ❌ Incorrect dosing → Toxicity or inefficacy
SLA: 99.99% uptime | Response time: < 200ms p95
Purpose
Primary Functions
- Drug-Drug Interaction Checking (DDI)
- Drug-Allergy Checking
- Drug-Condition Contraindications
- Dosing Validation (age, weight, renal, hepatic)
- Duplicate Therapy Detection
- Pregnancy/Lactation Safety
- Clinical Guidelines Compliance
Safety Guarantee
- BLOCKING validations for critical issues (cannot override)
- WARNING validations for major issues (requires justification)
- ADVISORY validations for minor issues (informational)
Architecture
Key Features
1. Drug-Drug Interaction (DDI) Checking
Severity Levels:
| Level | Severity | Action | Example |
|---|---|---|---|
| 1 | Contraindicated | ❌ BLOCKED | Warfarin + NSAIDs → Bleeding risk |
| 2 | Major | ⚠️ WARNING | Statins + Fibrates → Rhabdomyolysis |
| 3 | Moderate | ℹ️ ADVISORY | Antacids + Antibiotics → Absorption |
| 4 | Minor | 📝 INFO | Minimal clinical significance |
Interaction Types:
- Pharmacokinetic: Absorption, distribution, metabolism, excretion
- Pharmacodynamic: Additive, synergistic, antagonistic effects
- Food/Drug: Timing with meals
- Drug/Lab: Interference with lab tests
2. Drug-Allergy Checking
Cross-Allergy Detection:
yaml
Penicillin Allergy:
Cross-allergies:
- Amoxicillin (100% cross-reactivity)
- Ampicillin (100% cross-reactivity)
- Cephalosporins (5-10% cross-reactivity - WARNING)
- Carbapenems (1% cross-reactivity - ADVISORY)
Sulfa Allergy:
Cross-allergies:
- Sulfamethoxazole/Trimethoprim
- Furosemide (theoretical - monitor)
- Celecoxib (theoretical - monitor)
NSAID Allergy:
Cross-allergies:
- All NSAIDs (class effect)
- COX-2 inhibitors (may be safe alternative)
- Aspirin (cross-reactive)Allergy Severity Response:
- Anaphylaxis/Severe: Absolute contraindication (BLOCKED)
- Moderate: Strong warning with alternatives
- Mild: Advisory with monitoring recommendation
3. Dosing Validation
Age-Based Dosing
Pediatric Dosing (< 18 years):
typescript
interface PediatricDosing {
weightRequired: boolean; // MANDATORY for most drugs
bsaRequired: boolean; // Body surface area for chemo
maxDosePerKg: number;
maxTotalDose: number;
ageRestrictions: {
minAge: number; // e.g., not approved <2 years
contraindicated: string[]; // Drugs contraindicated by age
};
formulationRestrictions: string[]; // Must be liquid/chewable
}
Examples:
Aspirin:
- Contraindicated <12 years (Reye's syndrome risk)
- BLOCKED by CDSS
Amoxicillin:
- Dose: 20-40 mg/kg/day divided TID
- Max: 1500 mg/day for children
- Must validate weightGeriatric Dosing (≥ 65 years):
yaml
Beers Criteria Checking:
High-Risk Medications in Elderly:
- Benzodiazepines (fall risk)
- Anticholinergics (cognitive impairment)
- NSAIDs (GI bleeding, renal)
- Opioids (fall risk, constipation)
Dose Reductions Recommended:
- Most psychotropics: Start 50% of adult dose
- Renally cleared drugs: Adjust for CrCl decline
- Hepatically metabolized: Consider liver functionRenal Dosing Adjustments
yaml
CrCl Calculation:
Method: Cockcroft-Gault equation
Formula: ((140 - age) × weight) / (72 × SCr)
Female: Multiply by 0.85
Dosing Adjustments:
CrCl ≥ 60 ml/min (Normal):
- No adjustment needed
CrCl 30-59 ml/min (CKD Stage 3):
- Many drugs require 50% dose reduction
- Some drugs contraindicated
Examples:
- Metformin: Reduce to 1000mg/day, monitor
- Gabapentin: Reduce by 50%
- NSAIDs: Avoid if possible
CrCl 15-29 ml/min (CKD Stage 4):
- Severe restrictions
- Most drugs require significant reduction
- Nephrotoxic drugs CONTRAINDICATED
CrCl < 15 ml/min or Dialysis:
- Very limited options
- Specialist consultation required
- Post-dialysis dosing considerationsHepatic Dosing
yaml
Child-Pugh Score Assessment:
Class A (5-6 points): Mild
- Most drugs tolerated
- Monitor closely
Class B (7-9 points): Moderate
- Reduce dose 25-50%
- Avoid hepatotoxic drugs
Class C (10-15 points): Severe
- Many drugs contraindicated
- Specialist consultation required
High-Risk Drugs in Liver Disease:
Contraindicated:
- Isoniazid
- Ketoconazole
- Methotrexate
Requires Dose Reduction:
- Benzodiazepines (encephalopathy risk)
- Opioids (accumulation)
- Many antibiotics4. Pregnancy & Lactation Safety
yaml
FDA Pregnancy Categories:
Category X (Contraindicated):
- BLOCKED for women of childbearing age
- Examples: Isotretinoin, Methotrexate, Statins
- Requires pregnancy test confirmation
Category D (Positive Evidence of Risk):
- WARNING - Requires strong justification
- Risk vs benefit documentation required
- Examples: Lithium, Phenytoin, some antibiotics
Category C (Risk Cannot Be Ruled Out):
- ADVISORY - Use if benefit > risk
- Most medications fall here
- Prescriber informed decision
Category B (No Risk in Animal Studies):
- Generally safe
- Preferred when available
Category A (Safe - Controlled Human Studies):
- Very few drugs
- Generally preferred
Lactation Safety:
L1 (Safest): Compatible with breastfeeding
L2 (Safer): Probably compatible
L3 (Moderately Safe): Probably compatible, monitor infant
L4 (Possibly Hazardous): Use only if no alternatives
L5 (Contraindicated): Do not use while breastfeeding5. Duplicate Therapy Detection
typescript
interface DuplicateTherapy {
type: 'SAME_DRUG' | 'SAME_CLASS' | 'SAME_MECHANISM';
severity: 'CRITICAL' | 'MAJOR' | 'MODERATE';
action: 'BLOCK' | 'WARN' | 'ADVISORY';
}
Examples:
Same Drug:
- Patient on Metformin 500mg BID
- Prescriber adds Metformin 850mg daily
- Action: BLOCKED - "Patient already on Metformin"
Same Therapeutic Class:
- Patient on Atorvastatin 20mg
- Prescriber adds Simvastatin 40mg
- Action: WARNING - "Patient already on a statin"
Same Mechanism Different Class:
- Patient on NSAID (Ibuprofen)
- Prescriber adds COX-2 inhibitor (Celecoxib)
- Action: WARNING - "Duplicate anti-inflammatory therapy"
Synergistic Toxicity:
- Patient on ACE inhibitor
- Prescriber adds ARB
- Action: WARNING - "Dual RAAS blockade - increased hyperkalemia risk"6. Drug-Condition Contraindications
yaml
Common Contraindications:
Diabetes:
Avoid:
- Corticosteroids (hyperglycemia)
- Thiazide diuretics (high dose)
- Beta-blockers (mask hypoglycemia)
Caution:
- Monitor glucose closely
- Dose adjustments may be needed
Heart Failure:
Avoid:
- NSAIDs (fluid retention)
- Most calcium channel blockers (negative inotrope)
- Thiazolidinediones (fluid retention)
Preferred:
- ACE inhibitors, beta-blockers, diuretics
Asthma/COPD:
Avoid:
- Beta-blockers (bronchospasm)
- NSAIDs (may trigger)
Preferred:
- Selective medications when possible
Peptic Ulcer Disease:
Avoid:
- NSAIDs (GI bleeding)
- Corticosteroids (ulceration)
Protect:
- Proton pump inhibitor if must use NSAID
Chronic Kidney Disease:
Avoid:
- NSAIDs (nephrotoxic)
- Aminoglycosides
- Contrast agents (with precautions)
Monitor:
- Renally cleared drugs
- ElectrolytesAPI Endpoints
Primary Validation Endpoint
yaml
POST /api/v1/cdss/validate-prescription
Request:
{
"validationType": "COMPREHENSIVE", # or QUICK, ALLERGY_ONLY, etc.
"context": {
"prescriberId": "HPR-12345",
"facilityId": "FAC-001",
"encounterType": "OUTPATIENT"
},
"patient": {
"id": "29001010101010",
"age": 45,
"gender": "male",
"weight": 75, # kg
"height": 175, # cm
"isPregnant": false,
"isLactating": false,
"allergies": [
{
"allergen": "Penicillin",
"allergenCode": "ALLERGY-PEN",
"severity": "SEVERE",
"reaction": "Anaphylaxis",
"verifiedDate": "2020-05-15"
}
],
"chronicConditions": [
{
"condition": "Type 2 Diabetes Mellitus",
"icd10Code": "E11.9",
"diagnosedDate": "2018-01-01"
},
{
"condition": "Essential Hypertension",
"icd10Code": "I10",
"diagnosedDate": "2019-03-15"
}
],
"labs": {
"renalFunction": {
"creatinine": 1.2, # mg/dL
"crCl": 68, # ml/min (calculated)
"ckdStage": "CKD_3A",
"date": "2026-04-01"
},
"hepaticFunction": {
"alt": 35,
"ast": 28,
"status": "NORMAL",
"childPughScore": null,
"date": "2026-04-01"
}
},
"currentMedications": [
{
"code": "MED-001",
"name": "Metformin 500mg",
"dose": "500mg",
"frequency": "BID",
"startDate": "2018-01-15"
},
{
"code": "MED-002",
"name": "Lisinopril 10mg",
"dose": "10mg",
"frequency": "Once daily",
"startDate": "2019-03-20"
}
]
},
"proposedMedications": [
{
"code": "MED-003",
"name": "Amoxicillin 500mg",
"activeIngredient": "Amoxicillin",
"therapeuticClass": "Penicillin Antibiotic",
"atcCode": "J01CA04",
"dose": 500,
"doseUnit": "mg",
"frequency": "TID",
"frequencyTimes": 3,
"route": "PO",
"duration": 7,
"durationUnit": "days",
"indication": "Acute sinusitis"
},
{
"code": "MED-004",
"name": "Ibuprofen 400mg",
"activeIngredient": "Ibuprofen",
"therapeuticClass": "NSAID",
"atcCode": "M01AE01",
"dose": 400,
"doseUnit": "mg",
"frequency": "TID",
"route": "PO",
"duration": 5,
"durationUnit": "days",
"indication": "Pain management"
}
]
}
Response:
{
"validationId": "VAL-2026041216300001",
"timestamp": "2026-04-12T16:30:00+02:00",
"overallStatus": "BLOCKED",
"canProceed": false,
"requiresOverride": false,
"processingTimeMs": 145,
"summary": {
"critical": 1,
"warnings": 2,
"advisory": 3,
"passed": 15
},
"validations": [
{
"medicationCode": "MED-003",
"medicationName": "Amoxicillin 500mg",
"checks": [
{
"checkType": "DRUG_ALLERGY",
"severity": "CRITICAL",
"status": "FAILED",
"canOverride": false,
"message": "Patient has documented SEVERE allergy to Penicillin. Amoxicillin is contraindicated.",
"detail": "Cross-reactivity: 100%. Reaction type: Anaphylaxis documented on 2020-05-15.",
"recommendation": "DO NOT PRESCRIBE. Use alternative antibiotic.",
"alternatives": [
{
"code": "MED-010",
"name": "Azithromycin 500mg",
"rationale": "No cross-allergy, covers similar pathogens"
},
{
"code": "MED-011",
"name": "Levofloxacin 500mg",
"rationale": "Fluoroquinolone, no cross-allergy"
}
],
"references": [
{
"source": "Micromedex",
"citation": "Penicillin Cross-Allergy Database"
}
]
}
]
},
{
"medicationCode": "MED-004",
"medicationName": "Ibuprofen 400mg",
"checks": [
{
"checkType": "DRUG_CONDITION_CONTRAINDICATION",
"severity": "HIGH",
"status": "WARNING",
"canOverride": true,
"requiresJustification": true,
"message": "NSAIDs may worsen renal function in CKD patients.",
"detail": "Patient has CKD Stage 3A (CrCl 68 ml/min). NSAIDs can further reduce renal function and increase cardiovascular risk.",
"recommendation": "Consider acetaminophen as alternative. If NSAID necessary, use lowest effective dose for shortest duration and monitor renal function.",
"alternatives": [
{
"code": "MED-020",
"name": "Acetaminophen 500mg",
"rationale": "Safer analgesic in renal impairment"
}
],
"monitoringRequired": [
"Renal function (creatinine) in 1-2 weeks",
"Blood pressure",
"Signs of fluid retention"
]
},
{
"checkType": "DRUG_DRUG_INTERACTION",
"severity": "MODERATE",
"status": "WARNING",
"canOverride": true,
"requiresJustification": false,
"message": "Ibuprofen may reduce antihypertensive effect of Lisinopril.",
"detail": "NSAIDs inhibit prostaglandin synthesis, which can antagonize ACE inhibitor effects. May increase blood pressure.",
"recommendation": "Monitor blood pressure. Consider alternative analgesic or increased ACE inhibitor dose if prolonged NSAID use necessary.",
"management": "Monitor BP within 1-2 weeks. Short-term use (<5 days) has minimal effect."
}
]
}
],
"patientSummary": {
"riskFactors": [
"Drug allergy (Penicillin - severe)",
"Chronic kidney disease (Stage 3A)",
"Multiple chronic conditions (polypharmacy risk)"
],
"specialConsiderations": [
"Renal dosing required for renally cleared drugs",
"Monitor drug interactions carefully (on 2 chronic medications)",
"Avoid penicillin and cross-reactive beta-lactams"
]
},
"guidelines": [
{
"title": "Egypt MOH Antibiotic Stewardship Guidelines",
"recommendation": "Document infection type and rationale for antibiotic selection",
"compliance": "REQUIRED"
}
]
}Quick Checks
yaml
# Quick allergy check only
POST /api/v1/cdss/check-allergies
{
"patientId": "29001010101010",
"medications": ["MED-003", "MED-004"]
}
# Quick interaction check
POST /api/v1/cdss/check-interactions
{
"medications": ["MED-001", "MED-002", "MED-003"]
}
# Dosing calculator
POST /api/v1/cdss/calculate-dose
{
"medicationCode": "MED-003",
"patientAge": 8,
"patientWeight": 25,
"indication": "Otitis media"
}
# Drug lookup
GET /api/v1/cdss/drugs/{code}/interactions
GET /api/v1/cdss/drugs/{code}/contraindications
GET /api/v1/cdss/drugs/{code}/pregnancy-categoryIntegration with Other Services
Prescription Service Integration
Data Sources
Internal Data Sources
- FHIR Server: Patient clinical data
- Patient Registry: Allergies, conditions, labs
- Medicine Directory: Drug information, classifications
- HPR Registry: Prescriber specialty validation
External Knowledge Bases
| Source | Purpose | Update Frequency |
|---|---|---|
| Micromedex | Drug interactions, dosing | Real-time API |
| First Databank (FDB) | Clinical decision support | Daily sync |
| Lexicomp | Drug information | Daily sync |
| FDA FAERS | Adverse event reporting | Weekly sync |
| Egypt MOH Guidelines | Local clinical guidelines | Monthly sync |
| WHO ATC/DDD | Drug classification | Quarterly sync |
Performance & Scalability
Resource Requirements
yaml
resources:
limits:
cpu: "4"
memory: 8Gi
requests:
cpu: "2"
memory: 4Gi
replicas: 10 # High availability for patient safety
autoscaling:
minReplicas: 10
maxReplicas: 50
targetCPUUtilization: 60
targetResponseTime: 200msPerformance Targets
| Metric | Target | P50 | P95 | P99 |
|---|---|---|---|---|
| Response Time | < 200ms | 50ms | 150ms | 250ms |
| Throughput | 5,000 req/s | - | - | - |
| Availability | 99.99% | - | - | - |
| Error Rate | < 0.01% | - | - | - |
Caching Strategy
yaml
Cache Layers:
L1 - In-Memory Cache (Redis):
- Drug interaction matrix (hot data)
- Common allergies cross-reference
- Dosing formulas
TTL: 1 hour
Hit Rate Target: >90%
L2 - Database Query Cache:
- Patient clinical data
- Current medications
TTL: 5 minutes
L3 - External API Response Cache:
- Micromedex responses
- FDB responses
TTL: 24 hours (or until data update)Configuration
yaml
# Knowledge Base Configuration
knowledge_bases:
micromedex:
enabled: true
api_url: https://api.micromedex.com
api_key: ${MICROMEDEX_API_KEY}
timeout: 5s
retry_attempts: 3
first_databank:
enabled: true
api_url: https://api.fdbhealth.com
api_key: ${FDB_API_KEY}
sync_schedule: "0 2 * * *" # Daily at 2 AM
local_guidelines:
source: mongodb
collection: clinical_guidelines
update_notification: true
# Validation Rules
validation_rules:
allergy_checking:
enabled: true
cross_allergy_check: true
severity_threshold: MODERATE
interaction_checking:
enabled: true
check_levels: [1, 2, 3] # Which severity levels to check
block_level_1: true
warn_level_2: true
advisory_level_3: true
dosing_validation:
pediatric_weight_required: true
geriatric_screening: true
renal_adjustment: true
hepatic_adjustment: true
duplicate_therapy:
same_drug: BLOCK
same_class: WARN
same_mechanism: ADVISORY
# Performance
cache:
redis_url: redis://redis.data-stack:6379
ttl_seconds: 3600
max_memory: 4GB
rate_limiting:
enabled: true
requests_per_second: 5000
burst: 1000
# Monitoring
monitoring:
metrics_enabled: true
detailed_logging: true
alert_on_failures: true
alert_threshold: 0.01 # 0.01% error rateBusiness Rules
Validation Severity Actions
yaml
CRITICAL (Blocking):
- Documented severe drug allergy
- Level 1 drug interactions (contraindicated)
- Absolute contraindications (pregnancy category X)
- Pediatric age restrictions (e.g., aspirin <12)
Action: Cannot prescribe, no override option
HIGH (Warning - Requires Justification):
- Level 2 drug interactions (major)
- Moderate drug allergies
- Significant renal/hepatic dosing concerns
- Beers criteria violations in elderly
Action: Can override with documented justification
MODERATE (Advisory):
- Level 3 drug interactions
- Mild allergies
- Minor dosing concerns
- Duplicate therapy same class
Action: Prescriber notified, can proceed
LOW (Informational):
- Level 4 interactions
- Cost considerations
- Generic alternatives available
Action: Information displayed, no action requiredRelated Services
- Prescription Service - Primary consumer
- Dispense Service - Secondary validation at dispensing
- Patient Registry - Clinical data source
- Medicine Directory - Drug information
- FHIR Server - FHIR resource access
Support
- Slack: #cdss-alerts (for critical issues)
- On-Call: 24/7 support (patient safety critical)
- Escalation: DevOps Lead → Clinical Lead → CTO
- Documentation: Clinical decision support knowledge base