Cat.get_entities() not finding ICU mentions

I’m trying to find “ICU” mentions.
In the trainer it finds them fine and I can annotate.

Importing the trained model or the base KCH model and calling cat.get_entities('%some ICU related phrase%) returns None.
Entering the snomed code in get name returns the correct ICU related name entries.

Entering one of those ICU related name entries in get entities also returns None.

General annotation for medical concepts also with SNOMED codes associated with them appears to work fine, but ICU/ITU mentions are ignored.

Is this normal behaviour?

Is there a flag I need to set?

Thanks

snomed_filter = [‘397821002’, ‘309904001’]

in: cat.cdb.cui2names.get(‘309904001’)

out:{‘care~critical~unit’,
‘care~critical~units’,
‘care~intensive~unit’,
‘care~intensive~units’,
‘critical~care~unit’,
‘environment~:~intensive~care~unit’,
‘environment~:~intensive~care~unit~treatment’,
‘environment~intensive~care~unit’,
‘icu’,
‘icu~intensive~care~unit’,
‘icu~intensive~care~units’,
‘intensive~care~unit’,
‘intensive~care~units’,
‘intensive~care~unit~environment’,
‘intensive~care~unit~icu’,
‘itu’,
‘i~.~c~.~u~.’,
‘i~c~u’,
‘unit~intensive~care’}

in:cat.get_entities(‘Intensive care unit (environment)’)
out:{‘entities’: {}, ‘tokens’: }
in:cat.get_entities(‘Intensive care unit’)
out:{‘entities’: {}, ‘tokens’: }

Thanks!

  • I’ve solved this problem. It seems there is a default type ID filter set. Setting it to none has allowed get_entities to return ICU mentions.

type_ids_filter =
cui_filters = set()
for type_ids in type_ids_filter:
cui_filters.update(cat.cdb.addl_info[‘type_id2cuis’][type_ids])
cat.cdb.config.linking[‘filters’][‘cuis’] = cui_filters

2 Likes

Right! Glad you found a solution. There are 3 stages that a filter can be applied:

  1. In the cat.cdb.config.linking[‘filters’][‘cuis’] = set() . Make sure that this is either blank (includes all concepts) or alternatively include only your relevant concepts (white list filter).

  2. A whitelist filter which is part of the mcttrainer to only train for those concepts. This assists in the labelling for specific concepts rather than all snomed concepts.

  3. An optional additional filter within the cat.train_supervised() function. There is an optional argument extra_cui_filter: Optional[Set] = None for users to train only a subset of concepts from filter 2.

Hopefully this clarifies things!