Skip to content

Commit d116d13

Browse files
committed
Let a module opt out of the redundant stated IsA policy
Redundantly-stated IsA is an editorial policy, and not every edition has adopted it. AMT and AU clinical content state both an AMT parent and the international top parent it sits under, deliberately. It is not confined to the drug hierarchy, so a semantic-tag exemption is the wrong shape for it. The rule now fires for every module except those listed under redundant-isa-exempt-modules in the test resources. An edition that lists nothing - which is every edition until it chooses otherwise - gets exactly the behaviour this rule had before the key existed. An extension whose maintainers do want the policy keeps it, which scoping the rule to core modules would have taken away from them. Requires isInNamedSet on DescriptionService. Measured over a 722,404-concept edition, rule sets common-authoring,au-authoring: key absent 352,500 findings, byte-identical to unmodified rules key = AU 346,263 findings, 6,237 dropped, 0 added Every one of the 6,237 is on the module named in the key. The 287 findings on inherited international core-module concepts are all still reported.
1 parent 55795d5 commit d116d13

2 files changed

Lines changed: 99 additions & 2 deletions

File tree

common-authoring/relationships/redundant-is-a-relationship/RedundantIsaRelationship.drl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ global java.util.List invalidContent
1313
global ConceptService conceptService
1414
global DescriptionService descriptionService
1515

16+
// Redundantly-stated IsA is an editorial policy, and not every edition has
17+
// adopted it. A module whose id is listed under redundant-isa-exempt-modules in
18+
// the test resources is not held to it; every other module is, including the
19+
// international core and including extension modules whose maintainers do want
20+
// the rule. An edition that lists nothing - which is every edition until it
21+
// chooses otherwise - gets exactly the behaviour this rule had before the key
22+
// existed.
1623
rule "Redundantly stated IsA relationships."
1724
dialect "mvel"
1825
when
19-
c : Concept(active)
26+
c : Concept(active, !descriptionService.isInNamedSet("redundant-isa-exempt-modules", moduleId))
2027
r1 : Relationship(active && sourceId == c.id && typeId == Constants.IS_A && characteristicTypeId == Constants.STATED_RELATIONSHIP && !axiomGCI)
2128
r2 : Relationship(active && sourceId == c.id && typeId == Constants.IS_A && characteristicTypeId == Constants.STATED_RELATIONSHIP && !axiomGCI && r1.id != id)
2229
statedAncestors : ArrayList(size > 0) from collect( String() from conceptService.findStatedAncestorsOfConcepts(Collections.singletonList(r1.destinationId)))
Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,94 @@
11
{
2+
"givenConcepts": [
3+
{
4+
"id": "116680003", // Is a
5+
"active": true,
6+
"descriptions": [
7+
{
8+
"id": "isa",
9+
"term": "Is a (attribute)"
10+
}
11+
]
12+
},
13+
{
14+
// Grandparent, international core module.
15+
"id": "100001",
16+
"active": true,
17+
"moduleId": "900000000000207008",
18+
"descriptions": [
19+
{
20+
"id": "d1",
21+
"typeId": "900000000000003001", // FSN
22+
"term": "Grandparent (finding)",
23+
"acceptabilityMap": {
24+
"900000000000509007": "900000000000548007" // PREFERRED
25+
}
26+
}
27+
]
28+
},
29+
{
30+
// Parent, stated child of the grandparent.
31+
"id": "100002",
32+
"active": true,
33+
"moduleId": "900000000000207008",
34+
"descriptions": [
35+
{
36+
"id": "d2",
37+
"typeId": "900000000000003001", // FSN
38+
"term": "Parent (finding)",
39+
"acceptabilityMap": {
40+
"900000000000509007": "900000000000548007" // PREFERRED
41+
}
42+
}
43+
],
44+
"relationships": [
45+
{
46+
"id": "r0",
47+
"active": true,
48+
"typeId": "116680003", // is-a
49+
"destinationId": "100001",
50+
"characteristicTypeId": "900000000000010007" // STATED
51+
}
52+
]
53+
}
54+
],
255
"assertConceptsPass": [],
3-
"assertConceptsFail": []
56+
// A concept on an extension module, stating both its parent and the
57+
// grandparent that parent already sits under. The rule must still fire:
58+
// redundant-isa-exempt-modules is absent from the test resources, which is
59+
// the state of every edition that has not opted out, and the rule has to
60+
// behave there exactly as it did before the key existed.
61+
"assertConceptsFail": [
62+
{
63+
"id": "100003",
64+
"active": true,
65+
"moduleId": "32506021000036107",
66+
"descriptions": [
67+
{
68+
"id": "d3",
69+
"typeId": "900000000000003001", // FSN
70+
"term": "Child (finding)",
71+
"acceptabilityMap": {
72+
"900000000000509007": "900000000000548007" // PREFERRED
73+
}
74+
}
75+
],
76+
"relationships": [
77+
{
78+
"id": "r1",
79+
"active": true,
80+
"typeId": "116680003", // is-a
81+
"destinationId": "100002",
82+
"characteristicTypeId": "900000000000010007" // STATED
83+
},
84+
{
85+
"id": "r2",
86+
"active": true,
87+
"typeId": "116680003", // is-a
88+
"destinationId": "100001",
89+
"characteristicTypeId": "900000000000010007" // STATED
90+
}
91+
]
92+
}
93+
]
494
}

0 commit comments

Comments
 (0)