From e31b2b07c75dd74e1a33be994cbbb14da7ca420c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 6 Sep 2019 10:13:28 +1000 Subject: [PATCH] IG comparison + value set performance --- .../fhir/r5/utils/DefinitionNavigator.java | 4 + .../hl7/fhir/r5/utils/NarrativeGenerator.java | 88 +++++++++++-------- 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/DefinitionNavigator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/DefinitionNavigator.java index ad9c1a6ed..44b550656 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/DefinitionNavigator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/DefinitionNavigator.java @@ -187,6 +187,10 @@ public class DefinitionNavigator { } return typeChildren; } + + public StructureDefinition getStructure() { + return structure; + } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java index 701adaf92..56d620f43 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java @@ -1001,6 +1001,7 @@ public class NarrativeGenerator implements INarrativeGenerator { private boolean pretty; private boolean canonicalUrlsAsLinks; private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions(); + private boolean noSlowLookup; public NarrativeGenerator(String prefix, String basePath, IWorkerContext context) { super(); @@ -3747,45 +3748,47 @@ public class NarrativeGenerator implements INarrativeGenerator { } } } - li.addText(type+" codes from "); - addCsRef(inc, li, e); - li.tx(" where "); - for (int i = 0; i < inc.getFilter().size(); i++) { - ConceptSetFilterComponent f = inc.getFilter().get(i); - if (i > 0) { - if (i == inc.getFilter().size()-1) { - li.tx(" and "); - } else { - li.tx(", "); - } - } - if (f.getOp() == FilterOperator.EXISTS) { - if (f.getValue().equals("true")) { - li.tx(f.getProperty()+" exists"); - } else { - li.tx(f.getProperty()+" doesn't exist"); - } - } else { - li.tx(f.getProperty()+" "+describe(f.getOp())+" "); - if (e != null && codeExistsInValueSet(e, f.getValue())) { - String href = prefix+getCsRef(e); - if (href.contains("#")) - href = href + "-"+Utilities.nmtokenize(f.getValue()); - else - href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(f.getValue()); - li.ah(href).addText(f.getValue()); - } else if ("concept".equals(f.getProperty()) && inc.hasSystem()) { - li.addText(f.getValue()); - ValidationResult vr = context.validateCode(terminologyServiceOptions, inc.getSystem(), f.getValue(), null); - if (vr.isOk()) { - li.tx(" ("+vr.getDisplay()+")"); + if (inc.getFilter().size() > 0) { + li.addText(type+" codes from "); + addCsRef(inc, li, e); + li.tx(" where "); + for (int i = 0; i < inc.getFilter().size(); i++) { + ConceptSetFilterComponent f = inc.getFilter().get(i); + if (i > 0) { + if (i == inc.getFilter().size()-1) { + li.tx(" and "); + } else { + li.tx(", "); } } - else - li.addText(f.getValue()); - String disp = ToolingExtensions.getDisplayHint(f); - if (disp != null) - li.tx(" ("+disp+")"); + if (f.getOp() == FilterOperator.EXISTS) { + if (f.getValue().equals("true")) { + li.tx(f.getProperty()+" exists"); + } else { + li.tx(f.getProperty()+" doesn't exist"); + } + } else { + li.tx(f.getProperty()+" "+describe(f.getOp())+" "); + if (e != null && codeExistsInValueSet(e, f.getValue())) { + String href = prefix+getCsRef(e); + if (href.contains("#")) + href = href + "-"+Utilities.nmtokenize(f.getValue()); + else + href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(f.getValue()); + li.ah(href).addText(f.getValue()); + } else if ("concept".equals(f.getProperty()) && inc.hasSystem()) { + li.addText(f.getValue()); + ValidationResult vr = context.validateCode(terminologyServiceOptions, inc.getSystem(), f.getValue(), null); + if (vr.isOk()) { + li.tx(" ("+vr.getDisplay()+")"); + } + } + else + li.addText(f.getValue()); + String disp = ToolingExtensions.getDisplayHint(f); + if (disp != null) + li.tx(" ("+disp+")"); + } } } } @@ -3840,6 +3843,9 @@ public class NarrativeGenerator implements INarrativeGenerator { return v; } + if (noSlowLookup) + return null; + if (!context.hasCache()) { ValueSetExpansionComponent vse; try { @@ -4784,5 +4790,13 @@ public class NarrativeGenerator implements INarrativeGenerator { this.terminologyServiceOptions = terminologyServiceOptions; } + public boolean isNoSlowLookup() { + return noSlowLookup; + } + + public void setNoSlowLookup(boolean noSlowLookup) { + this.noSlowLookup = noSlowLookup; + } + }