Adult Sepsis Event Identification in CLIF

CDC ASE Algorithm Flow Diagrams

1. Overall ASE Algorithm Flow

The CDC Adult Sepsis Event (ASE) requires both presumed serious infection (Component A) and acute organ dysfunction (Component B) to be present within ±2 calendar days of blood culture.

flowchart TD
    Start[Load Hospitalization IDs]
    LoadData[Load CLIF Data Tables]
    CompA[Component A: Presumed Infection]
    CompB[Component B: Organ Dysfunction]
    BC[Blood Culture Detection]
    QAD[Calculate QAD]
    Censor[Apply Censoring Rules]
    LabDys[Lab-based Dysfunction]
    ClinDys[Clinical Interventions]
    AKI[AKI: Creatinine 2x baseline]
    Bili[Hepatic: Bilirubin 2.0 AND 2x baseline]
    Plat[Coagulation: Platelets low]
    Lact[Lactate 2.0 mmol/L]
    Vaso[New Vasopressor]
    IMV[New IMV]
    PICheck{Presumed Infection}
    ODCheck{Any Organ Dysfunction}
    CheckBoth{Both Components Present}
    NoSepsis1[No Sepsis: No Presumed Infection]
    NoSepsis2[No Sepsis: No Organ Dysfunction]
    NoSepsis3[No Sepsis]
    ASE[ASE Sepsis Event]
    OnsetType{Onset Type}
    Community[Community Onset]
    Hospital[Hospital Onset]
    RIT{Apply RIT}
    Output[Output Results]
    RITFilter[14-day RIT Filter]

    Start --> LoadData
    LoadData --> CompA
    LoadData --> CompB
    CompA --> BC
    BC --> QAD
    QAD --> Censor
    CompB --> LabDys
    CompB --> ClinDys
    LabDys --> AKI
    LabDys --> Bili
    LabDys --> Plat
    LabDys --> Lact
    ClinDys --> Vaso
    ClinDys --> IMV
    Censor --> PICheck
    AKI --> ODCheck
    Bili --> ODCheck
    Plat --> ODCheck
    Lact --> ODCheck
    Vaso --> ODCheck
    IMV --> ODCheck
    PICheck -->|Yes| CheckBoth
    PICheck -->|No| NoSepsis1
    ODCheck -->|Yes| CheckBoth
    ODCheck -->|No| NoSepsis2
    CheckBoth -->|Yes| ASE
    CheckBoth -->|No| NoSepsis3
    ASE --> OnsetType
    OnsetType -->|Day 1-2| Community
    OnsetType -->|Day 3+| Hospital
    Hospital --> RIT
    Community --> Output
    RIT -->|Yes| RITFilter
    RIT -->|No| Output
    RITFilter --> Output
            
↑ Back to Top

2. Component A: Presumed Serious Infection

Presumed infection requires a blood culture with ≥4 Qualifying Antimicrobial Days (QAD) starting within ±2 calendar days, including at least one new IV/IM antimicrobial.

flowchart TD
    BCStart[Blood Cultures]
    BCTime[Extract Culture Time]
    BCWindow[Define 2 Day Window]
    ABXStart[Antibiotics]
    ABXFilter[Filter CMS Qualifying ABX]
    ABXRoute[Identify IV/IM Routes]
    ABXCourse[Define Courses]
    ABXWindow{New ABX Course in Window}
    NoQAD[No QAD: No new antimicrobial]
    IVIM{Any New IV/IM in Window}
    NoQAD2[No QAD: No parenteral]
    QADCalc[Calculate QAD Days]
    QADCheck{4+ QAD Days}
    MeetsQAD[Meets QAD]
    CensorCheck{Censoring Eligible}
    CensorQAD[Meets QAD with Censoring]
    FailQAD[Fails QAD]
    PresInf[Presumed Infection = 1]
    NoPresInf[Presumed Infection = 0]

    BCStart --> BCTime
    BCTime --> BCWindow
    ABXStart --> ABXFilter
    ABXFilter --> ABXRoute
    ABXRoute --> ABXCourse
    BCWindow --> ABXWindow
    ABXCourse --> ABXWindow
    ABXWindow -->|No| NoQAD
    ABXWindow -->|Yes| IVIM
    IVIM -->|No| NoQAD2
    IVIM -->|Yes| QADCalc
    QADCalc --> QADCheck
    QADCheck -->|Yes| MeetsQAD
    QADCheck -->|No| CensorCheck
    CensorCheck -->|Death/Transfer/Hospice| CensorQAD
    CensorCheck -->|No| FailQAD
    MeetsQAD --> PresInf
    CensorQAD --> PresInf
    FailQAD --> NoPresInf
    NoQAD --> NoPresInf
    NoQAD2 --> NoPresInf
            

📋 Key Implementation Details

Vancomycin Handling: IV and oral vancomycin treated as separate antimicrobials
Course Gaps: >2 calendar days between doses = new course
QAD Gaps: 1-day gaps allowed in QAD calculation (q48h dosing)
Censoring: Death, transfer to acute care, or hospice within 3 days allows <4 QAD
Blood Culture Time: Uses collect_dttm as primary timestamp
↑ Back to Top

3. Component B: Organ Dysfunction

At least one organ dysfunction must occur within ±2 calendar days of blood culture. Dysfunction can be lab-based (AKI, hepatic, coagulation, metabolic) or clinical intervention-based (cardiovascular, respiratory).

flowchart TD
    ODStart[Organ Dysfunction]
    BaselineType{BC Day 2 or less}
    CommBase[Community Baseline]
    HospBase[Hospital Baseline]
    LabTests[Lab Tests in 2 Day Window]
    Cr[Creatinine]
    BiliTest[Bilirubin]
    Plt[Platelets]
    LactTest[Lactate]
    CrCheck{Value 2x+ Baseline}
    AKIDys[AKI Dysfunction]
    NoAKI[No AKI]
    BiliCheck{Value 2.0+ AND 2x+ Baseline}
    BiliDys[Hepatic Dysfunction]
    NoBili[No Hepatic]
    PltCheck{Value below 100 AND 50% or less of Baseline}
    PltDys[Coagulation Dysfunction]
    NoPlt[No Coagulation]
    LactCheck{Value 2.0+}
    LactDys[Metabolic Dysfunction]
    NoLact[No Metabolic]
    ClinInt[Clinical Interventions]
    VasoCheck{New Vasopressor in 2 days}
    IMVCheck{New IMV in 2 days}
    VasoDys[CV Dysfunction]
    NoVaso[No CV]
    IMVDys[Respiratory Dysfunction]
    NoIMV[No Respiratory]
    AnyDys{Any Dysfunction Present}
    HasOD[Has Organ Dysfunction]
    NoOD[No Organ Dysfunction]

    ODStart --> BaselineType
    BaselineType -->|Yes| CommBase
    BaselineType -->|No| HospBase
    CommBase --> LabTests
    HospBase --> LabTests
    LabTests --> Cr
    LabTests --> BiliTest
    LabTests --> Plt
    LabTests --> LactTest
    Cr --> CrCheck
    CrCheck -->|Yes and Not ESRD| AKIDys
    CrCheck -->|No or ESRD| NoAKI
    BiliTest --> BiliCheck
    BiliCheck -->|Yes| BiliDys
    BiliCheck -->|No| NoBili
    Plt --> PltCheck
    PltCheck -->|Yes and Baseline 100+| PltDys
    PltCheck -->|No or Invalid Baseline| NoPlt
    LactTest --> LactCheck
    LactCheck -->|Yes| LactDys
    LactCheck -->|No| NoLact
    ClinInt --> VasoCheck
    ClinInt --> IMVCheck
    VasoCheck -->|Yes| VasoDys
    VasoCheck -->|No| NoVaso
    IMVCheck -->|Yes| IMVDys
    IMVCheck -->|No| NoIMV
    AKIDys --> AnyDys
    BiliDys --> AnyDys
    PltDys --> AnyDys
    LactDys --> AnyDys
    VasoDys --> AnyDys
    IMVDys --> AnyDys
    AnyDys -->|Yes| HasOD
    AnyDys -->|No| NoOD
            

🔬 Lab Value Processing

Outlier Caps: Cr ≤20, Bili ≤80, Plt ≤2000, Lactate ≤30 mg/dL
ESRD Exclusion: ICD codes N18.6, Z49.31, Z49.01, I12.0, I13.11, I13.2
Platelet Baseline: Only valid if any baseline value ≥100
Procedural Exclusion: Vasopressors in OR/procedural locations ignored
New Initiation: >1 day gap from previous dose = new initiation
↑ Back to Top

4. Type Classification: Baseline Selection vs Final Onset Type

Important: There are TWO distinct type classifications in the ASE algorithm that serve different purposes. The first determines baseline selection for labs, the second determines the final onset type for RIT filtering.

4A. Type for Baseline Selection (Based on Blood Culture Date)

This classification determines which baseline values to use for lab-based organ dysfunction. It is calculated EARLY in the pipeline based on when the blood culture was collected.

flowchart TD
    subgraph BaselineSelection[Type for Baseline Selection]
        BCDate[Blood Culture Date]
        AdmDate[Admission Date]
        CalcDay1[Hospital Day = BC Date - Admission Date + 1]
        Check1{Hospital Day <= 2}
        CommBase[type_for_baseline = community]
        HospBase[type_for_baseline = hospital]
        UseAll[Use ENTIRE hospitalization for baseline]
        UseWindow[Use 2 day window around BC for baseline]
        
        BCDate --> CalcDay1
        AdmDate --> CalcDay1
        CalcDay1 --> Check1
        Check1 -->|Yes| CommBase
        Check1 -->|No| HospBase
        CommBase --> UseAll
        HospBase --> UseWindow
    end
    
    subgraph BaselineValues[Baseline Value Selection]
        CrMin1[Creatinine: MIN of all values]
        BiliMin1[Bilirubin: MIN of all values]
        PltMax1[Platelets: MAX if any >= 100]
        CrMin2[Creatinine: MIN in window]
        BiliMin2[Bilirubin: MIN in window]
        PltMax2[Platelets: MAX >= 100 in window]
        
        UseAll --> CrMin1
        UseAll --> BiliMin1
        UseAll --> PltMax1
        UseWindow --> CrMin2
        UseWindow --> BiliMin2
        UseWindow --> PltMax2
    end
            
Key Point: This type is used ONLY for selecting baseline lab values. It does NOT determine the final onset classification for RIT purposes.

4B. Final Onset Type (Based on ASE Onset Datetime)

This classification determines the FINAL onset type reported in results and used for RIT filtering. It is calculated AFTER ASE determination based on when the ASE onset occurred (earliest time when both Component A and B are satisfied).

flowchart TD
    subgraph FinalOnsetType[Final Onset Type for RIT]
        ASEOnset[ASE Onset Datetime]
        AdmDate2[Admission Date]
        CalcDay2[Onset Hospital Day = ASE Onset Date - Admission Date + 1]
        Check2{Onset Hospital Day <= 2}
        CommFinal[type = community]
        HospFinal[type = hospital]
        NoRIT[No RIT Applied]
        ApplyRIT[Apply 14-day RIT Filter]
        
        ASEOnset --> CalcDay2
        AdmDate2 --> CalcDay2
        CalcDay2 --> Check2
        Check2 -->|Yes| CommFinal
        Check2 -->|No| HospFinal
        CommFinal --> NoRIT
        HospFinal --> ApplyRIT
    end
            
Key Difference:
type_for_baseline uses blood_culture_dttm — determines lab baseline window
type (final) uses ase_onset_w_lactate_dttm — determines RIT application

📊 Summary: Two Type Classifications

Aspect type_for_baseline type (final)
Based On Blood Culture Date ASE Onset Datetime
Purpose Select baseline values for labs Classify event & apply RIT
When Calculated Early (baseline selection step) Final (after ASE determination)
Can be NULL No (always has BC) Yes (if no sepsis)
Output Column Internal use only Reported in results
↑ Back to Top

5. Resolving the Circular Dependency

The CDC ASE definition contains an inherent circular dependency that must be resolved for computation. This section explains the problem and how this implementation solves it.

The Problem

🔄 Circular Dependency:

To calculate ONSET DATE: → Need organ dysfunction datetime → To get dysfunction datetime, need to compare lab value to BASELINE → To know which BASELINE to use, need to know if Community or Hospital onset → To know onset type, need ONSET DATE → 🔄 CIRCULAR!

The CDC Specification

From CDC Toolkit Page 22:

"Baseline creatinine defined as:
1) Community-onset: lowest value during hospitalization
2) Hospital-onset: lowest value in ±2 days of blood culture"

Key insight: The hospital-onset baseline window is defined relative to the blood culture date, not the onset date. This provides a computational anchor.

Our Solution: Calculate Both, Then Select

The implementation breaks the circular dependency by computing organ dysfunction using both baselines simultaneously, then selecting based on blood culture timing.

flowchart TD
    subgraph Step1[STEP 1: Calculate BOTH Baselines]
        BC[Blood Culture Event]
        CommCalc[Community Baseline
Entire hospitalization] HospCalc[Hospital Baseline
±2 days of BC] BC --> CommCalc BC --> HospCalc CommCalc --> AKI_CO[aki_dttm_co] CommCalc --> BILI_CO[hyperbili_dttm_co] CommCalc --> PLT_CO[thrombo_dttm_co] HospCalc --> AKI_HO[aki_dttm_ho] HospCalc --> BILI_HO[hyperbili_dttm_ho] HospCalc --> PLT_HO[thrombo_dttm_ho] end subgraph Step2[STEP 2: Select Based on BC Timing] BCDay{Blood Culture
Hospital Day} BCDay -->|Day 1-2| UseComm[type_for_baseline = community] BCDay -->|Day 3+| UseHosp[type_for_baseline = hospital] UseComm --> SelectCO[Use: aki_dttm_co,
hyperbili_dttm_co,
thrombo_dttm_co] UseHosp --> SelectHO[Use: aki_dttm_ho,
hyperbili_dttm_ho,
thrombo_dttm_ho] end subgraph Step3[STEP 3: Calculate ASE Onset] SelectCO --> OnsetCalc[ASE Onset = EARLIEST of:
• Blood culture
• First QAD
• Vasopressor
• IMV
• Selected lab dysfunction] SelectHO --> OnsetCalc end subgraph Step4[STEP 4: Final Onset Type] OnsetCalc --> FinalDay{ASE Onset
Hospital Day} FinalDay -->|Day 1-2| Community[type = community
No RIT] FinalDay -->|Day 3+| Hospital[type = hospital
Apply RIT] end

Two "Types" Serve Different Purposes

Variable Based On Purpose
type_for_baseline Blood culture date (Day 1-2 vs Day 3+) Selects which baseline calculation to use for labs
type (final) ASE onset datetime Reported in results; determines RIT application
↑ Back to Top

6. Repeat Infection Timeframe (RIT) Logic

The 14-day RIT prevents counting repeat infections within a short timeframe. Typically applied only to hospital-onset events to avoid overcounting.

flowchart TD
    AllASE[All ASE Events]
    TypeFilter{Onset Type}
    NoRIT[No RIT Applied]
    RITApply[Apply RIT]
    Sort[Sort by Onset Date]
    First[Keep First Event]
    Next[Check Next Event]
    TimeGap{Days Since Last Kept}
    Skip[Skip Event]
    Keep[Keep Event]
    NextEvent[Next Event]
    UpdateLast[Update Last Kept]
    MoreEvents{More Events}
    AssignID[Assign Episode IDs]
    FinalOutput[Final ASE Results]

    AllASE --> TypeFilter
    TypeFilter -->|Community| NoRIT
    TypeFilter -->|Hospital| RITApply
    RITApply --> Sort
    Sort --> First
    First --> Next
    Next --> TimeGap
    TimeGap -->|14 days or less| Skip
    TimeGap -->|Over 14 days| Keep
    Skip --> NextEvent
    Keep --> UpdateLast
    UpdateLast --> NextEvent
    NextEvent --> MoreEvents
    MoreEvents -->|Yes| Next
    MoreEvents -->|No| AssignID
    NoRIT --> AssignID
    AssignID --> FinalOutput
            

🔄 RIT Implementation

Window: 14 calendar days from last kept event
Application: Default only for hospital-onset (configurable)
Episode IDs: Sequential numbering after RIT filtering
Community Events: Always kept regardless of timing
↑ Back to Top

7. Key Decision Points

Critical decision points in the ASE algorithm and their implementation in the code.

Decision Criteria Implementation
Blood Culture Time Primary timestamp for all calculations Uses collect_dttm
Antimicrobial Course When is an antimicrobial "new"? Gap >2 calendar days from last dose = new course
QAD Calculation How to count qualifying days Allow 1-day gaps (for q48h dosing), require ≥4 days total
Censoring Events When to allow <4 QAD discharge_category Expired, acute care hospital, or hospice within 3 days of QAD start
ESRD Identification How to exclude ESRD patients from AKI diagnosis_code: N18.6, Z49.31, Z49.01, I12.0, I13.11, I13.2
Vasopressor Location Which locations to exclude location_category procedural
IMV Definition What counts as invasive mechanical ventilation device_category IMV
Onset Type Community vs Hospital Blood culture on hospital days 1-2 from admission_dttm= Community, Day 3+ = Hospital
RIT Application Which events get RIT filtering Default: Hospital-onset only (configurable)
Episode Assignment How to number ASE episodes Sequential numbering after RIT filtering, reset per hospitalization
📊 Validation Points: The algorithm includes extensive validation at each step, including outlier capping, data type checking, and logical consistency verification. All edge cases are logged for transparency and debugging.
↑ Back to Top