Overview

This guide walks through generating and managing ASP alerts. The system monitors three scenarios:

  1. Bacteremia Alert - Patient with positive blood culture lacking appropriate antibiotic coverage
  2. Antimicrobial Usage Alert - Patient on broad-spectrum antibiotics exceeding the 72-hour threshold
  3. No Indication Alert - Patient receiving antibiotics without documented indication (classification: "Never appropriate")

Quick Start Commands

1. Generate a Blood Culture Alert

Create a patient with a positive blood culture (MRSA) without appropriate coverage:

cd /home/david/projects/aegis
python scripts/demo_blood_culture.py --organism mrsa

Then run the bacteremia monitor to detect and alert:

cd asp-bacteremia-alerts
python -m src.monitor

2. Generate an Antimicrobial Usage Alert

Create a patient on meropenem for 5 days (exceeds 72h threshold):

cd /home/david/projects/aegis
python scripts/demo_antimicrobial_usage.py --antibiotic meropenem --days 5

Then run the usage monitor:

cd antimicrobial-usage-alerts
python -m src.runner --once --verbose

3. Generate a No Indication Alert

Create a patient with an antibiotic order but viral diagnosis (no indication for antibiotics):

cd /home/david/projects/aegis
python scripts/demo_indication_alert.py --scenario viral_with_abx

Then run the indication monitor:

cd antimicrobial-usage-alerts
python -m src.runner --indication --once --verbose

Blood Culture Scenarios

Command Scenario Alert?
--organism mrsa MRSA, no antibiotic Yes
--organism mrsa --antibiotic vancomycin MRSA with vancomycin No
--organism mrsa --antibiotic cefazolin MRSA with wrong antibiotic Yes
--organism pseudomonas Pseudomonas, no coverage Yes
--organism pseudomonas --antibiotic meropenem Pseudomonas with meropenem No
--organism candida Candida, no antifungal Yes

Antimicrobial Usage Scenarios

Command Duration Alert Level
--antibiotic meropenem --days 2 48 hours None
--antibiotic meropenem --days 4 96 hours Warning
--antibiotic vancomycin --days 7 168 hours Critical
--antibiotic ceftriaxone --days 5 120 hours None (not monitored)

Indication Monitoring Scenarios

The indication monitor classifies antibiotic orders using ICD-10 codes and clinical note extraction. Only "Never appropriate" (N) classifications generate alerts.

Demo Scenarios

Scenario Description Alert?
--scenario pneumonia Bacterial pneumonia (ICD-10 + note) No (Always appropriate)
--scenario uti Urinary tract infection No (Always appropriate)
--scenario viral_uri Viral upper respiratory infection (no antibiotics) No (No antibiotics ordered)
--scenario viral_with_abx Viral URI with unnecessary antibiotics Yes (Never appropriate)
--scenario no_indication_documented Antibiotics with no documented indication Yes (Never appropriate)
--scenario note_contradicts_icd10 ICD-10 says pneumonia, note says viral Yes (Note overrides ICD-10)

Classification Categories

Category Meaning Alert?
A Always appropriate for antibiotics No
S Sometimes appropriate No
P Prophylaxis appropriate No
N Never appropriate Yes

Two-Track Classification

The system uses two sources to determine if an antibiotic has an appropriate indication:

  1. ICD-10 Classification - Uses Chua et al. pediatric antibiotic indication mappings
  2. LLM Note Extraction - Extracts indications from clinical notes using a local LLM

Note Priority: Clinical notes take precedence over ICD-10 codes. If a note explicitly states "viral infection" but the patient has a pneumonia ICD-10 code, the system classifies as "N" (never appropriate) based on the note.

Alert Resolution Workflow

  1. View - Click on an alert to see details
  2. Acknowledge - Mark as seen (stays in active list)
  3. Snooze 4h - Temporarily suppress the alert
  4. Resolve - Close with a resolution reason:
    • Acknowledged - No action needed
    • Messaged Team - Contacted the care team
    • Discussed with Team - Had discussion with providers
    • Therapy Changed - Antibiotic regimen was modified
    • Therapy Stopped - Antibiotic was discontinued
    • Patient Discharged - Patient left the hospital

Resolved alerts move to the History tab with a full audit trail.

Interactive Demo Mode

For live demos where the audience can choose scenarios:

# Blood culture - choose organism and antibiotic interactively
python scripts/demo_blood_culture.py --interactive

# Antimicrobial usage - choose drug and duration interactively
python scripts/demo_antimicrobial_usage.py --interactive

Troubleshooting

FHIR server not responding

# Check if container is running
docker ps | grep hapi

# Restart if needed
cd asp-bacteremia-alerts
docker-compose down && docker-compose up -d

Clear all data and start fresh

# Clear FHIR server data
cd asp-bacteremia-alerts
docker-compose down && docker-compose up -d

# Clear alert database
rm -f ~/.aegis/alerts.db

Verify data was uploaded

curl "http://localhost:8081/fhir/Patient?_count=5" | python -m json.tool

Architecture

+-------------------+     +-------------------+
|   Demo Scripts    |---->|  HAPI FHIR        |
|   (add patients)  |     |  Server :8081     |
+-------------------+     +---------+---------+
                                    |
         +--------------------------+--------------------------+
         v                          v                          v
+-------------------+    +-------------------+    +-------------------+
|   Bacteremia      |    |  Broad-Spectrum   |    |   Indication      |
|    Monitor        |    |  Usage Monitor    |    |    Monitor        |
+---------+---------+    +---------+---------+    +---------+---------+
         |                        |                        |
         |                        |               +--------+--------+
         |                        |               v                 v
         |                        |      +-------------+   +-------------+
         |                        |      | ICD-10      |   | LLM Note    |
         |                        |      | (Chua)      |   | Extraction  |
         |                        |      +------+------+   +------+------+
         |                        |             |                 |
         |                        |             +--------+--------+
         |                        |                      |
         +------------------------+----------------------+
                                  v
                        +-------------------+
                        |   Alert Store     |
                        |   (SQLite)        |
                        +---------+---------+
                                  |
                   +--------------+---------------+
                   v              v               v
          +-----------+   +-----------+   +-----------+
          | Dashboard |   |   Teams   |   |   Email   |
          +-----------+   +-----------+   +-----------+
        
Demo Environment: All patient data displayed is simulated. No actual patient data is available through this dashboard.