Skip to content

Add CDC Adult Sepsis Event (ASE) criteria implementation#110

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-sepsis-flag-function
Draft

Add CDC Adult Sepsis Event (ASE) criteria implementation#110
Copilot wants to merge 4 commits intomainfrom
copilot/add-sepsis-flag-function

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 28, 2025

Implements CDC Adult Sepsis Event surveillance criteria as compute_sepsis() function based on reference implementations in ASE_revised_thresholds_wbc_temp and CLIF_sepsis repositories.

Changes

New module: clifpy/utils/sepsis.py

  • compute_sepsis() - Main function implementing ASE criteria
  • Helper functions for each component:
    • _identify_presumed_infection() - Blood culture + QAD ≥4 (or ≥1 with early death/transfer)
    • _identify_organ_dysfunction_vasopressors() - Vasopressor initiation within window
    • _identify_organ_dysfunction_ventilation() - IMV within window
    • _identify_organ_dysfunction_labs() - AKI, hyperbilirubinemia, thrombocytopenia, lactate

ASE criteria (both required):

  • Presumed infection: Blood culture + qualifying antibiotic days
  • Organ dysfunction: Vasopressors OR IMV OR lab dysfunction (within ±2 days)

Testing & documentation:

  • 14 unit tests covering all criteria paths and edge cases
  • Working demo in examples/sepsis_demo.py
  • Complete API documentation in docs/sepsis_module.md

Usage

from clifpy.utils import compute_sepsis

sepsis_df = compute_sepsis(
    blood_cultures=bc_df,           # hospitalization_id, collect_dttm, fluid_category
    antibiotics=abx_df,             # hospitalization_id, admin_dttm, med_group
    hospitalization=hosp_df,        # hospitalization_id, discharge_dttm, discharge_category
    labs=labs_df,                   # hospitalization_id, lab_category, lab_value_numeric, lab_result_dttm
    continuous_meds=meds_df,        # Optional: vasopressor data
    respiratory_support=resp_df,    # Optional: IMV data
    window_days=2,                  # Configurable
    include_lactate=True            # Optional criterion
)
# Returns: hospitalization_id, ase_flag, presumed_infection_time, first_organ_dysfunction_time, organ_dysfunction_type

Follows existing patterns (DuckDB-based like compute_sofa), handles missing data gracefully, includes configurable time windows.

References:

Original prompt

This section details on the original issue you should resolve

<issue_title>add sepsis flag</issue_title>
<issue_description>start with the sepsis ASE critiera as implemented in two projects:

https://github.com/dmh0817/ASE_revised_thresholds_wbc_temp

https://github.com/Common-Longitudinal-ICU-data-Format/CLIF_sepsis</issue_description>

<agent_instructions>Read the repositories linked in the issue, find the code that implements the sepsis criteria and convert to a clifpy function</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 28, 2025 21:41
Co-authored-by: 08wparker <36900536+08wparker@users.noreply.github.com>
Co-authored-by: 08wparker <36900536+08wparker@users.noreply.github.com>
Co-authored-by: 08wparker <36900536+08wparker@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sepsis flag based on ASE criteria Add CDC Adult Sepsis Event (ASE) criteria implementation Oct 28, 2025
Copilot AI requested a review from 08wparker October 28, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add sepsis function

2 participants