Do remove excluded tests 2 (#988)

* WIP remove excluded tests + disable breaking test

* Fix failing test, document test cases.

* Code cleanup

The following are cherry picked from GG branch:

* Fix problem with value set validator hiding errors

* Fix issue rendering resource by name

* fix error location

Co-authored-by: dotasek <david.otasek@smilecdr.com>
Co-authored-by: Grahame Grieve <grahameg@gmail.ccom>
This commit is contained in:
dotasek 2022-11-14 13:30:26 -05:00 committed by GitHub
parent 220cf6b531
commit d724d48f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 10 deletions

View File

@ -1016,6 +1016,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
return res;
}
String localError = null;
if (options.isUseClient()) {
// ok, first we try to validate locally
try {
@ -1028,6 +1029,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
return res;
}
} catch (Exception e) {
localError = e.getMessage();
}
}
@ -1055,6 +1057,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
} catch (Exception e) {
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
}
if (!res.isOk() && localError != null) {
res.setMessage("Local Error: "+localError+". Server Error: "+res.getMessage());
}
updateUnsupportedCodeSystems(res, code, codeKey);
if (txCache != null) { // we never cache unsupported code systems - we always keep trying (but only once per run)
txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT);

View File

@ -223,8 +223,24 @@ public class DirectWrappers {
s = s + " " + family.getValues().get(0).primitiveValue().toUpperCase();
return s;
} else {
// it might be a human name?
throw new Error("What to do? Type is "+b.fhirType());
Property p = b.getChildByName("name");
if (p == null || !p.hasValues()) {
p = b.getChildByName("name");
}
if (p == null || !p.hasValues()) {
p = b.getChildByName("text");
}
if (p == null || !p.hasValues()) {
p = b.getChildByName("value");
}
if (p == null || !p.hasValues()) {
p = b.getChildByName("productName"); // MedicinalProductDefinition
}
if (p == null || !p.hasValues()) {
throw new Error("What to render for 'name'? Type is "+b.fhirType());
} else {
return p.getValues().get(0).primitiveValue();
}
}
}
return null;

View File

@ -240,7 +240,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.CODESYSTEM_CS_NO_SUPPLEMENT, cs.getUrl()));
}
if (cs!=null && cs.getContent() != CodeSystemContentMode.COMPLETE) {
warningMessage = "Resolved system "+system+", but the definition is not complete";
warningMessage = "Resolved system "+system+(cs.hasVersion() ? " (v"+cs.getVersion()+")" : "")+", but the definition is not complete";
if (!inExpansion && cs.getContent() != CodeSystemContentMode.FRAGMENT) { // we're going to give it a go if it's a fragment
throw new FHIRException(warningMessage);
}

View File

@ -551,7 +551,7 @@ public class NpmPackage {
for (JsonElement e : folder.index.getAsJsonArray("files")) {
JsonObject fi = e.getAsJsonObject();
if (Utilities.existsInList(JsonUtilities.str(fi, "resourceType"), types)) {
res.add(new PackageResourceInformation(folder.folder.getAbsolutePath(), fi));
res.add(new PackageResourceInformation(folder.folder == null ? "@"+folder.getName() : folder.folder.getAbsolutePath(), fi));
}
}
}
@ -1145,7 +1145,12 @@ public class NpmPackage {
}
public InputStream load(PackageResourceInformation p) throws FileNotFoundException {
return new FileInputStream(p.filename);
if (p.filename.startsWith("@")) {
String[] pl = p.filename.substring(1).split("\\/");
return new ByteArrayInputStream(folders.get(pl[0]).content.get(pl[1]));
} else {
return new FileInputStream(p.filename);
}
}
public Date dateAsDate() {

View File

@ -550,8 +550,8 @@ SEARCHPARAMETER_EXP_WRONG = The expression ''{2}'' is not compatible with the ex
VALUESET_NO_SYSTEM_WARNING = No System specified, so Concepts and Filters can't be checked
VALUESET_INCLUDE_INVALID_CONCEPT_CODE = The code {1} is not valid in the system {0}
VALUESET_INCLUDE_INVALID_CONCEPT_CODE_VER = The code {2} is not valid in the system {0} version {1}
VALUESET_UNC_SYSTEM_WARNING = Unknown System ''{0}'' specified, so Concepts and Filters can't be checked
VALUESET_UNC_SYSTEM_WARNING_VER = Unknown System/Version ''{0}'' specified, so Concepts and Filters can't be checked
VALUESET_UNC_SYSTEM_WARNING = Unknown System ''{0}'' specified, so Concepts and Filters can''t be checked (Details: {1})
VALUESET_UNC_SYSTEM_WARNING_VER = Unknown System/Version ''{0}'' specified, so Concepts and Filters can''t be checked (Details: {1})
Extension_PROF_Type = The Profile ''{0}'' definition allows for the type {1} but found type {2}
TYPE_CHECKS_PATTERN_CC = The pattern [system {0}, code {1}, and display ''{2}''] defined in the profile {3} not found. Issues: {4}
TYPE_CHECKS_PATTERN_CC_US = The pattern [system {0}, code {1}, display ''{2}'' and userSelected {5}] defined in the profile {3} not found. Issues: {4}

View File

@ -147,7 +147,7 @@ public class ValueSetValidator extends BaseValidator {
for (Element concept : concepts) {
// we treat the first differently because we want to know if tbe system is worth validating. if it is, then we batch the rest
if (first) {
systemOk = validateValueSetIncludeConcept(errors, concept, stack.push(concept, cc, null, null), system, version);
systemOk = validateValueSetIncludeConcept(errors, concept, stack, stack.push(concept, cc, null, null), system, version);
first = false;
} else if (systemOk) {
batch.add(prepareValidateValueSetIncludeConcept(errors, concept, stack.push(concept, cc, null, null), system, version));
@ -179,18 +179,18 @@ public class ValueSetValidator extends BaseValidator {
}
cf++;
}
warning(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), systemOk, version == null ? I18nConstants.VALUESET_UNC_SYSTEM_WARNING : I18nConstants.VALUESET_UNC_SYSTEM_WARNING_VER, system);
} else {
warning(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), filters.size() == 0 && concepts.size() == 0, I18nConstants.VALUESET_NO_SYSTEM_WARNING);
}
return ok;
}
private boolean validateValueSetIncludeConcept(List<ValidationMessage> errors, Element concept, NodeStack stack, String system, String version) {
private boolean validateValueSetIncludeConcept(List<ValidationMessage> errors, Element concept, NodeStack stackInc, NodeStack stack, String system, String version) {
String code = concept.getChildValue("code");
if (version == null) {
ValidationResult vv = context.validateCode(ValidationOptions.defaults(), new Coding(system, code, null), null);
if (vv.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
warning(errors, IssueType.BUSINESSRULE, stackInc.getLiteralPath(), false, I18nConstants.VALUESET_UNC_SYSTEM_WARNING, system, vv.getMessage());
return false;
} else {
boolean ok = vv.isOk();
@ -199,6 +199,7 @@ public class ValueSetValidator extends BaseValidator {
} else {
ValidationResult vv = context.validateCode(ValidationOptions.defaults(), new Coding(system, code, null).setVersion(version), null);
if (vv.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
warning(errors, IssueType.BUSINESSRULE, stackInc.getLiteralPath(), false, I18nConstants.VALUESET_UNC_SYSTEM_WARNING_VER, system+"#"+version, vv.getMessage());
return false;
} else {
boolean ok = vv.isOk();