mrcm_validator
Validate role-grouped attribute predictions against SNOMED CT MRCM and grouping rules.
Usage::
from ariadne.hierarchy.mrcm import MrcmRules
from ariadne.hierarchy.mrcm_validator import validate_role_groups
rules = MrcmRules.load(config.hierarchy.mrcm, config.hierarchy.attributes)
violations = validate_role_groups(results, rules) # one row per violation
Rules (rule column):
========================= ======== ========================================================
rule severity meaning
========================= ======== ========================================================
unknown_attribute error attribute key not configured in hierarchy.attributes
attribute_not_in_domain error MRCM does not allow the attribute in the term's domain
attribute_cardinality error number of values of the attribute violates MRCM cardinality
in_group_cardinality error too many values of the attribute in one role group
grouped_mismatch error grouped attribute in group 0, or ungrouped attribute in a role group
self_grouped_shared error self-grouped attribute shares its role group
cluster_mix error attributes from different grouping clusters share a group
missing_required_partner error e.g. interpretation without interprets in its group
attribute_range error value outside the MRCM range (only with is_a)
duplicate_group warning two role groups with identical content
ambiguous_grouping warning grouping fell back to positional pairing
========================= ======== ========================================================
validate_result(result, rules, is_a=None)
Validate one pipeline result. Results without role_groups are grouped first.
Source code in src/ariadne/hierarchy/mrcm_validator.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
validate_role_groups(results, rules, is_a=None)
Validate pipeline results; returns one row per violation (VIOLATION_COLUMNS).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
list[dict]
|
Pipeline result dicts (with or without |
required |
rules
|
MrcmRules
|
Loaded MRCM rules. |
required |
is_a
|
IsAFunction | None
|
Optional |
None
|
Source code in src/ariadne/hierarchy/mrcm_validator.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |