AI Services

MediLoop's AI services provide world-class clinical intelligence including patient timeline RAG, clinical decision support, automated documentation, predictive analytics, and multi-role AI assistants. All services are designed to augment healthcare provider decision-making.

Capabilities Overview

Patient Timeline RAG

Longitudinal patient memory with real-time sync

Clinical Decision Support

Diagnosis, drug safety, critical values

Automated Documentation

SOAP notes, discharge summaries

Predictive Analytics

Risk scores, sepsis detection

Proactive Healthcare

Care gaps, adherence monitoring

Multi-Role Assistants

Pharmacist, nurse, lab, researcher

All Endpoints

POST/api/v1/ai/process/Process clinical message
POST/api/v1/documentation/soap-note/Generate SOAP note
POST/api/v1/documentation/extract-entities/Extract medical entities
POST/api/v1/clinical-decision-support/drug-interactions/Check drug interactions
POST/api/v1/clinical-decision-support/critical-values/Detect critical values
GET/api/v1/patient-timeline/timeline/{uhid}/Get patient timeline
POST/api/v1/copilot/encounter/start/Start encounter copilot
POST/api/v1/predictive-analytics/risk-scores/Calculate risk scores

Patient Timeline

Retrieve comprehensive patient timeline with longitudinal clinical data for RAG-powered context.

GET/api/v1/patient-timeline/timeline/{uhid}/
Request
bash
curl -X GET https://api.mediloop.co/api/v1/patient-timeline/timeline/UG123456789A/ \
  -H "Authorization: Bearer sk_live_..."
RESPONSE200
{
  "uhid": "UG123456789A",
  "timeline": {
    "encounters": [
      {
        "id": "enc-001",
        "date": "2025-12-15",
        "type": "outpatient",
        "chief_complaint": "Fever"
      }
    ],
    "diagnoses": [
      {
        "code": "I10",
        "display": "Essential hypertension",
        "date": "2024-06-01"
      }
    ],
    "medications": [
      {
        "name": "Lisinopril",
        "dose": "10mg",
        "frequency": "daily",
        "status": "active"
      }
    ],
    "observations": [
      {
        "type": "blood_pressure",
        "value": "130/85",
        "date": "2025-12-15"
      }
    ]
  },
  "context_window": "90 days"
}

Generate SOAP Note

Automatically generate structured SOAP notes from encounter data with AI-powered summarization.

POST/api/v1/documentation/soap-note/

Request Body

encounter_iduuidrequired

Encounter ID

patient_uhidstringrequired

Patient UHID

provider_idstringrequired

Provider ID

include_historybooleanoptional

Include patient history

Default: true

Request
bash
curl -X POST https://api.mediloop.co/api/v1/documentation/soap-note/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "encounter_id": "550e8400-e29b-41d4-a716-446655440000",
    "patient_uhid": "UG123456789A",
    "provider_id": "PROV-001"
  }'
RESPONSE200
{
  "document_id": "660e8400-e29b-41d4-a716-446655440001",
  "soap_note": {
    "subjective": "Patient presents with 3-day history of fever, headache, and fatigue...",
    "objective": "Vitals: BP 130/85, HR 88, Temp 38.2°C. Alert, mild distress...",
    "assessment": "1. Suspected viral infection\n2. Hypertension, controlled",
    "plan": "1. CBC, Malaria RDT\n2. Paracetamol 1g PRN\n3. Follow-up in 3 days"
  },
  "confidence": 0.92,
  "entities_extracted": 12,
  "requires_review": false
}

Check Drug Interactions

Comprehensive drug safety checking including drug-drug, drug-condition, and drug-allergy interactions.

POST/api/v1/clinical-decision-support/drug-interactions/

Request Body

new_medicationobjectrequired

New medication to check

current_medicationsarrayrequired

Current medication list

conditionsarrayoptional

Patient conditions (ICD-10)

allergiesarrayoptional

Known allergies

Request
bash
curl -X POST https://api.mediloop.co/api/v1/clinical-decision-support/drug-interactions/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "new_medication": {
      "code": "197361",
      "name": "Warfarin 5mg"
    },
    "current_medications": [
      { "code": "1191", "name": "Aspirin 81mg" }
    ],
    "conditions": ["I10", "E11"],
    "allergies": ["Penicillin"]
  }'
RESPONSE200
{
  "safe": false,
  "interactions": [
    {
      "type": "drug-drug",
      "severity": "major",
      "drugs": [
        "Warfarin",
        "Aspirin"
      ],
      "description": "Increased bleeding risk",
      "recommendation": "Monitor INR closely, consider alternative"
    }
  ],
  "contraindications": [],
  "allergy_alerts": [],
  "processing_time_ms": 145
}

Detect Critical Values

Real-time detection of critical lab values with automatic notification triggering.

POST/api/v1/clinical-decision-support/critical-values/
Request
bash
curl -X POST https://api.mediloop.co/api/v1/clinical-decision-support/critical-values/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG123456789A",
    "observation": {
      "code": "2951-2",
      "display": "Sodium",
      "value": 118,
      "unit": "mmol/L"
    }
  }'
RESPONSE200
{
  "is_critical": true,
  "urgency": "high",
  "value": 118,
  "normal_range": "136-145 mmol/L",
  "deviation": "severely_low",
  "clinical_significance": "Severe hyponatremia - risk of seizures",
  "recommended_actions": [
    "Immediate physician notification",
    "Repeat sodium level",
    "Assess fluid status"
  ],
  "notification_sent": true,
  "notification_id": "notif-001"
}

Encounter Copilot

Real-time AI assistance during clinical encounters with symptom analysis, test recommendations, and safety monitoring.

POST/api/v1/copilot/encounter/start/

Request Body

encounter_iduuidrequired

Encounter ID

provider_idstringrequired

Provider ID

patient_uhidstringrequired

Patient UHID

Start Session
bash
curl -X POST https://api.mediloop.co/api/v1/copilot/encounter/start/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "encounter_id": "550e8400-e29b-41d4-a716-446655440000",
    "provider_id": "PROV-001",
    "patient_uhid": "UG123456789A"
  }'
RESPONSE200
{
  "session_id": "sess-abc123",
  "patient_context": {
    "chronic_conditions": [
      "Hypertension",
      "Type 2 Diabetes"
    ],
    "active_medications": [
      "Lisinopril 10mg",
      "Metformin 500mg"
    ],
    "allergies": [
      "Penicillin"
    ],
    "recent_visits": 3
  },
  "alerts": [
    {
      "type": "reminder",
      "message": "HbA1c due (last: 6 months ago)"
    }
  ]
}

Analyze Symptoms

POST/api/v1/copilot/encounter/analyze-symptoms/
Request
bash
curl -X POST https://api.mediloop.co/api/v1/copilot/encounter/analyze-symptoms/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess-abc123",
    "symptoms": ["chest pain", "shortness of breath", "diaphoresis"],
    "onset": "2 hours ago",
    "severity": "severe"
  }'
RESPONSE200
{
  "differential_diagnosis": [
    {
      "condition": "Acute Coronary Syndrome",
      "probability": 0.85,
      "code": "I21.9"
    },
    {
      "condition": "Pulmonary Embolism",
      "probability": 0.45,
      "code": "I26.99"
    },
    {
      "condition": "Aortic Dissection",
      "probability": 0.25,
      "code": "I71.00"
    }
  ],
  "urgency": "emergency",
  "recommended_tests": [
    {
      "test": "ECG",
      "priority": "stat",
      "reason": "Rule out STEMI"
    },
    {
      "test": "Troponin",
      "priority": "stat",
      "reason": "Cardiac biomarkers"
    },
    {
      "test": "Chest X-Ray",
      "priority": "urgent",
      "reason": "Assess cardiac silhouette"
    }
  ],
  "red_flags": [
    "Acute chest pain with diaphoresis - consider ACS"
  ]
}

Predictive Analytics

AI-powered risk stratification, sepsis detection, and disease progression prediction.

POST/api/v1/predictive-analytics/risk-scores/
Request
bash
curl -X POST https://api.mediloop.co/api/v1/predictive-analytics/risk-scores/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG123456789A",
    "risk_types": ["cardiovascular", "readmission", "mortality"]
  }'
RESPONSE200
{
  "patient_uhid": "UG123456789A",
  "risk_scores": {
    "cardiovascular": {
      "score": 0.23,
      "category": "moderate",
      "factors": [
        "Hypertension",
        "Age > 55",
        "Diabetes"
      ]
    },
    "readmission_30day": {
      "score": 0.15,
      "category": "low",
      "factors": [
        "Good medication adherence"
      ]
    },
    "mortality_1year": {
      "score": 0.08,
      "category": "low",
      "factors": []
    }
  },
  "recommendations": [
    "Continue current antihypertensive regimen",
    "Schedule HbA1c in 3 months"
  ]
}

Sepsis Risk Detection

POST/api/v1/predictive-analytics/sepsis-risk/
Request
bash
curl -X POST https://api.mediloop.co/api/v1/predictive-analytics/sepsis-risk/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG123456789A",
    "vitals": {
      "heart_rate": 110,
      "respiratory_rate": 24,
      "systolic_bp": 95,
      "temperature": 38.8,
      "gcs": 14
    },
    "labs": {
      "wbc": 15.2,
      "lactate": 2.8
    }
  }'
RESPONSE200
{
  "sepsis_risk": "high",
  "qsofa_score": 2,
  "sirs_criteria_met": 3,
  "risk_probability": 0.72,
  "alert_triggered": true,
  "recommendations": [
    "Consider sepsis bundle initiation",
    "Blood cultures before antibiotics",
    "Lactate clearance monitoring"
  ],
  "time_to_intervention": "immediate"
}

Medical Entity Extraction

Extract and code medical entities from clinical text using ICD-10, SNOMED CT, LOINC, and RxNorm.

POST/api/v1/documentation/extract-entities/
Request
bash
curl -X POST https://api.mediloop.co/api/v1/documentation/extract-entities/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "45-year-old male with hypertension and type 2 diabetes, currently on Metformin 500mg twice daily and Lisinopril 10mg daily. Presents with chest pain and shortness of breath."
  }'
RESPONSE200
{
  "entities": {
    "diagnoses": [
      {
        "text": "Hypertension",
        "code": "I10",
        "system": "ICD-10",
        "validated": true
      },
      {
        "text": "Type 2 Diabetes",
        "code": "E11.9",
        "system": "ICD-10",
        "validated": true
      }
    ],
    "medications": [
      {
        "text": "Metformin 500mg",
        "code": "860975",
        "system": "RxNorm",
        "validated": true
      },
      {
        "text": "Lisinopril 10mg",
        "code": "314076",
        "system": "RxNorm",
        "validated": true
      }
    ],
    "symptoms": [
      {
        "text": "Chest pain",
        "code": "29857009",
        "system": "SNOMED-CT"
      },
      {
        "text": "Shortness of breath",
        "code": "267036007",
        "system": "SNOMED-CT"
      }
    ],
    "demographics": {
      "age": 45,
      "gender": "male"
    }
  },
  "confidence": 0.94,
  "processing_time_ms": 234
}

Multi-Role AI Assistants

Specialized AI assistants for different healthcare roles including pharmacists, nurses, lab technicians, and researchers.

Pharmacist Assistant

Drug interactions, prescription verification, counseling points

/api/v1/multi-role/pharmacist/*

Nurse Assistant

Patient assessment, medication schedules, handoff summaries

/api/v1/multi-role/nurse/*

Lab Technician Assistant

Result interpretation, critical values, QC evaluation

/api/v1/multi-role/lab/*

Researcher Assistant

Literature search, cohort identification, statistical recommendations

/api/v1/multi-role/researcher/*

Document Digitization

OCR processing, document classification, and FHIR resource generation from medical documents.

POST/api/v1/document-digitization/process/
Request
bash
curl -X POST https://api.mediloop.co/api/v1/document-digitization/process/ \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: multipart/form-data" \
  -F "document=@lab_report.pdf" \
  -F "document_type=lab_report"
RESPONSE200
{
  "document_id": "doc-001",
  "classification": {
    "type": "lab_report",
    "confidence": 0.96
  },
  "ocr_result": {
    "text": "Complete Blood Count...",
    "confidence": 0.94
  },
  "extracted_data": {
    "tests": [
      {
        "name": "Hemoglobin",
        "value": 12.5,
        "unit": "g/dL",
        "reference": "12.0-16.0"
      }
    ]
  },
  "fhir_resources": [
    {
      "resourceType": "DiagnosticReport",
      "id": "dr-001"
    },
    {
      "resourceType": "Observation",
      "id": "obs-001"
    }
  ]
}

Clinical Decision Support Disclaimer

All AI services are designed to assist healthcare providers, not replace clinical judgment. AI-generated suggestions must be reviewed by qualified healthcare professionals before being acted upon. The system includes professional override capabilities and comprehensive audit logging.

Rate Limits

AI endpoints have specific rate limits due to computational requirements:

Endpoint CategoryLimit
Patient Timeline100 requests/minute
Clinical Decision Support60 requests/minute
Documentation Generation30 requests/minute
Encounter Copilot60 requests/minute
Predictive Analytics30 requests/minute
Entity Extraction100 requests/minute
Document Digitization20 requests/minute
Multi-Role Assistants60 requests/minute

Performance Targets

OperationTarget Latency
Patient message response< 3 seconds (p95)
RAG retrieval< 500ms
Drug interaction check< 2 seconds
SOAP note generation< 60 seconds
Critical value notification< 30 seconds
Entity extraction< 1 second