Add IMV episode detection function#128
Open
clifford-clif wants to merge 1 commit intoCommon-Longitudinal-ICU-data-Format:mainfrom
Open
Add IMV episode detection function#128clifford-clif wants to merge 1 commit intoCommon-Longitudinal-ICU-data-Format:mainfrom
clifford-clif wants to merge 1 commit intoCommon-Longitudinal-ICU-data-Format:mainfrom
Conversation
Implements logic to identify discrete invasive mechanical ventilation episodes from respiratory_support data. Leverages the fact that observed ventilator measurements don't occur when the ventilator is in standby. Episode logic: - IMV_start: First *_obs variable (excluding resp_rate_obs) with device_category='IMV' - IMV_end: Last *_obs followed by non-IMV documentation (other device or lpm_set>0) New functions: - detect_imv_episodes(): Returns DataFrame with one row per IMV episode - calculate_ventilator_free_days(): Calculates VFDs from episodes Closes Common-Longitudinal-ICU-data-Format#127
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new utility function to identify discrete invasive mechanical ventilation (IMV) episodes from respiratory_support data.
Changes
Episode Logic
Leverages the fact that observed ventilator measurements don't occur when the ventilator is in standby:
esp_rate_obs) where \device_category = 'IMV'\
Relevant *_obs\ columns (excluding resp_rate_obs):
Output
\\python
from clifpy.utils import detect_imv_episodes
episodes = detect_imv_episodes(respiratory_support_df)
Returns DataFrame:
hospitalization_id | imv_episode_id | imv_start_dttm | imv_end_dttm | duration_hours | has_tracheostomy
\\
VFD Calculation
\\python
from clifpy.utils import calculate_ventilator_free_days
vfds = calculate_ventilator_free_days(episodes, hospitalization_df, observation_window_days=28)
Returns: hospitalization_id | ventilator_free_days | total_imv_days | died
\\
Closes #127