17
17
import org .slf4j .Logger ;
18
18
import org .slf4j .LoggerFactory ;
19
19
import org .snomed .quality .validator .mrcm .*;
20
- import org .snomed .quality .validator .mrcm .model .ReferenceSetMember ;
21
20
import org .springframework .beans .factory .annotation .Autowired ;
22
21
import org .springframework .beans .factory .annotation .Value ;
23
22
import org .springframework .stereotype .Service ;
@@ -42,6 +41,8 @@ public class MRCMValidationService {
42
41
43
42
private static final String EXT_ZIP = ".zip" ;
44
43
44
+ private static final String COMMA = "," ;
45
+
45
46
@ Autowired
46
47
private WhitelistService whitelistService ;
47
48
@@ -264,13 +265,15 @@ private TestRunItem createTestRunItemWithFailures(Assertion mrcmAssertion, Conte
264
265
List <FailureDetail > failedDetails = new ArrayList <>(firstNCount );
265
266
if (LateralizableRefsetValidationService .ASSERTION_ID_MEMBERS_NEED_TO_BE_REMOVED_FROM_LATERALIZABLE_REFSET .equals (mrcmAssertion .getUuid ().toString ())) {
266
267
for (int i = 0 ; i < firstNCount ; i ++) {
267
- ReferenceSetMember referenceSetMember = mrcmAssertion .getCurrentViolatedReferenceSetMembers ().get (i );
268
- failedDetails .add (new FailureDetail (referenceSetMember .referencedComponentId (), String .format (mrcmAssertion .getDetails (), referenceSetMember .memberId ()), null ));
268
+ ConceptResult conceptResult = mrcmAssertion .getCurrentViolatedConcepts ().get (i );
269
+ String conceptId = conceptResult .getId ();
270
+ failedDetails .add (new FailureDetail (conceptId , String .format (mrcmAssertion .getDetails (), conceptId , "removed from" ), conceptResult .getFsn ()).setFullComponent (getAdditionalFields (conceptResult )).setComponentId (conceptId ));
269
271
}
270
272
} else if (LateralizableRefsetValidationService .ASSERTION_ID_CONCEPTS_NEED_TO_BE_ADDED_TO_LATERALIZABLE_REFSET .equals (mrcmAssertion .getUuid ().toString ())) {
271
273
for (int i = 0 ; i < firstNCount ; i ++) {
272
- Long conceptId = mrcmAssertion .getCurrentViolatedConceptIds ().get (i );
273
- failedDetails .add (new FailureDetail (conceptId .toString (), String .format (mrcmAssertion .getDetails (), conceptId ), null ));
274
+ ConceptResult conceptResult = mrcmAssertion .getCurrentViolatedConcepts ().get (i );
275
+ String conceptId = conceptResult .getId ();
276
+ failedDetails .add (new FailureDetail (conceptId , String .format (mrcmAssertion .getDetails (), conceptId , "added to" ), conceptResult .getFsn ()).setFullComponent (getAdditionalFields (conceptResult )).setComponentId (conceptId ));
274
277
}
275
278
} else {
276
279
for (int i = 0 ; i < firstNCount ; i ++) {
@@ -282,4 +285,8 @@ private TestRunItem createTestRunItemWithFailures(Assertion mrcmAssertion, Conte
282
285
testRunItem .setFirstNInstances (failedDetails );
283
286
return testRunItem ;
284
287
}
288
+
289
+ private String getAdditionalFields (ConceptResult conceptResult ) {
290
+ return (conceptResult .isActive () ? "1" : "0" ) + COMMA + conceptResult .getModuleId () + COMMA + conceptResult .getDefinitionStatusId ();
291
+ }
285
292
}
0 commit comments