Episode event domain lookup; better error if concept not found
MaximMoinat opened this issue · comments
The error below is thrown by wrapper.get_event_field_concept_id(concept_id)
when the given concept_id
cannot be found in the vocabulary. This actually indicates that the vocabulary has not been loaded correctly, but the error message is very cryptical AttributeError: 'NoneType' object has no attribute 'split'
.
We should gracefully handle this exception by showing a simple warning message.
Please note that normally this would give an error in an earlier stage as the concept_id constraint do not hold for the earlier inserted (observation) record. I got below error when I removed the vocabulary constraints when running at the client who could not load the vocabs.
2020-05-12 10:45:50,386 - ERROR - No row was found for one()
2020-05-12 10:45:50,386 - INFO - Performing rollback
2020-05-12 10:45:50,389 - INFO - Rollback completed
2020-05-12 10:51:13,976 - ERROR - #!#! ERROR: Transformation 'basedata_to_episode_event' failed:
2020-05-12 10:51:13,981 - ERROR - Traceback (most recent call last):
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/model/EtlWrapper.py", line 217, in execute_transformation
records_to_insert = statement(self)
AttributeError: 'NoneType' object has no attribute 'split'
2020-05-12 10:51:13,982 - ERROR - 'NoneType' object has no attribute 'split'
2020-05-12 10:51:13,982 - ERROR - ##### START FULL TRACEBACK #####
2020-05-12 10:51:13,984 - ERROR -
Traceback (most recent call last):
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/model/EtlWrapper.py", line 217, in execute_transformation
records_to_insert = statement(self)
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/transformation/basedata_to_episode_event.py", line 113, in basedata_to_episode_event
event_field_concept_id = wrapper.get_event_field_concept_id(target.concept_id)
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/wrapper.py", line 321, in get_event_field_concept_id
domain_prefix = domain_id.split('_')[0]
AttributeError: 'NoneType' object has no attribute 'split'
#Traceback (most recent call last):
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/model/EtlWrapper.py", line 217, in execute_transformation
records_to_insert = statement(self)
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/transformation/basedata_to_episode_event.py", line 113, in basedata_to_episode_event
event_field_concept_id = wrapper.get_event_field_concept_id(target.concept_id)
File "/Users/Maxim/Develop/OHDSI/ohdsi-etl-prias/src/main/python/wrapper.py", line 321, in get_event_field_concept_id
domain_prefix = domain_id.split('_')[0]
AttributeError: 'NoneType' object has no attribute 'split'