Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check whether patient_id exists in the meds_reader database #66

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/cehrbert/data_generators/hf_data_generator/meds_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ def _meds_to_cehrbert_generator(
with meds_reader.SubjectDatabase(path_to_db) as patient_database:
for shard in shards:
for patient_id, prediction_time, label in shard:
patient = patient_database[patient_id]
yield convert_one_patient(patient, conversion, prediction_time, label)
if patient_id in patient_database:
patient = patient_database[patient_id]
yield convert_one_patient(patient, conversion, prediction_time, label)


def _create_cehrbert_data_from_meds(
Expand Down
Loading