Skip to content

Commit

Permalink
MAT-7038: Modify cs retrieve to return displayValues for vsac version
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmcphillips committed Apr 30, 2024
1 parent fd86a27 commit 89b263a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class CodeSystem {
private String title;
private String name;
private String version;
private String displayVersion; // match version HL7V3.0_2019-12 against fhir
private String versionId;
private String oid; // identifier[0].value oid of identifier List
private Instant lastUpdated; // when queried
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;

@Service
@Slf4j
Expand Down Expand Up @@ -122,7 +124,49 @@ private List<QdmValueSet.Concept> getValueSetConcepts(
}

public List<CodeSystem> getAllCodeSystems() {
return codeSystemRepository.findAll();
// remove items that are marked as not present in vsac to cut expense
List<CodeSystemEntry> codeSystemEntries = mappingService.getCodeSystemEntries().stream().filter(codeSystemEntry -> !codeSystemEntry.getOid().contains("NOT.IN.VSAC")).toList();
List<CodeSystem> codeSystems = codeSystemRepository.findAll();
List<CodeSystem> transformedResults = new ArrayList<>(Collections.emptyList());
codeSystems.forEach(codeSystem -> {
// if the oid shows up at all
int index = -1;
for (int i = 0; i < codeSystems.size(); i++) {
if (codeSystems.get(i).getOid().equals(codeSystem.getOid())) {
index = i;
break;
}
}
if(index != -1) {
CodeSystemEntry matchingEntry = null;
for (CodeSystemEntry entry : codeSystemEntries) {
if (entry.getOid().equals(codeSystem.getOid())) {
matchingEntry = entry;
break;
}
}
if (matchingEntry != null) {
AtomicBoolean usableVersionFound = new AtomicBoolean(false);
matchingEntry.getVersions().forEach(version -> {
// we use fhir csv to interact with api. goal here is to look for fhir version, then give users a display version
// that looks like vsac because that's what they understand.
if (version.getFhir().equals(codeSystem.getVersion()) && version.getVsac() != null) {
codeSystem.setDisplayVersion(version.getVsac());
transformedResults.add(codeSystem);
usableVersionFound.set(true);
}
});
if (usableVersionFound.get()){
log.info("CodeSystem title {} , version: {} was not found in mapping document", codeSystem.getTitle(), codeSystem.getVersion());
}
}
}
else {
// it was not found, we log that it's not located within vsac.
log.info("CodeSystem title {} , version: {} was not found in mapping document", codeSystem.getTitle(), codeSystem.getName());
}
});
return transformedResults;
}

public List<CodeSystem> retrieveAllCodeSystems(UmlsUser umlsUser) {
Expand Down

0 comments on commit 89b263a

Please sign in to comment.