-
Notifications
You must be signed in to change notification settings - Fork 7
feat(medcat-trainer): improved / fixed demo screen #293
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
Conversation
… clinical text component, improved demo filtering concept picker
mart-r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor questions / comments.
Didn't look at the vue or ts stuff - if it displyas it displays.
Looks good overall.
| try: | ||
| cat = get_medcat_from_model_pack_id(int(modelpack_id)) | ||
| except (ValueError, TypeError): | ||
| return HttpResponseBadRequest('Invalid modelpack_id') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the ID in the exception?
| except (ValueError, TypeError): | ||
| return HttpResponseBadRequest('Invalid modelpack_id') | ||
| except ModelPack.DoesNotExist: | ||
| return HttpResponseBadRequest('ModelPack does not exist') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the ID in the exception?
| logger.warning(f'Failed to get children for CUI {parent_cui}: {e}') | ||
| cuis_set = expanded_cuis | ||
|
|
||
| cat.config.components.linking.filters.cuis = cuis_set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this was always the case, but could this potentially cause issues? I.e since the same model packs instances are (potentially) used across multiple projects at once, I could see this creating unexpected filtering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good point, fixed
| logger.warning(f'Failed to get children for CUI {parent_cui}: {e}') | ||
| cuis_set = expanded_cuis | ||
|
|
||
| curr_cuis = cat.config.components.linking.filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a context manager would be better here?
I.e using https://docs.cogstack.org/projects/nlp/en/latest/autoapi/medcat/utils/config_utils/index.html#medcat.utils.config_utils.temp_changed_config
something like:
with temp_changed_config(cat.config.components.linking, 'filters', cuis_set):
spacy_doc = cat(message)
ClinicalTextcomponent, so entering example text and viewing the annotated version is on the same looking componentcdb_search_filterused for