Repository navigation
fix(medcat): Take mapGroup from the mapGroup column in SNOMED refset maps - #681
Merged
Merged
Conversation
…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.
chenyangsu
requested review from
adam-sutton-1992,
mart-r and
vladd-bit
as code owners
November 26, 2026 13:04
mart-r
approved these changes
Nov 26, 2026
mart-r
left a comment
Collaborator
There was a problem hiding this comment.
Yep, clearly a bug!
Thanks for another contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Snomed._refset_df2dictfillsmapGroupfrom themapPrioritycolumn:so
map_snomed2icd10()andmap_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 withmapGroup'1'. The change readsrow['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 runsSnomed(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_groupfails on main with['1', '1'] != ['1', '2'].ruff check medcat --previewand mypy pass.