fix: skip empty MHC items and add similarity threshold (closes #7, #8) #125
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.
Description
This PR addresses two related issues with MHC (Mental Health Catalogue) matching:
Issue Remove empty items from MHC #7 - Remove empty items from MHC: Empty or whitespace-only MHC questions are now skipped during matching. This prevents invalid items from being matched to user questions.
Issue Don't match to MHC items if similarity is too low #8 - Don't match to MHC items if similarity is too low: Added a new
mhc_min_similarityparameter that allows filtering out matches below a similarity threshold. Default is 0.0 for backward compatibility, but can be set higher (e.g., 0.5) to filter unrelated matches.Changes
matcher.pyto build a mask of valid MHC questions and skip empty/whitespace itemsmhc_min_similarityparameter to bothmatch_instruments_with_functionandmatch_instrumentsTesting
test_empty_mhc_questions_are_skippedtest_whitespace_only_mhc_questions_are_skippedtest_low_similarity_no_matchtest_high_similarity_matchtest_threshold_filters_unrelatedUsage
Fixes #7, #8