Skip to content

Commit 7429b4d

Browse files
authored
skip the events that occurred before the observation window starte date instead of breaking out of the for loop (#115)
1 parent 2d3ad18 commit 7429b4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cehrbert/data_generators/hf_data_generator/patient_block.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ def omop_meds_generate_demographics_and_patient_blocks(
373373
# Skip out of the loop if the events' time stamps are beyond the prediction time
374374
if prediction_time is not None and e.time > prediction_time:
375375
break
376-
# Skip out of the loop if the events' time stamps are before the observation start window
376+
# Skip the events that occurred before observation start window
377377
if observation_start_window is not None and e.time < observation_start_window:
378-
break
378+
continue
379379
if getattr(e, "visit_id", None):
380380
visit_id = e.visit_id
381381
visit_events[visit_id].append(e)
@@ -567,10 +567,10 @@ def mimic_meds_generate_demographics_and_patient_blocks(
567567
if e.time > prediction_time:
568568
break
569569

570-
# Skip out of the loop if the events' time stamps are before observation start window
570+
# Skip the events that occurred before observation start window
571571
if observation_start_window is not None and e.time is not None:
572572
if e.time < observation_start_window:
573-
break
573+
continue
574574

575575
# This indicates demographics features
576576
event_code_uppercase = e.code.upper()

0 commit comments

Comments
 (0)