# Cat.get\_entities() not finding ICU mentions

**URL:** <https://discourse.cogstack.org/t/cat-get-entities-not-finding-icu-mentions/64>\
**Category:** MedCAT\
**Created:** [July 7, 2022, 3:32pm UTC](https://discourse.cogstack.org/t/cat-get-entities-not-finding-icu-mentions/64 "2022-07-07T15:32:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samora](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samora](https://discourse.cogstack.org/u/Samora)\
**Post date:** [July 7, 2022, 3:32pm UTC](https://discourse.cogstack.org/t/cat-get-entities-not-finding-icu-mentions/64/1 "2022-07-07T15:32:22Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Samora](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samora](https://discourse.cogstack.org/u/Samora)\
**Post date:** [July 8, 2022, 10:03am UTC](https://discourse.cogstack.org/t/cat-get-entities-not-finding-icu-mentions/64/2 "2022-07-08T10:03:49Z")

</div>

- 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

---

<div class="post-metadata">

**Author:** ![anthony.shek](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anthony.shek](https://discourse.cogstack.org/u/anthony.shek)\
**Post date:** [July 20, 2022, 9:00pm UTC](https://discourse.cogstack.org/t/cat-get-entities-not-finding-icu-mentions/64/3 "2022-07-20T21:00:54Z")

</div>

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!
