From 3fc3109cbc8f1aac39892aa5c1178b5e6d60bbd9 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 26 Jul 2022 06:08:32 +1000 Subject: [PATCH 1/4] fix DocumentRendering to generate CompositionNarrative if --- .../java/org/hl7/fhir/r5/renderers/BundleRenderer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java index 3c5405d0e..13399d504 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java @@ -17,12 +17,15 @@ import org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent; import org.hl7.fhir.r5.model.Bundle.BundleType; import org.hl7.fhir.r5.model.Composition; import org.hl7.fhir.r5.model.Composition.SectionComponent; +import org.hl7.fhir.r5.model.Narrative.NarrativeStatus; import org.hl7.fhir.r5.model.DomainResource; import org.hl7.fhir.r5.model.Property; import org.hl7.fhir.r5.model.Provenance; import org.hl7.fhir.r5.model.Reference; import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper; +import org.hl7.fhir.r5.renderers.utils.BaseWrappers.PropertyWrapper; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper; import org.hl7.fhir.r5.renderers.utils.RenderingContext; import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext; @@ -205,6 +208,10 @@ public class BundleRenderer extends ResourceRenderer { } } x.hr(); + if (!comp.getText().hasDiv()) { + ResourceRenderer rr = RendererFactory.factory(comp, getContext()); + rr.render(comp); + } if (comp.getText().hasDiv()) { x.addChildren(comp.getText().getDiv()); x.hr(); From 9ba4e00254a77780b66d57faaf706fd86748957b Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 26 Jul 2022 06:09:00 +1000 Subject: [PATCH 2/4] fix evaluation of ValueSets that have only one value set import --- .../terminologies/ValueSetCheckerSimple.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java index 3472559a6..ec314cc15 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java @@ -676,23 +676,29 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe } private Boolean inComponent(ConceptSetComponent vsi, int vsiIndex, String system, String code, boolean only, List warnings) throws FHIRException { - if (isValueSetUnionImports()) { - for (UriType uri : vsi.getValueSet()) { - if (inImport(uri.getValue(), system, code)) { - return true; + boolean ok = true; + + if (vsi.hasValueSet()) { + if (isValueSetUnionImports()) { + ok = false; + for (UriType uri : vsi.getValueSet()) { + if (inImport(uri.getValue(), system, code)) { + return true; + } } - } - } else { - for (UriType uri : vsi.getValueSet()) { - if (!inImport(uri.getValue(), system, code)) { - return false; + } else { + ok = inImport(vsi.getValueSet().get(0).getValue(), system, code); + for (int i = 1; i < vsi.getValueSet().size(); i++) { + UriType uri = vsi.getValueSet().get(i); + ok = ok && inImport(uri.getValue(), system, code); } } } - if (!vsi.hasSystem()) { - return false; + if (!vsi.hasSystem() || !ok) { + return ok; } + if (only && system == null) { // whether we know the system or not, we'll accept the stated codes at face value for (ConceptReferenceComponent cc : vsi.getConcept()) { @@ -726,18 +732,16 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe return res.isOk(); } else { if (vsi.hasFilter()) { - boolean ok = true; + ok = true; for (ConceptSetFilterComponent f : vsi.getFilter()) { if (!codeInFilter(cs, system, f, code)) { - ok = false; - break; + return false; } } - return ok; } List list = cs.getConcept(); - boolean ok = validateCodeInConceptList(code, cs, list); + ok = validateCodeInConceptList(code, cs, list); if (ok && vsi.hasConcept()) { for (ConceptReferenceComponent cc : vsi.getConcept()) { if (cc.getCode().equals(code)) { From 8d7ccff29e1f77ce7e223bbc67397e1da7fba297 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 26 Jul 2022 06:09:29 +1000 Subject: [PATCH 3/4] Add support for 1.3.160 --- .../hl7/fhir/validation/instance/InstanceValidator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 3b2e8f294..14ab315a1 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -1880,7 +1880,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (!ok) { if (definition.hasUserData(XVerExtensionManager.XVER_EXT_MARKER)) { warning(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, - modifier ? I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG_XVER : I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG_XVER, extUrl, contexts.toString(), plist.toString()); + modifier ? I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG_XVER : I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG_XVER, extUrl, contexts.toString(), plist.toString()); } else { rule(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, modifier ? I18nConstants.EXTENSION_EXTP_CONTEXT_WRONG : I18nConstants.EXTENSION_EXTM_CONTEXT_WRONG, extUrl, contexts.toString(), plist.toString()); @@ -2164,8 +2164,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } if (url != null && url.startsWith("urn:oid:")) { String cc = url.substring(8); - // OIDs shorter than 5 chars are almost never valid for namespaces, except for the special OID 1.3.88 - rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isOid(cc) && (cc.lastIndexOf('.') >= 5 || "1.3.88".equals(cc)), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_OID_VALID, cc); + // OIDs shorter than 5 chars are almost never valid for namespaces, except for the special OIDs 1.3.88 and 1.3.160 + rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isOid(cc) && (cc.lastIndexOf('.') >= 5 || + Utilities.existsInList(cc, "1.3.160", "1.3.88")), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_OID_VALID, cc); } if (isCanonicalURLElement(e)) { From 168e40f12c3597c097058867045e0ae1e85e5239 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 26 Jul 2022 06:09:42 +1000 Subject: [PATCH 4/4] cache update --- .../3.0.2/snomed.cache | 21 +++++++++++++++++++ .../4.0.1/snomed.cache | 11 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/3.0.2/snomed.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/3.0.2/snomed.cache index c2a72ecd4..755ff6363 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/3.0.2/snomed.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/3.0.2/snomed.cache @@ -352,3 +352,24 @@ v: { "system" : "http://snomed.info/sct" } ------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://snomed.info/sct", + "code" : "17621005", + "display" : "Normal (qualifier value)" +}, "url": "http://hl7.org/fhir/ValueSet/security-labels", "version": "3.0.2", "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"NO_MEMBERSHIP_CHECK", "versionFlexible":"false"}#### +v: { + "display" : "Normal", + "code" : "17621005", + "system" : "http://snomed.info/sct" +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://snomed.info/sct", + "code" : "17621005" +}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}#### +v: { + "display" : "Normal", + "code" : "17621005", + "system" : "http://snomed.info/sct" +} +------------------------------------------------------------------------------------- diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache index 73bd57bce..4c4b5ba71 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache @@ -1854,3 +1854,14 @@ v: { "system" : "http://snomed.info/sct" } ------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://snomed.info/sct", + "code" : "17621005", + "display" : "Normal (qualifier value)" +}, "url": "http://hl7.org/fhir/ValueSet/security-labels", "version": "4.0.1", "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"NO_MEMBERSHIP_CHECK", "versionFlexible":"false"}#### +v: { + "display" : "Normal", + "code" : "17621005", + "system" : "http://snomed.info/sct" +} +-------------------------------------------------------------------------------------