Skip to content

fix(medcat-trainer): Fix Concepts tab for CDBs with no heirarchy#532

Merged
alhendrickson merged 2 commits into
mainfrom
fix/medcat-trainer/concepts-explorer
Jun 11, 2026
Merged

fix(medcat-trainer): Fix Concepts tab for CDBs with no heirarchy#532
alhendrickson merged 2 commits into
mainfrom
fix/medcat-trainer/concepts-explorer

Conversation

@alhendrickson

@alhendrickson alhendrickson commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Existing Behavior

When used with a CDB that isn't a full SNOMED one, the concepts tab currently fails silently for the user. The network call gives a 400 "Requested MedCAT CDB model does not include parent2child metadata to explore a concept hierarchy"

image

This change fixes it by supporting a flat tree under a dummy root node. It just returns the first 500 concepts, a limit hardcoded for now

New Behavior

image

@tomolopolis tomolopolis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thanks for fixing the obv issues with this screen. a 'warning' / notice or even disabling this tab gracefully for those cdb's with no pt2ch map likely makes sense

{'cui': FLAT_CDB_ROOT_CUI, 'pretty_name': 'All concepts'},
]})
cuis = sorted(cdb.cui2info)[:FLAT_CDB_CHILDREN_LIMIT]
return Response({'results': [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we 'warn' that the model does not allow ontology navigation due to pt2ch map metadata missing? and / or this has been limited to CHILDREN_LIMIT in the resp?

The whole idea of the concepts tab was an easy way to build out a filter for a given project. Which this still allows over just throwing an error so does make sense.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would agree some UI side warning would be really useful. In general as well we could do with more toasts/errors etc shown around

Made a ticket on https://app.clickup.com/t/20516280/869dnb54u

@alhendrickson alhendrickson merged commit 8aa3152 into main Jun 11, 2026
13 of 14 checks passed
@alhendrickson alhendrickson deleted the fix/medcat-trainer/concepts-explorer branch June 11, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants