Hey there!
I was working on setting up the CLMBR-t-base model on EHRSHOT Benchmark. While tokenizing the input sequence, I observed some issues regarding the birth code as follows:
- The tokenizer looks for the birth code
SNOMED/184099003 to encode sequence, whereas the benchmark data has SNOMED/3950001 code at the beginning of each sequence.
- The code
SNOMED/3950001 is not even in the provided dictionary, and the model ignores it completely when it is present in the sequence.
- The FEMR tokenizer fails when trying to tokenize a patient sequence and results in this error:
ValueError Traceback (most recent call last)
Cell In[94], line 3
1 patient = polars_timeline_to_femr_patient(history)
----> 3 raw_batch = batch_processor.convert_patient(patient, tensor_type="pt")
4 batch = batch_processor.collate([raw_batch])
6 with torch.no_grad():
File ~/.conda/envs/med-ehr/lib/python3.9/site-packages/femr/models/processor.py:391, in FEMRBatchProcessor.convert_patient(self, patient, offset, max_length, tensor_type, **formatter_kwargs)
372 """Convert a single patient to a batch.
373
374 Note that this can also convert parts of a patient to a batch using the offset and max_length parameters.
(...)
388 A batch, ready to be fed into a FEMR transformer model
389 """
390 self.creator.start_batch()
--> 391 self.creator.add_patient(patient, offset=offset, max_length=max_length)
392 batch_data = self.creator.get_batch_data()
393 if tensor_type is not None:
File ~/.conda/envs/med-ehr/lib/python3.9/site-packages/femr/models/processor.py:163, in BatchCreator.add_patient(self, patient, offset, max_length)
160 if self.task is not None:
161 self.task.start_patient(patient, self.tokenizer.ontology)
--> 163 birth = femr.pat_utils.get_patient_birthdate(patient)
164 self.tokenizer.start_patient()
166 for event in patient["events"]:
167 # We want to avoid duplicate codes in the same day, so we maintain codes_seen_today
File ~/.conda/envs/med-ehr/lib/python3.9/site-packages/femr/pat_utils.py:11, in get_patient_birthdate(patient)
9 if m["code"] == meds.birth_code:
10 return e["time"]
---> 11 raise ValueError("Couldn't find patient birthdate -- Patient has no events " + str(patient["events"][:5]))
ValueError: Couldn't find patient birthdate -- removed as its part of the data
Packages:
- femr==0.2.3
- meds==0.1.3
- meds_reader==0.1.16
Hey there!
I was working on setting up the CLMBR-t-base model on EHRSHOT Benchmark. While tokenizing the input sequence, I observed some issues regarding the birth code as follows:
SNOMED/184099003to encode sequence, whereas the benchmark data hasSNOMED/3950001code at the beginning of each sequence.SNOMED/3950001is not even in the provided dictionary, and the model ignores it completely when it is present in the sequence.Packages: