This commit is contained in:
markiantorno 2020-06-05 10:07:52 -04:00
commit d5a9c9f8ea
9 changed files with 62 additions and 59 deletions

View File

@ -14,7 +14,6 @@ import org.hl7.fhir.r5.model.SearchParameter;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.cache.NpmPackage; import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.PackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion; import org.hl7.fhir.utilities.cache.ToolsVersion;
public class DefinitionsLoader { public class DefinitionsLoader {

View File

@ -30,8 +30,8 @@ import org.hl7.fhir.r5.model.SearchParameter;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.NpmPackage; import org.hl7.fhir.utilities.cache.NpmPackage;
import org.hl7.fhir.utilities.cache.PackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion; import org.hl7.fhir.utilities.cache.ToolsVersion;
public class JavaCoreGenerator { public class JavaCoreGenerator {
@ -66,7 +66,7 @@ public class JavaCoreGenerator {
String jid = "r5"; String jid = "r5";
PackageCacheManager pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
System.out.println("Cache: "+pcm.getFolder()); System.out.println("Cache: "+pcm.getFolder());
System.out.println("Load hl7.fhir."+pid+".core"); System.out.println("Load hl7.fhir."+pid+".core");
NpmPackage npm = pcm.loadPackage("hl7.fhir."+pid+".core", version); NpmPackage npm = pcm.loadPackage("hl7.fhir."+pid+".core", version);

View File

@ -2992,6 +2992,16 @@ public class ProfileUtilities extends TranslatingUtilities {
private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath, String imagePath, boolean root) { private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath, String imagePath, boolean root) {
Cell c = gen.new Cell(); Cell c = gen.new Cell();
r.getCells().add(c); r.getCells().add(c);
if (e.hasContentReference()) {
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), e.getContentReference());
if (ed == null)
c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", e.getContentReference()), null));
else {
c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getPath()), null));
c.getPieces().add(gen.new Piece("#"+ed.getPath(), tail(ed.getPath()), ed.getPath()));
}
return c;
}
List<TypeRefComponent> types = e.getType(); List<TypeRefComponent> types = e.getType();
if (!e.hasType()) { if (!e.hasType()) {
if (root) { // we'll use base instead of types then if (root) { // we'll use base instead of types then
@ -3840,13 +3850,6 @@ public class ProfileUtilities extends TranslatingUtilities {
} }
} }
if (definition.hasContentReference()) {
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference());
if (ed == null)
c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", definition.getContentReference()), null));
else
c.getPieces().add(gen.new Piece("#"+ed.getPath(), translate("sd.table", "See %s", ed.getPath()), null));
}
if (definition.getPath().endsWith("url") && definition.hasFixed()) { if (definition.getPath().endsWith("url") && definition.hasFixed()) {
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen")));
} else { } else {

View File

@ -603,7 +603,7 @@ public class BaseValidator {
} }
if (fr == null) if (fr == null)
fr = ValueSetUtilities.generateImplicitValueSet(reference); fr = ValueSetUtilities.generateImplicitValueSet(reference);
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
return fr; return fr;
} }
} else } else

View File

@ -25,27 +25,26 @@ public class TimeTracker {
return fpeTime; return fpeTime;
} }
public void load(long t, long nanoTime) { public void load(long start) {
// TODO Auto-generated method stub loadTime = loadTime + (System.nanoTime() - start);
} }
public void overall(long t, long nanoTime) {
// TODO Auto-generated method stub public void overall(long start) {
overall = overall + (System.nanoTime() - start);
} }
public void tx(long t, long nanoTime) {
// TODO Auto-generated method stub public void tx(long start) {
txTime = txTime + (System.nanoTime() - start);
} }
public void sd(long t, long nanoTime) {
// TODO Auto-generated method stub public void sd(long start) {
sdTime = sdTime + (System.nanoTime() - start);
} }
public void fpe(long t, long nanoTime) {
// TODO Auto-generated method stub public void fpe(long start) {
fpeTime = fpeTime + (System.nanoTime() - t); fpeTime = fpeTime + (System.nanoTime() - start);
} }
public void reset() { public void reset() {
overall = 0; overall = 0;
txTime = 0; txTime = 0;

View File

@ -515,7 +515,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} catch (IOException e1) { } catch (IOException e1) {
throw new FHIRException(e1); throw new FHIRException(e1);
} }
timeTracker.load(t, System.nanoTime()); timeTracker.load(t);
if (e != null) if (e != null)
validate(appContext, errors, e, profiles); validate(appContext, errors, e, profiles);
return e; return e;
@ -544,7 +544,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} catch (IOException e1) { } catch (IOException e1) {
throw new FHIRException(e1); throw new FHIRException(e1);
} }
timeTracker.load(t, System.nanoTime()); timeTracker.load(t);
validate(appContext, errors, e, profiles); validate(appContext, errors, e, profiles);
return e; return e;
} }
@ -574,7 +574,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} catch (IOException e1) { } catch (IOException e1) {
throw new FHIRException(e1); throw new FHIRException(e1);
} }
timeTracker.load(t, System.nanoTime()); timeTracker.load(t);
if (e != null) if (e != null)
validate(appContext, errors, e, profiles); validate(appContext, errors, e, profiles);
return e; return e;
@ -605,7 +605,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} catch (IOException e1) { } catch (IOException e1) {
throw new FHIRException(e1); throw new FHIRException(e1);
} }
timeTracker.load(t, System.nanoTime()); timeTracker.load(t);
if (e != null) if (e != null)
validate(appContext, errors, e, profiles); validate(appContext, errors, e, profiles);
return e; return e;
@ -631,7 +631,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
parser.setupValidation(ValidationPolicy.EVERYTHING, errors); parser.setupValidation(ValidationPolicy.EVERYTHING, errors);
long t = System.nanoTime(); long t = System.nanoTime();
Element e = parser.parse(object); Element e = parser.parse(object);
timeTracker.load(t, System.nanoTime()); timeTracker.load(t);
if (e != null) if (e != null)
validate(appContext, errors, e, profiles); validate(appContext, errors, e, profiles);
return e; return e;
@ -672,7 +672,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (hintAboutNonMustSupport) { if (hintAboutNonMustSupport) {
checkElementUsage(errors, element, new NodeStack(context, element, validationLanguage)); checkElementUsage(errors, element, new NodeStack(context, element, validationLanguage));
} }
timeTracker.overall(t, System.nanoTime()); timeTracker.overall(t);
} }
private void checkElementUsage(List<ValidationMessage> errors, Element element, NodeStack stack) { private void checkElementUsage(List<ValidationMessage> errors, Element element, NodeStack stack) {
@ -728,11 +728,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private boolean checkCode(List<ValidationMessage> errors, Element element, String path, String code, String system, String display, boolean checkDisplay, NodeStack stack) throws TerminologyServiceException { private boolean checkCode(List<ValidationMessage> errors, Element element, String path, String code, String system, String display, boolean checkDisplay, NodeStack stack) throws TerminologyServiceException {
long t = System.nanoTime(); long t = System.nanoTime();
boolean ss = context.supportsSystem(system); boolean ss = context.supportsSystem(system);
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (ss) { if (ss) {
t = System.nanoTime(); t = System.nanoTime();
ValidationResult s = checkCodeOnServer(stack, code, system, display, checkDisplay); ValidationResult s = checkCodeOnServer(stack, code, system, display, checkDisplay);
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (s == null) if (s == null)
return true; return true;
if (s.isOk()) { if (s.isOk()) {
@ -949,7 +949,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} }
} }
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -1054,7 +1054,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} }
} }
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -1098,7 +1098,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (binding.getStrength() != BindingStrength.EXAMPLE) { if (binding.getStrength() != BindingStrength.EXAMPLE) {
vr = checkCodeOnServer(stack, valueset, c, true); vr = checkCodeOnServer(stack, valueset, c, true);
} }
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (vr != null && !vr.isOk()) { if (vr != null && !vr.isOk()) {
if (vr.IsNoService()) if (vr.IsNoService())
txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_BINDING_NOSERVER); txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_BINDING_NOSERVER);
@ -1222,7 +1222,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
try { try {
long t = System.nanoTime(); long t = System.nanoTime();
ValidationResult vr = checkCodeOnServer(stack, valueset, cc, false); ValidationResult vr = checkCodeOnServer(stack, valueset, cc, false);
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (!vr.isOk()) { if (!vr.isOk()) {
if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure())
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_7, describeReference(maxVSUrl), valueset.getUrl(), vr.getMessage()); txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_7, describeReference(maxVSUrl), valueset.getUrl(), vr.getMessage());
@ -1241,7 +1241,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
try { try {
long t = System.nanoTime(); long t = System.nanoTime();
ValidationResult vr = checkCodeOnServer(stack, valueset, c, true); ValidationResult vr = checkCodeOnServer(stack, valueset, c, true);
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (!vr.isOk()) { if (!vr.isOk()) {
if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure())
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_9, describeReference(maxVSUrl), valueset.getUrl(), vr.getMessage()); txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_9, describeReference(maxVSUrl), valueset.getUrl(), vr.getMessage());
@ -1260,7 +1260,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
try { try {
long t = System.nanoTime(); long t = System.nanoTime();
ValidationResult vr = checkCodeOnServer(stack, valueset, value, new ValidationOptions(stack.getWorkingLang())); ValidationResult vr = checkCodeOnServer(stack, valueset, value, new ValidationOptions(stack.getWorkingLang()));
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (!vr.isOk()) { if (!vr.isOk()) {
if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure())
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_9, describeReference(maxVSUrl), valueset.getUrl(), vr.getMessage()); txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_9, describeReference(maxVSUrl), valueset.getUrl(), vr.getMessage());
@ -1317,7 +1317,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (binding.getStrength() != BindingStrength.EXAMPLE) { if (binding.getStrength() != BindingStrength.EXAMPLE) {
vr = checkCodeOnServer(stack, valueset, c, true); vr = checkCodeOnServer(stack, valueset, c, true);
} }
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (vr != null && !vr.isOk()) { if (vr != null && !vr.isOk()) {
if (vr.IsNoService()) if (vr.IsNoService())
txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_BINDING_NOSERVER); txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_BINDING_NOSERVER);
@ -1387,7 +1387,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition ex = Utilities.isAbsoluteUrl(url) ? context.fetchResource(StructureDefinition.class, url) : null; StructureDefinition ex = Utilities.isAbsoluteUrl(url) ? context.fetchResource(StructureDefinition.class, url) : null;
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
if (ex == null) { if (ex == null) {
if (xverManager == null) { if (xverManager == null) {
xverManager = new XVerExtensionManager(context); xverManager = new XVerExtensionManager(context);
@ -2111,7 +2111,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
ValidationOptions options = new ValidationOptions(stack.getWorkingLang()).guessSystem(); ValidationOptions options = new ValidationOptions(stack.getWorkingLang()).guessSystem();
vr = checkCodeOnServer(stack, vs, value, options); vr = checkCodeOnServer(stack, vs, value, options);
} }
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (vr != null && !vr.isOk()) { if (vr != null && !vr.isOk()) {
if (vr.IsNoService()) if (vr.IsNoService())
txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_15, value); txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_15, value);
@ -2486,7 +2486,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
else else
return null; return null;
} finally { } finally {
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
} }
} }
@ -2628,7 +2628,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
ExpressionNode expr = fpe.parse(fixExpr(discriminator)); ExpressionNode expr = fpe.parse(fixExpr(discriminator));
long t2 = System.nanoTime(); long t2 = System.nanoTime();
ed = fpe.evaluateDefinition(expr, profile, element); ed = fpe.evaluateDefinition(expr, profile, element);
timeTracker.sd(t2, System.nanoTime()); timeTracker.sd(t2);
if (ed != null) if (ed != null)
elements.add(ed); elements.add(ed);
@ -2653,7 +2653,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
expr = fpe.parse(fixExpr(discriminator)); expr = fpe.parse(fixExpr(discriminator));
t2 = System.nanoTime(); t2 = System.nanoTime();
ed = fpe.evaluateDefinition(expr, profile, element); ed = fpe.evaluateDefinition(expr, profile, element);
timeTracker.sd(t2, System.nanoTime()); timeTracker.sd(t2);
if (ed != null) if (ed != null)
elements.add(ed); elements.add(ed);
} }
@ -2681,7 +2681,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
url = "http://hl7.org/fhir/StructureDefinition/" + url; url = "http://hl7.org/fhir/StructureDefinition/" + url;
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); StructureDefinition sd = context.fetchResource(StructureDefinition.class, url);
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot()) if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot())
return sd; return sd;
} }
@ -2722,7 +2722,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
try { try {
return context.fetchCodeSystem(system); return context.fetchCodeSystem(system);
} finally { } finally {
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
} }
} }
@ -2957,7 +2957,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} else { } else {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition fr = context.fetchResource(StructureDefinition.class, pr); StructureDefinition fr = context.fetchResource(StructureDefinition.class, pr);
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
return fr; return fr;
} }
} }
@ -2969,7 +2969,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
url = "http://hl7.org/fhir/StructureDefinition/" + url; url = "http://hl7.org/fhir/StructureDefinition/" + url;
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); StructureDefinition sd = context.fetchResource(StructureDefinition.class, url);
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot()) if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot())
return sd.getSnapshot().getElement().get(0); return sd.getSnapshot().getElement().get(0);
} }
@ -3121,7 +3121,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} catch (FHIRLexerException e) { } catch (FHIRLexerException e) {
throw new FHIRException(context.formatMessage(I18nConstants.PROBLEM_PROCESSING_EXPRESSION__IN_PROFILE__PATH__, expression, profile.getUrl(), path, e.getMessage())); throw new FHIRException(context.formatMessage(I18nConstants.PROBLEM_PROCESSING_EXPRESSION__IN_PROFILE__PATH__, expression, profile.getUrl(), path, e.getMessage()));
} }
timeTracker.fpe(t, System.nanoTime()); timeTracker.fpe(t);
ed.setUserData("slice.expression.cache", n); ed.setUserData("slice.expression.cache", n);
} }
@ -3146,7 +3146,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
try { try {
long t = System.nanoTime(); long t = System.nanoTime();
ok = fpe.evaluateToBoolean(hostContext.forProfile(profile), hostContext.getResource(), hostContext.getRootResource(), element, n); ok = fpe.evaluateToBoolean(hostContext.forProfile(profile), hostContext.getResource(), hostContext.getRootResource(), element, n);
timeTracker.fpe(t, System.nanoTime()); timeTracker.fpe(t);
msg = fpe.forLog(); msg = fpe.forLog();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -3536,7 +3536,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} else if (isValidResourceType(resourceName, trr)) { } else if (isValidResourceType(resourceName, trr)) {
long t = System.nanoTime(); long t = System.nanoTime();
StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName);
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
// special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise // special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise
ValidatorHostContext hc = null; ValidatorHostContext hc = null;
if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER) { if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER) {
@ -4277,7 +4277,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} catch (FHIRLexerException e) { } catch (FHIRLexerException e) {
throw new FHIRException(context.formatMessage(I18nConstants.PROBLEM_PROCESSING_EXPRESSION__IN_PROFILE__PATH__, inv.getExpression(), profile.getUrl(), path, e.getMessage())); throw new FHIRException(context.formatMessage(I18nConstants.PROBLEM_PROCESSING_EXPRESSION__IN_PROFILE__PATH__, inv.getExpression(), profile.getUrl(), path, e.getMessage()));
} }
timeTracker.fpe(t, System.nanoTime()); timeTracker.fpe(t);
inv.setUserData("validator.expression.cache", n); inv.setUserData("validator.expression.cache", n);
} }
@ -4286,7 +4286,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
try { try {
long t = System.nanoTime(); long t = System.nanoTime();
ok = fpe.evaluateToBoolean(hostContext, resource, hostContext.getRootResource(), element, n); ok = fpe.evaluateToBoolean(hostContext, resource, hostContext.getRootResource(), element, n);
timeTracker.fpe(t, System.nanoTime()); timeTracker.fpe(t);
msg = fpe.forLog(); msg = fpe.forLog();
} catch (Exception ex) { } catch (Exception ex) {
ok = false; ok = false;
@ -4337,7 +4337,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
defn = element.getProperty().getStructure(); defn = element.getProperty().getStructure();
if (defn == null) if (defn == null)
defn = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); defn = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName);
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, I18nConstants.VALIDATION_VAL_PROFILE_NODEFINITION, resourceName); ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, I18nConstants.VALIDATION_VAL_PROFILE_NODEFINITION, resourceName);
} }

View File

@ -191,7 +191,7 @@ public class MeasureValidator extends BaseValidator {
if (hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), measure != null, I18nConstants.MEASURE_MR_M_NONE)) { if (hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), measure != null, I18nConstants.MEASURE_MR_M_NONE)) {
long t = System.nanoTime(); long t = System.nanoTime();
Measure msrc = measure.startsWith("#") ? loadMeasure(element, measure.substring(1)) : context.fetchResource(Measure.class, measure); Measure msrc = measure.startsWith("#") ? loadMeasure(element, measure.substring(1)) : context.fetchResource(Measure.class, measure);
timeTracker.sd(t, System.nanoTime()); timeTracker.sd(t);
if (warning(errors, IssueType.REQUIRED, m.line(), m.col(), stack.getLiteralPath(), msrc != null, I18nConstants.MEASURE_MR_M_NOTFOUND, measure)) { if (warning(errors, IssueType.REQUIRED, m.line(), m.col(), stack.getLiteralPath(), msrc != null, I18nConstants.MEASURE_MR_M_NOTFOUND, measure)) {
boolean inComplete = !"complete".equals(element.getNamedChildValue("status")); boolean inComplete = !"complete".equals(element.getNamedChildValue("status"));
MeasureContext mc = new MeasureContext(msrc, element); MeasureContext mc = new MeasureContext(msrc, element);

View File

@ -511,7 +511,7 @@ public class QuestionnaireValidator extends BaseValidator {
long t = System.nanoTime(); long t = System.nanoTime();
ValidationResult res = context.validateCode(new ValidationOptions(stack.getWorkingLang()), c, vs); ValidationResult res = context.validateCode(new ValidationOptions(stack.getWorkingLang()), c, vs);
timeTracker.tx(t, System.nanoTime()); timeTracker.tx(t);
if (!res.isOk()) { if (!res.isOk()) {
txRule(errors, res.getTxLink(), IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, I18nConstants.QUESTIONNAIRE_QR_ITEM_BADOPTION, c.getSystem(), c.getCode()); txRule(errors, res.getTxLink(), IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, I18nConstants.QUESTIONNAIRE_QR_ITEM_BADOPTION, c.getSystem(), c.getCode());
} else if (res.getSeverity() != null) { } else if (res.getSeverity() != null) {

View File

@ -100,6 +100,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
@ParameterizedTest(name = "{index}: id {0}") @ParameterizedTest(name = "{index}: id {0}")
@MethodSource("data") @MethodSource("data")
public void test(String name, JsonObject content) throws Exception { public void test(String name, JsonObject content) throws Exception {
long setup = System.nanoTime();
this.content = content; this.content = content;
System.out.println("---- " + name + " ----------------------------------------------------------------"); System.out.println("---- " + name + " ----------------------------------------------------------------");
System.out.println("** Core: "); System.out.println("** Core: ");
@ -185,6 +186,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
val.setAllowExamples(true); val.setAllowExamples(true);
} }
val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false); val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false);
System.out.println(String.format("Start Validating (%d to set up)", (System.nanoTime() - setup) / 1000000));
if (name.endsWith(".json")) if (name.endsWith(".json"))
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON); val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON);
else else