Repository navigation
fix(medcat-trainer): open FP, FN, and TP example dialogs - #635
Open
tomolopolis wants to merge 6 commits into
Open
tomolopolis wants to merge 6 commits into
tomolopolis wants to merge 6 commits into
Conversation
Clicking a concept count failed when the metrics table did not hand back the original row, so the example dialog never opened. Current MedCAT stats examples also use snake_case fields, which left the dialog unable to show or link those occurrences, and unescaped clinical text could break rendering. Resolve examples without object identity, accept both key styles, escape note text, and mount the dialog on document.body. Co-authored-by: tomolopolis <tomolopolis@users.noreply.github.com>
type=button matched Vuetify's color:inherit rule and overrode the outline button colors. Keep true positives green, false negatives grey, and false positives red. Co-authored-by: tomolopolis <tomolopolis@users.noreply.github.com>
Bootstrap outline colors were still lost once later button rules reset --bs-btn-color. Set the NHS green, grey, and red on the count buttons themselves so a non-zero number keeps its colour. Co-authored-by: tomolopolis <tomolopolis@users.noreply.github.com>
Non-zero TP, FN, and FP counts take --success, --warning, and --danger from the NHS theme map instead of hardcoded hex values. Co-authored-by: tomolopolis <tomolopolis@users.noreply.github.com>
… appearing alongside the context to the right of the mention
tomolopolis
marked this pull request as ready for review
October 18, 2026 16:40
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.
Summary
Clicking a non-zero FP, FN, or TP count on a completed metrics report did not reliably open the example dialog.
The count button looked up the concept with
Array.indexOf. The metrics table does not always pass the original row object (it can pass a copy, or its internal{ type: 'item', raw }wrapper). That lookup returned-1and the click threw before the dialog was shown.Examples from current MedCAT
get_statsalso use snake_case fields (document_id,source_value). The dialog still expected the older spaced keys (document id,source value), so rows that did open could not show the note or link through to the annotation. Clinical text was interpolated into a Vue template without escaping, so characters such as<or{{could break that render.The count colours were also lost. Vuetify sets
color: inheritonbuttonand[type=button], and later.btnrules reset--bs-btn-colorto the default text colour. Non-zero counts now use the NHS theme variables: true positivesvar(--success), false negativesvar(--warning), and false positivesvar(--danger). Those variables are set from$theme-colors(green, grey, and red). Zero counts stay disabled.Changes
document.bodyand open it after the click, so it is not clipped or closed by the same click.Testing
npx vitest run src/tests/components/MetricsConceptSummary.spec.ts(5 tests passed). The count test checks that non-zero buttons stay enabled and that the theme variables are used.$theme-colors, a non-zero TP computed torgb(0, 150, 57), FN torgb(118, 134, 146), and FP torgb(218, 41, 28). A zero count stayed the default text colour.