-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SO-5535: MRCM evaluations #1068
Conversation
... members with no generated relationships
Codecov ReportBase: 64.23% // Head: 64.26% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## 8.x #1068 +/- ##
============================================
+ Coverage 64.23% 64.26% +0.02%
- Complexity 12467 12516 +49
============================================
Files 1734 1741 +7
Lines 58217 58451 +234
Branches 5372 5394 +22
============================================
+ Hits 37396 37562 +166
- Misses 18506 18567 +61
- Partials 2315 2322 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
...omed.core.rest.tests/src/com/b2international/snowowl/snomed/core/request/SnomedMrcmTest.java
Show resolved
Hide resolved
...omed.core.rest.tests/src/com/b2international/snowowl/snomed/core/request/SnomedMrcmTest.java
Show resolved
Hide resolved
@@ -386,5 +397,97 @@ public static SnomedRepositoryCommitRequestBuilder prepareCommit() { | |||
public static SnomedConceptSearchRequestBuilder prepareGetSynonyms() { | |||
return prepareSearchConcept().all().filterByActive(true).filterByEcl("<<"+Concepts.SYNONYM); | |||
} | |||
|
|||
|
|||
public static Promise<Collection<String>> getApplicableTypes(final IEventBus bus, final String resourcePath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's push this completely to the server side as one request to form a new Java API.
requestBuilder.filterByAncestor(SnomedConstants.Concepts.CONCEPT_MODEL_DATA_ATTRIBUTE); | ||
} else if (!needsDataAttributes && needsObjectAttributes) { | ||
requestBuilder.filterByAncestor(SnomedConstants.Concepts.CONCEPT_MODEL_OBJECT_ATTRIBUTE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add another else block with a meaningful comment for the missing case (both boolean parameters are false).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer applicable.
.execute(bus); | ||
}).thenWith(members -> { | ||
Set<String> typeIds = members.stream().map(m -> m.getReferencedComponentId()).collect(Collectors.toSet()); | ||
if ((needsDataAttributes && needsObjectAttributes) || typeIds.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if I specify both boolean parameters with the value false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to use an enum instead, so this wouldn't happen.
} | ||
|
||
def searchRelationshipsInUnregulatedDomains = { | ||
String regulatedDomainSpace = Joiner.on(" OR ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is an ECL OR operator, then use Ecl.or
helper instead.
String regulatedDomainSpace = Joiner.on(" OR ") | ||
.join(FluentIterable.from(domainMembers.values()) | ||
.transform({ m -> m.getProperties().get(SnomedRf2Headers.FIELD_MRCM_DOMAIN_CONSTRAINT)}) | ||
.transform({ c -> "(${c})"})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This becomes unnecessary if you use that Ecl.or
helper I think.
.transform({ m -> m.getProperties().get(SnomedRf2Headers.FIELD_MRCM_DOMAIN_CONSTRAINT)}) | ||
.transform({ c -> "(${c})"})); | ||
|
||
Set<String> unregulatedDomainSpace = getApplicableConcepts("* MINUS (${regulatedDomainSpace})"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Ecl.exclude
helper.
//Find non-IsA relationships in domains where no MRCM rule is defined | ||
ExpressionBuilder relationshipQueryBuilder = Expressions.builder() | ||
.filter(SnomedRelationshipIndexEntry.Expressions.active()) | ||
.filter(SnomedRelationshipIndexEntry.Expressions.sourceIds(unregulatedDomainSpace)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is regulated/unregulated the same as sanctioned/unsanctioned? If yes, please rename these variables to the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They might, I was trying to make a distinction between cases that break an explicit rule, vs cases that aren't covered by any rules. To me, an attribute that breaks an explicit rule is an unsanctioned attribute, attributes in domains that have no rules defined for them are unregulated.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do offer both sanctioned and unsanctioned properties for selection.
.domainConstraint(String.format("<<%s", Concepts.CONCEPT_MODEL_ATTRIBUTE)) | ||
.build(); | ||
|
||
final SnomedRefSetMemberIndexEntry mrcmAttributeDomainMember1 = member(Concepts.FINDING_SITE, Concepts.REFSET_MRCM_ATTRIBUTE_DOMAIN_INTERNATIONAL) | ||
.referenceSetType(SnomedRefSetType.MRCM_ATTRIBUTE_DOMAIN) | ||
.refsetId(Concepts.REFSET_MRCM_ATTRIBUTE_DOMAIN_INTERNATIONAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have test cases for failing/passing OWL Axiom MRCM relationships?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we do.
...omed.core.rest.tests/src/com/b2international/snowowl/snomed/core/request/SnomedMrcmTest.java
Show resolved
Hide resolved
...snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedMrcmRestService.java
Outdated
Show resolved
Hide resolved
...snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedMrcmRestService.java
Outdated
Show resolved
Hide resolved
...snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedMrcmRestService.java
Outdated
Show resolved
Hide resolved
...med.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmRangeRequest.java
Outdated
Show resolved
Hide resolved
...omed.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
.setFields(ID, MRCM_RULE_REFSET_ID) | ||
.build() | ||
.execute(context) | ||
.stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use all() anymore unless you have a really good reason to do so. Also, using all + stream together is a no go. Please set the limit correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This request queries a small set of module scope members, which should be kept in practice at a low member count (the current tally is 3, and the expected count is 3 × number of modules declaring MRCM rules). stream()
is called on the returned collection resource and processes individual members, not batches.
...omed.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
...omed.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
...omed.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
...med.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmRangeRequest.java
Outdated
Show resolved
Hide resolved
...omed.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
...omed.datastore/src/com/b2international/snowowl/snomed/datastore/request/MrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
...ternational.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint.groovy
Outdated
Show resolved
Hide resolved
...tional.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint_type.groovy
Show resolved
Hide resolved
//Find non-IsA relationships in domains where no MRCM rule is defined | ||
ExpressionBuilder relationshipQueryBuilder = Expressions.builder() | ||
.filter(SnomedRelationshipIndexEntry.Expressions.active()) | ||
.filter(SnomedRelationshipIndexEntry.Expressions.sourceIds(unregulatedDomainSpace)) |
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
...ternational.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint.groovy
Outdated
Show resolved
Hide resolved
...attributes are needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small observation below. I think the rest of my requests were addressed, so LGTM otherwise!
...snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedMrcmRestService.java
Outdated
Show resolved
Hide resolved
...snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedMrcmRestService.java
Outdated
Show resolved
Hide resolved
...atastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedMrcmTypeRequest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥓
Related ticket: https://snowowl.atlassian.net/browse/SO-5501