Skip to content

fix(medcat): Take mapGroup from the mapGroup column in SNOMED refset maps - #681

Merged
mart-r merged 1 commit into
CogStack:mainfrom
chenyangsu:fix/snomed-refset-map-group
Nov 26, 2026
Merged

mart-r merged 1 commit into
CogStack:mainfrom
chenyangsu:fix/snomed-refset-map-group

Conversation

@chenyangsu

Copy link
Copy Markdown
Contributor

Snomed._refset_df2dict fills mapGroup from the mapPriority column:

'mapGroup': row['mapPriority'],

so map_snomed2icd10() and map_snomed2opcs4() report each target's priority as its group. For a concept mapped to E11.9 in group 1 and Z79.4 in group 2, both at priority 1, both targets come out with mapGroup '1'. The change reads row['mapGroup'].

There were no v2 tests for preprocess_snomed, so the new test writes a two-row International extended map refset into a temporary release folder and runs Snomed(path).map_snomed2icd10() on it.

The same line is in v1/medcat/medcat/utils/preprocess_snomed.py. I left v1 alone, but can fix it in this PR if you want.

Testing: python -m unittest tests.model_creation.test_preprocess_snomed: 3 tests OK; test_keeps_map_group fails on main with ['1', '1'] != ['1', '2']. ruff check medcat --preview and mypy pass.

…maps

Snomed._refset_df2dict filled 'mapGroup' with the mapPriority value, so
map_snomed2icd10 and map_snomed2opcs4 reported the priority as the group
for every target.

@mart-r mart-r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yep, clearly a bug!

Thanks for another contribution!

@mart-r
mart-r merged commit f53f649 into CogStack:main Nov 26, 2026
18 of 19 checks passed
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