Skip to content
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

MAT-6393: Massage data if oid no url provided #81

Merged
merged 5 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading