Skip to content

Commit

Permalink
Merge pull request #81 from MeasureAuthoringTool/MAT-6393a
Browse files Browse the repository at this point in the history
MAT-6393: Massage data if oid no url provided
  • Loading branch information
mcmcphillips authored May 22, 2024
2 parents ef7d1fc + b288b8f commit 1fe322b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/gov/cms/madie/terminology/service/VsacService.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public List<CqlCode> validateCodes(List<CqlCode> cqlCodes, UmlsUser umlsUser, St
String codeSystemVersion = buildCodeSystemVersion(cqlCode, codeSystemEntry.get());
String codeId = cqlCode.getCodeId();
if (codeId == null || TerminologyServiceUtil.sanitizeInput(codeId).isBlank()) {
log.debug("Code id is not available for code {}", cqlCode.getName());
log.info("Code id is not available for code {}", cqlCode.getName());
cqlCode.setValid(false);
cqlCode.setErrorMessage("Code Id is required");
} else if (!StringUtils.isBlank(codeSystemVersion)) {
Expand All @@ -143,15 +143,15 @@ public List<CqlCode> validateCodes(List<CqlCode> cqlCodes, UmlsUser umlsUser, St
}
} else {
// unidentified code system.
log.debug(
"No associated Code system found in code system entry json for {}",
cqlCode.getCodeSystem().getOid());
log.info(
"No associated Code system found in code system entry json for {}",
cqlCode.getCodeSystem().getOid());
cqlCode.getCodeSystem().setValid(false);
cqlCode.getCodeSystem().setErrorMessage("Invalid Code system");
}
} else {
// if oid/url is not provided in cql, then the code system is considered invalid.
log.debug("CodeSystem {} does not contain any URL", cqlCode.getCodeSystem().getName());
log.info("CodeSystem {} does not contain any URL", cqlCode.getCodeSystem().getName());
cqlCode.getCodeSystem().setValid(false);
cqlCode.getCodeSystem().setErrorMessage("Code system URL is required");
}
Expand Down Expand Up @@ -280,11 +280,13 @@ private void buildVsacErrorMessage(CqlCode cqlCode, VsacCode vsacCode) {
&& StringUtils.isNumeric(vsacCode.getErrors().getResultSet().get(0).getErrCode())) {
int errorCode = Integer.parseInt(vsacCode.getErrors().getResultSet().get(0).getErrCode());
if (errorCode == 800 || errorCode == 801) {
log.info("Error code is 800, or 801 from VSAC. Error: {}", vsacCode.getErrors().getResultSet().get(0));
cqlCode.getCodeSystem().setValid(false);
cqlCode
.getCodeSystem()
.setErrorMessage(vsacCode.getErrors().getResultSet().get(0).getErrDesc());
} else if (errorCode == 802) {
log.info("Error code is 802 from VSAC. Error: {}", vsacCode.getErrors().getResultSet().get(0));
cqlCode.setValid(false);
cqlCode.setErrorMessage(vsacCode.getErrors().getResultSet().get(0).getErrDesc());
}
Expand All @@ -296,6 +298,7 @@ private void buildVsacErrorMessage(CqlCode cqlCode, VsacCode vsacCode) {
+ "If this error persists, please contact the Help Desk.");
} else {
cqlCode.setValid(false);
log.info("Error code is uncaught. General catch, Error: {} status: {}", vsacCode.getErrors().getResultSet().get(0), vsacCode.getStatus());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public String getCodeSystemsPage(Integer offset, Integer count, String apiKey) {
public String searchValueSets(String apiKey, Map<String, String> queryParams) {
if (queryParams.containsKey("url")) {
String urlValue = queryParams.get("url");
// if the value does not contain the vsac url we add it
if (!urlValue.startsWith("http://cts.nlm.nih.gov/fhir/ValueSet/")) {
urlValue = "http://cts.nlm.nih.gov/fhir/ValueSet/" + urlValue;
}
// if user didnt add htpp:// we do
if (!urlValue.startsWith("http://")) {
urlValue = "http://" + urlValue;
Expand Down

0 comments on commit 1fe322b

Please sign in to comment.