NHSN Reporting - Demo & Help
Back to DashboardOverview
The NHSN Reporting module helps Antimicrobial Stewardship and Infection Prevention teams track and report:
- AU (Antibiotic Usage) - Days of Therapy (DOT) and Defined Daily Doses (DDD) by antimicrobial and location
- AR (Antimicrobial Resistance) - Resistance rates and phenotype tracking (MRSA, VRE, CRE, etc.)
- HAI (Healthcare-Associated Infections) - Confirmed HAI events (CLABSI, CAUTI, etc.) for NHSN submission
Data is extracted from the hospital EHR (Epic Clarity) and formatted for NHSN submission.
Quick Start - Generate Demo Data
1. Generate Mock Clarity Data
Create demo patients with antibiotic orders and culture results:
# Navigate to nhsn-reporting module
cd /home/david/projects/aegis/nhsn-reporting
# Generate patients with AU/AR data
python -m mock_clarity.generate_data \
--db-path ./mock_clarity.db \
--patients 50 \
--months 3 \
--all-scenarios \
--au-ar
This creates:
- 50 patients with encounters across multiple locations
- ~100 medication orders with MAR administrations (AU data)
- ~50 cultures with organisms and susceptibilities (AR data)
- Various CLABSI scenarios for HAI detection
2. View the Data
After generating data, visit the dashboards:
- AU/AR Dashboard - Overview of usage and resistance
- AU Detail - Detailed antibiotic usage by drug and location
- AR Detail - Resistance rates and phenotype prevalence
AU (Antibiotic Usage) Reporting
Data Pipeline
- Extract - Query medication orders and MAR administrations from Clarity
- Map - Match medications to NHSN antimicrobial codes (VAN, TZP, MEM, etc.)
- Aggregate - Calculate DOT and DDD by location, drug, and month
- Export - Generate CSV formatted for NHSN submission
Key Metrics
| Metric | Definition | Use |
|---|---|---|
| Days of Therapy (DOT) | Count of unique calendar days a patient received any dose of an antimicrobial | Primary NHSN measure - reflects duration of therapy |
| Defined Daily Dose (DDD) | Total grams administered / WHO DDD reference dose | Alternative measure - reflects total drug volume |
| DOT/1000 Patient Days | DOT normalized by patient census | Allows comparison across units of different sizes |
Antimicrobial Categories
NHSN groups antimicrobials into categories for reporting:
AR (Antimicrobial Resistance) Reporting
Data Pipeline
- Extract - Query culture results and susceptibilities from Clarity
- First Isolate Rule - Deduplicate: one isolate per patient/organism/quarter
- Calculate Rates - Percent resistance for each organism/antibiotic combination
- Detect Phenotypes - Identify MRSA, VRE, CRE, ESBL based on susceptibility patterns
- Export - Generate CSV formatted for NHSN submission
NHSN First Isolate Rule
To avoid counting the same infection multiple times, NHSN applies the "first isolate rule":
- Only the first isolate of each organism species per patient per quarter is counted
- Subsequent positive cultures for the same organism are excluded
- Different species from the same patient are counted separately
Tracked Phenotypes
| Phenotype | Definition | Pattern |
|---|---|---|
| MRSA | Methicillin-resistant S. aureus | Oxacillin R |
| VRE | Vancomycin-resistant Enterococcus | Vancomycin R |
| CRE | Carbapenem-resistant Enterobacterales | Meropenem R or Ertapenem R |
| ESBL | Extended-spectrum beta-lactamase | CTX R + CAZ R + FEP S (typical pattern) |
| CRPA | Carbapenem-resistant P. aeruginosa | Meropenem R or Imipenem R |
HAI (Healthcare-Associated Infection) Reporting
The NHSN Reporting module also includes confirmed HAI events from the HAI Detection workflow.
HAI Types
| HAI Type | Status | Description |
|---|---|---|
| CLABSI | Implemented | Central Line-Associated Bloodstream Infection |
| CAUTI | Planned | Catheter-Associated Urinary Tract Infection |
| VAE | Planned | Ventilator-Associated Events |
| SSI | Planned | Surgical Site Infection |
HAI Workflow
- Detection - Rule-based screening identifies HAI candidates (BSI + device + timing)
- Classification - LLM extracts facts from notes, rules engine applies NHSN criteria
- IP Review - Infection Preventionist makes final determination in HAI Detection
- Reporting - Confirmed HAIs appear in HAI Detail and Submission
CLABSI Criteria (Quick Reference)
- Central line in place for >2 calendar days on the date of event
- Line was in place at time of BSI OR within 1 day of removal
- Laboratory-confirmed bloodstream infection (LCBI)
- BSI is not secondary to infection at another site
For detailed HAI detection guidance, see the HAI Detection Help page.
Denominators
NHSN requires denominator data to normalize rates across different unit sizes:
| Denominator | Used For | Data Source |
|---|---|---|
| Patient Days | AU (DOT/1000 PD), AR rates | Census from ADT data |
| Central Line Days | CLABSI rates | Flowsheet documentation |
| Urinary Catheter Days | CAUTI rates | Flowsheet documentation |
| Ventilator Days | VAE/VAP rates | Flowsheet documentation |
View and verify denominators on the Denominators page.
NHSN Submission
AU Submission (Monthly)
- Go to Submission page
- Select the reporting month
- Review the data summary by location and drug
- Click "Export CSV" to download the NHSN-formatted file
- Upload to NHSN via the Antimicrobial Use and Resistance (AUR) module
AR Submission (Quarterly)
- Go to Submission page
- Select the reporting quarter
- Review first isolates, resistance rates, and phenotype counts
- Click "Export CSV" to download the NHSN-formatted file
- Upload to NHSN via the Antimicrobial Use and Resistance (AUR) module
Export Format
The exported CSV files follow NHSN specifications:
# AU Export columns:
orgID, locationCode, summaryYM, antimicrobialCode, daysOfTherapy, patientDays
# AR Export columns:
orgID, locationCode, year, quarter, organismCode, firstIsolates,
antibioticCode, susceptible, intermediate, resistant
Architecture
+----------------------+ +----------------------+
| Mock Clarity DB | | Production Clarity |
| (SQLite demo) | | (Oracle/SQL Server) |
+----------+-----------+ +----------+-----------+
| |
+-------------+--------------+
v
+---------------------+
| AU/AR Extractors |
| (SQLAlchemy) |
+----------+----------+
|
+---------------+---------------+
v v v
+----------------+ +--------------+ +----------------+
| AU Aggregation | | AR Analysis | | Denominators |
| (DOT, DDD) | | (First | | (Patient Days, |
| | | Isolate) | | Device Days) |
+-------+--------+ +------+-------+ +-------+--------+
| | |
+--------+--------+---------+-------+
v v
+----------------+ +----------------+
| Dashboard UI | | NHSN Export |
| (Flask) | | (CSV/CDA) |
+----------------+ +----------------+
Demo Data Generation Options
Command-Line Arguments
python -m mock_clarity.generate_data [options]
Options:
--db-path PATH Database file path (default: ./mock_clarity.db)
--patients N Number of random patients (default: 50)
--months N Months of historical data (default: 3)
--all-scenarios Generate CLABSI test scenarios
--au-ar Generate AU/AR data (orders, cultures, susceptibilities)
--au-encounters N Number of encounters with AU data (default: 50)
--ar-encounters N Number of encounters with AR data (default: 30)
Example Scenarios
# Minimal demo data
python -m mock_clarity.generate_data --patients 10 --months 1 --au-ar
# Full demo with all scenarios
python -m mock_clarity.generate_data --patients 100 --months 6 --all-scenarios --au-ar
# Only AR data (resistance reporting focus)
python -m mock_clarity.generate_data --patients 30 --au-ar --au-encounters 0 --ar-encounters 50
Generated Organisms
The demo data includes realistic organism/susceptibility combinations:
- S. aureus - MSSA and MRSA variants
- E. coli - Susceptible and MDR variants
- K. pneumoniae - Susceptible and CRE variants
- P. aeruginosa - Susceptible and CRPA variants
- E. faecalis/faecium - Susceptible and VRE variants
- E. cloacae - With typical AmpC resistance
Troubleshooting
No data showing on dashboards
# Verify database has data
sqlite3 ./mock_clarity.db "SELECT COUNT(*) FROM ORDER_MED;"
sqlite3 ./mock_clarity.db "SELECT COUNT(*) FROM CULTURE_RESULTS;"
# Regenerate if needed
python -m mock_clarity.generate_data --au-ar
Database connection error
# Check environment variable
echo $CLARITY_DB_URL
# For demo, use SQLite:
export CLARITY_DB_URL="sqlite:////home/david/projects/aegis/nhsn-reporting/mock_clarity.db"
NHSN mapping missing
# Check antimicrobial mappings
sqlite3 ./mock_clarity.db "SELECT * FROM NHSN_ANTIMICROBIAL_MAP LIMIT 5;"
# Check phenotype definitions
sqlite3 ./mock_clarity.db "SELECT * FROM NHSN_PHENOTYPE_MAP;"
Restart the Flask application
# Kill existing process
pkill -f "gunicorn.*dashboard"
# Restart
cd /home/david/projects/aegis/dashboard
gunicorn -w 2 -b 0.0.0.0:8082 app:app
Links
- AU/AR Dashboard - Overview of usage and resistance
- AU Detail - Detailed antibiotic usage analysis
- AR Detail - Resistance rates and phenotypes
- Denominators - Patient-days and device-days
- NHSN Submission - Export data for NHSN upload
- HAI Detection Help - Help for CLABSI/HAI detection
- ASP Alerts Help - Help for bacteremia and usage alerts