Skip to content

Commit cf4c1bb

Browse files
authored
Merge pull request #127 from onc-healthit/feature/SITE-4361
Update interaction with SNOMED codes to fix duplicate rows error (SITE-4361)
2 parents 4674f7d + f53ad7b commit cf4c1bb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/main/java/org/sitenv/vocabularies/validation/repositories/CodeRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public interface CodeRepository extends JpaRepository<Code, Integer> {
3434

3535
List<Code> findByCodeAndCodeSystemIn(String code, List<String> codesystems);
3636

37-
@Query("SELECT c.active FROM Code c WHERE c.code = :code and c.codeSystem in (:codesystems)")
37+
@Query("SELECT c.active FROM Code c WHERE c.code = :code and c.codeSystem in (:codesystems) and c.active = true and ROWNUM() < 2 ")
3838
boolean codeIsActive(@Param("code")String code, @Param("codesystems")Set<String> codesystems);
3939
}

src/main/java/org/sitenv/vocabularies/validation/validators/nodetypes/CodeSystemCodeValidator.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@ public List<VocabularyValidationResult> validateNode(ConfiguredValidator configu
7373
nodeValidationResult.setCodeSystemFound(true);
7474
if(codeRepository.foundCodeInCodesystems(nodeCode, allowedConfiguredCodeSystemNames)){
7575
nodeValidationResult.setNodeCodeFound(true);
76-
try {
77-
if (!codeRepository.codeIsActive(nodeCode, allowedConfiguredCodeSystemNames)) {
78-
nodeValidationResult.setNodeCodeIsActive(false);
79-
}
80-
} catch (NonUniqueResultException nonUniqueResultException) {
81-
nodeValidationResult.setNodeCodeIsActive(false);
82-
logger.error(
83-
"The following error was encountered when trying to check codeRepository.codeIsActive(...). "
84-
+ "It will be handled internally and considered inactive as the source is likely corrupt "
85-
+ "since it is returning multiple values.",
86-
nonUniqueResultException);
76+
try {
77+
if (!codeRepository.codeIsActive(nodeCode, allowedConfiguredCodeSystemNames)) {
78+
nodeValidationResult.setNodeCodeIsActive(false);
79+
}
80+
} catch (NonUniqueResultException nonUniqueResultException) {
81+
nodeValidationResult.setNodeCodeIsActive(false);
82+
logger.error(
83+
"The following error was encountered when trying to check codeRepository.codeIsActive(...). "
84+
+ "It will be handled internally and considered inactive as the source is likely corrupt "
85+
+ "since it is returning multiple values.",
86+
nonUniqueResultException);
8787

88-
}
88+
}
8989
}
9090
if(codeRepository.foundDisplayNameInCodesystems(nodeDisplayName, allowedConfiguredCodeSystemNames)){
9191
nodeValidationResult.setNodeDisplayNameFound(true);

0 commit comments

Comments
 (0)