From 69526476baac1d84232fbe5978b729fae18cbf1f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:33:04 +1000 Subject: [PATCH 01/11] fix issue parsing parameters in a target expression --- .../java/org/hl7/fhir/r5/elementmodel/FmlParser.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java index 3c0cbfa9b..6507b88ea 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/FmlParser.java @@ -422,7 +422,7 @@ public class FmlParser extends ParserBase { lexer.token("("); boolean done = false; while (!done) { - parseParameter(ref, lexer); + parseParameter(ref, lexer, false); done = !lexer.hasToken(","); if (!done) lexer.next(); @@ -527,7 +527,7 @@ public class FmlParser extends ParserBase { target.makeElement("transform").markLocation(loc).setValue(name); lexer.token("("); if (target.getChildValue("transform").equals(StructureMapTransform.EVALUATE.toCode())) { - parseParameter(target, lexer); + parseParameter(target, lexer, true); lexer.token(","); loc = lexer.getCurrentLocation(); ExpressionNode node = fpe.parse(lexer); @@ -535,7 +535,7 @@ public class FmlParser extends ParserBase { target.addElement("parameter").markLocation(loc).makeElement("valueString").setValue(node.toString()); } else { while (!lexer.hasToken(")")) { - parseParameter(target, lexer); + parseParameter(target, lexer, true); if (!lexer.hasToken(")")) lexer.token(","); } @@ -568,9 +568,9 @@ public class FmlParser extends ParserBase { } } - private void parseParameter(Element ref, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError { + private void parseParameter(Element ref, FHIRLexer lexer, boolean isTarget) throws FHIRLexerException, FHIRFormatError { boolean r5 = VersionUtilities.isR5Plus(context.getVersion()); - String name = r5 ? "parameter" : "variable"; + String name = r5 || isTarget ? "parameter" : "variable"; if (ref.hasChildren(name) && !ref.getChildByName(name).isList()) { throw lexer.error("variable on target is not a list, so can't add an element"); } else if (!lexer.isConstant()) { From 104973a1d96b64792de3e4f421aa38817b67473e Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:34:19 +1000 Subject: [PATCH 02/11] fix parsing logical model list attributes --- .../hl7/fhir/r5/elementmodel/XmlParser.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java index fd7d8f347..2ed10d15b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java @@ -38,7 +38,9 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.List; +import java.util.Set; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -357,13 +359,19 @@ public class XmlParser extends ParserBase { if (property != null) { String av = attr.getNodeValue(); if (ToolingExtensions.hasExtension(property.getDefinition(), ToolingExtensions.EXT_DATE_FORMAT)) - av = convertForDateFormatFromExternal(ToolingExtensions.readStringExtension(property.getDefinition(), ToolingExtensions.EXT_DATE_FORMAT), av); + av = convertForDateFormatFromExternal(ToolingExtensions.readStringExtension(property.getDefinition(), ToolingExtensions.EXT_DATE_FORMAT), av); if (property.getName().equals("value") && element.isPrimitive()) element.setValue(av); else { - Element n = new Element(property.getName(), property, property.getType(), av).markLocation(line, col); - n.setPath(element.getPath()+"."+property.getName()); - element.getChildren().add(n); + String[] vl = {av}; + if (property.isList() && av.contains(" ")) { + vl = av.split(" "); + } + for (String v : vl) { + Element n = new Element(property.getName(), property, property.getType(), v).markLocation(line, col); + n.setPath(element.getPath()+"."+property.getName()); + element.getChildren().add(n); + } } } else { boolean ok = false; @@ -739,11 +747,20 @@ public class XmlParser extends ParserBase { } } else { setXsiTypeIfIsTypeAttr(xml, element); + Set handled = new HashSet<>(); for (Element child : element.getChildren()) { - if (isAttr(child.getProperty()) && wantCompose(element.getPath(), child)) { + if (!handled.contains(child.getName()) && isAttr(child.getProperty()) && wantCompose(element.getPath(), child)) { + handled.add(child.getName()); + String av = child.getValue(); + if (child.getProperty().isList()) { + for (Element c2 : element.getChildren()) { + if (c2 != child && c2.getName().equals(child.getName())) { + av = av + " "+c2.getValue(); + } + } + } if (linkResolver != null) xml.link(linkResolver.resolveType(child.getType())); - String av = child.getValue(); if (ToolingExtensions.hasExtension(child.getProperty().getDefinition(), ToolingExtensions.EXT_DATE_FORMAT)) av = convertForDateFormatToExternal(ToolingExtensions.readStringExtension(child.getProperty().getDefinition(), ToolingExtensions.EXT_DATE_FORMAT), av); xml.attribute(child.getProperty().getXmlNamespace(),child.getProperty().getXmlName(), av); From a22923f193daea3968b0c00554406bae138214d0 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:34:39 +1000 Subject: [PATCH 03/11] fix problem parsing logical model cda fragments --- .../main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java index 377aef49f..5471e9468 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java @@ -143,9 +143,12 @@ public abstract class ParserBase { protected StructureDefinition getDefinition(List errors, int line, int col, String ns, String name) throws FHIRFormatError { if (logical != null) { - String expectedName = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-name"); + String expectedName = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name"); if (expectedName == null) { expectedName = logical.getType(); + if (Utilities.isAbsoluteUrl(expectedName)) { + expectedName = expectedName.substring(expectedName.lastIndexOf("/")+1); + } } String expectedNamespace = ToolingExtensions.readStringExtension(logical, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"); if (matchesNamespace(expectedNamespace, ns) && matchesName(expectedName, name)) { From bd52aa527749900f668cc5188db0bb0260e90826 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:35:15 +1000 Subject: [PATCH 04/11] Fix problem rendering additional bindings in R5 --- .../renderers/AdditionalBindingsRenderer.java | 48 ++++++++++++++++ .../StructureDefinitionRenderer.java | 57 +++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/AdditionalBindingsRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/AdditionalBindingsRenderer.java index 92a5651fe..836745fb5 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/AdditionalBindingsRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/AdditionalBindingsRenderer.java @@ -186,6 +186,18 @@ public class AdditionalBindingsRenderer { return abr; } + protected AdditionalBindingDetail additionalBinding(ElementDefinitionBindingAdditionalComponent ab) { + AdditionalBindingDetail abr = new AdditionalBindingDetail(); + abr.purpose = ab.getPurpose().toCode(); + abr.valueSet = ab.getValueSet(); + abr.doco = ab.getDocumentation(); + abr.docoShort = ab.getShortDoco(); + abr.usage = ab.hasUsage() ? ab.getUsageFirstRep() : null; + abr.any = ab.getAny(); + abr.isUnchanged = ab.hasUserData(ProfileUtilities.UD_DERIVATION_EQUALS); + return abr; + } + public String render() throws IOException { if (bindings.isEmpty()) { return ""; @@ -455,4 +467,40 @@ public class AdditionalBindingsRenderer { } + public void seeAdditionalBindings(ElementDefinition definition, ElementDefinition compDef, boolean compare) { + HashMap compBindings = new HashMap(); + if (compare && compDef.getBinding().getAdditional() != null) { + for (ElementDefinitionBindingAdditionalComponent ab : compDef.getBinding().getAdditional()) { + AdditionalBindingDetail abr = additionalBinding(ab); + if (compBindings.containsKey(abr.getKey())) { + abr.incrementCount(); + } + compBindings.put(abr.getKey(), abr); + } + } + + for (ElementDefinitionBindingAdditionalComponent ab : definition.getBinding().getAdditional()) { + AdditionalBindingDetail abr = additionalBinding(ab); + if (compare && compDef != null) { + AdditionalBindingDetail match = null; + do { + match = compBindings.get(abr.getKey()); + if (abr.alreadyMatched()) + abr.incrementCount(); + } while (match!=null && abr.alreadyMatched()); + if (match!=null) + abr.setCompare(match); + bindings.add(abr); + if (abr.compare!=null) + compBindings.remove(abr.compare.getKey()); + } else + bindings.add(abr); + } + for (AdditionalBindingDetail b: compBindings.values()) { + b.removed = true; + bindings.add(b); + } + + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java index 011161f2c..3be82060c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java @@ -68,6 +68,7 @@ import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper; import org.hl7.fhir.r5.renderers.StructureDefinitionRenderer.InternalMarkdownProcessor; +import org.hl7.fhir.r5.renderers.StructureDefinitionRenderer.SourcedElementDefinition; import org.hl7.fhir.r5.renderers.utils.RenderingContext; import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules; import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; @@ -157,6 +158,25 @@ public class StructureDefinitionRenderer extends ResourceRenderer { // // } + public class SourcedElementDefinition { + private StructureDefinition profile; + private ElementDefinition definition; + + + protected SourcedElementDefinition(StructureDefinition profile, ElementDefinition definition) { + super(); + this.profile = profile; + this.definition = definition; + } + public StructureDefinition getProfile() { + return profile; + } + public ElementDefinition getDefinition() { + return definition; + } + + } + public class InternalMarkdownProcessor implements IMarkdownProcessor { @Override @@ -1320,6 +1340,22 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } } } + if (logicalModel) { + List ancestors = new ArrayList<>(); + getAncestorElements(profile, ancestors); + if (ancestors.size() > 0) { + c.addPiece(gen.new Piece("br")); + c.addPiece(gen.new Piece(null, "Elements defined in Ancestors: ", null)); + boolean first = true; + for (SourcedElementDefinition ed : ancestors) { + if (first) + first = false; + else + c.addPiece(gen.new Piece(null, ", ", null)); + c.addPiece(gen.new Piece(ed.getProfile().getWebPath(), (isAttr(ed) ? "@" : "")+ed.getDefinition().getName(), ed.getDefinition().getDefinition())); + } + } + } } if (definition.getPath().endsWith("url") && definition.hasFixed()) { c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); @@ -1552,6 +1588,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } AdditionalBindingsRenderer abr = new AdditionalBindingsRenderer(context.getPkp(), corePath, profile, definition.getPath(), rc, null, this); + abr.seeAdditionalBindings(definition, null, false); if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET)) { abr.seeMaxBinding(ToolingExtensions.getExtension(binding, ToolingExtensions.EXT_MAX_VALUESET)); } @@ -1651,6 +1688,26 @@ public class StructureDefinitionRenderer extends ResourceRenderer { return c; } + private boolean isAttr(SourcedElementDefinition ed) { + for (Enumeration t : ed.getDefinition().getRepresentation()) { + if (t.getValue() == PropertyRepresentation.XMLATTR) { + return true; + } + } + return false; + } + + private void getAncestorElements(StructureDefinition profile, List ancestors) { + StructureDefinition base = context.getContext().fetchResource(StructureDefinition.class, profile.getBaseDefinition()); + if (base != null) { + getAncestorElements(base, ancestors); + for (ElementDefinition ed : base.getDifferential().getElement()) { + if (Utilities.charCount(ed.getPath(), '.') == 1) { + ancestors.add(new SourcedElementDefinition(base, ed)); + } + } + } + } private void addCanonicalListExt(HierarchicalTableGenerator gen, Cell c, List list, String start, boolean bold) { List clist = new ArrayList<>(); From ed07d1850663686172e44e24aafbde37c32403d5 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:35:36 +1000 Subject: [PATCH 05/11] Add support for special case codes in v2 (NNnnn) --- .../validation/ValueSetValidator.java | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java index 8242c88ea..24f29a319 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/validation/ValueSetValidator.java @@ -686,6 +686,9 @@ public class ValueSetValidator extends ValueSetProcessBase { private ValidationResult validateCode(String path, Coding code, CodeSystem cs, CodeableConcept vcc, ValidationProcessInfo info) { ConceptDefinitionComponent cc = cs.hasUserData("tx.cs.special") ? ((SpecialCodeSystem) cs.getUserData("tx.cs.special")).findConcept(code) : findCodeInConcept(cs.getConcept(), code.getCode(), allAltCodes); + if (cc == null) { + cc = findSpecialConcept(code, cs); + } if (cc == null) { if (cs.getContent() == CodeSystemContentMode.FRAGMENT) { String msg = context.formatMessage(I18nConstants.UNKNOWN_CODE__IN_FRAGMENT, code.getCode(), cs.getVersionedUrl()); @@ -759,6 +762,28 @@ public class ValueSetValidator extends ValueSetProcessBase { } } + private ConceptDefinitionComponent findSpecialConcept(Coding c, CodeSystem cs) { + // handling weird special cases in v2 code systems + if ("http://terminology.hl7.org/CodeSystem/v2-0203".equals(cs.getUrl())) { + String code = c.getCode(); + if (code != null && code.startsWith("NN") && code.length() > 3) { + ConceptDefinitionComponent cd = findCountryCode(code.substring(2)); + if (cd != null) { + return new ConceptDefinitionComponent(code).setDisplay("National Identifier for "+cd.getDisplay()); + } + } + } +// 0396: HL7nnnn, IBTnnnn, ISOnnnn, X12Dennnn, 99zzz +// 0335: PRNxxx + return null; + } + + + private ConceptDefinitionComponent findCountryCode(String code) { + ValidationResult vr = context.validateCode(new ValidationOptions(), "urn:iso:std:iso:3166", null, code, null); + return vr == null || !vr.isOk() ? null : new ConceptDefinitionComponent(code).setDisplay(vr.getDisplay()).setDefinition(vr.getDefinition()); + } + private IssueSeverity dispWarning() { return options.isDisplayWarningMode() ? IssueSeverity.WARNING : IssueSeverity.ERROR; } @@ -811,15 +836,6 @@ public class ValueSetValidator extends ValueSetProcessBase { return null; } - private String gen(Coding code) { - if (code.hasSystem()) { - return code.getSystem()+"#"+code.getCode(); - } else { - return null; - } - } - - private String getValueSetSystemOrNull() throws FHIRException { if (valueset == null) { return null; From 6fa4bb1061ccaecad83df4505a4f7cfc7f5e4398 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:38:05 +1000 Subject: [PATCH 06/11] change error to warning validating maps --- .../src/main/resources/Messages.properties | 8 +++---- .../instance/type/StructureMapValidator.java | 2 +- .../4.0.1/iso3166.cache | 21 +++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 92a8440e3..1a6aaa327 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -394,10 +394,10 @@ Does_not_match_slice_ = Does not match slice ''{0}'' (discriminator: {1}) Profile__does_not_match_for__because_of_the_following_profile_issues__ = Profile {0} does not match for {1} because of the following profile issues: {2} This_element_does_not_match_any_known_slice_ = This element does not match any known slice {0} defined_in_the_profile = Defined in the profile -This_does_not_appear_to_be_a_FHIR_resource_unknown_name_ = This does not appear to be a FHIR resource (unknown name ''{0}'') -This_cannot_be_parsed_as_a_FHIR_object_no_name = This cannot be parsed as a FHIR object (no name) -This_does_not_appear_to_be_a_FHIR_resource_unknown_namespacename_ = This does not appear to be a FHIR resource (unknown namespace/name ''{0}::{1}'') -This__cannot_be_parsed_as_a_FHIR_object_no_namespace = This ''{0}'' cannot be parsed as a FHIR object (no namespace) +This_does_not_appear_to_be_a_FHIR_resource_unknown_name_ = This content cannot be parsed (unknown or unrecognised XML root element name ''{0}'') +This_cannot_be_parsed_as_a_FHIR_object_no_name = This content cannot be parsed (no name) +This_does_not_appear_to_be_a_FHIR_resource_unknown_namespacename_ = This content cannot be parsed (unknown or unrecognised XML Root element namespace/name ''{0}::{1}'') +This__cannot_be_parsed_as_a_FHIR_object_no_namespace = This ''{0}'' cannot be parsed (no namespace on the XML Root element) Unable_to_find_resourceType_property = Unable to find resourceType property Error_parsing_JSON_the_primitive_value_must_be_a_string = Error parsing JSON: the primitive value must be a string Error_parsing_JSON_the_primitive_value_must_be_a_number = Error parsing JSON: the primitive value must be a number diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureMapValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureMapValidator.java index 3601d6cb2..4dc106aef 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureMapValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureMapValidator.java @@ -1169,7 +1169,7 @@ public class StructureMapValidator extends BaseValidator { Element g = (Element) grp.getTargetGroup().getUserData("element.source"); if (g.hasUserData("structuremap.parameters")) { VariableSet pvars = (VariableSet) g.getUserData("structuremap.parameters"); - rule(errors, "2023-03-01", IssueType.INVALID, dependent.line(), dependent.col(), stack.getLiteralPath(), pvars.matches(lvars), I18nConstants.SM_DEPENDENT_PARAM_TYPE_MISMATCH_DUPLICATE, grp.getTargetGroup().getName(), pvars.summary(), lvars.summary()); + warning(errors, "2023-03-01", IssueType.INVALID, dependent.line(), dependent.col(), stack.getLiteralPath(), pvars.matches(lvars), I18nConstants.SM_DEPENDENT_PARAM_TYPE_MISMATCH_DUPLICATE, grp.getTargetGroup().getName(), pvars.summary(), lvars.summary()); } else { g.setUserData("structuremap.parameters", lvars); } diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache index 338c0c8f6..5a050997c 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/iso3166.cache @@ -163,6 +163,27 @@ v: { "code" : "US", "system" : "urn:iso:std:iso:3166", "version" : "2018", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "urn:iso:std:iso:3166", + "code" : "FIN" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"true", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "Finland", + "code" : "FIN", + "system" : "urn:iso:std:iso:3166", + "version" : "2018", "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" From 3de8aa69fe8642395864d60ce3e7d8a047e068b0 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 13:42:25 +1000 Subject: [PATCH 07/11] handle additional bindings when generating snapshots for R5 profiles --- .../conformance/profile/ProfileUtilities.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java index bc3deedf1..e4d8342c7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java @@ -92,6 +92,7 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingCompo import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent; import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.UsageContext; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; @@ -2691,6 +2692,14 @@ public class ProfileUtilities extends TranslatingUtilities { if (d.hasValueSet()) { nb.setValueSet(d.getValueSet()); } + for (ElementDefinitionBindingAdditionalComponent ab : d.getAdditional()) { + ElementDefinitionBindingAdditionalComponent eab = getMatchingAdditionalBinding(nb, ab); + if (eab != null) { + mergeAdditionalBinding(eab, ab); + } else { + nb.getAdditional().add(ab); + } + } base.setBinding(nb); } else if (trimDifferential) derived.setBinding(null); @@ -2790,6 +2799,42 @@ public class ProfileUtilities extends TranslatingUtilities { //updateURLs(url, webUrl, dest); } + private void mergeAdditionalBinding(ElementDefinitionBindingAdditionalComponent dest, ElementDefinitionBindingAdditionalComponent source) { + for (UsageContext t : source.getUsage()) { + if (!hasUsage(dest, t)) { + dest.addUsage(t); + } + } + if (source.getAny()) { + source.setAny(true); + } + if (source.hasShortDoco()) { + dest.setShortDoco(source.getShortDoco()); + } + if (source.hasDocumentation()) { + dest.setDocumentation(source.getDocumentation()); + } + + } + + private boolean hasUsage(ElementDefinitionBindingAdditionalComponent dest, UsageContext tgt) { + for (UsageContext t : dest.getUsage()) { + if (t.getCode() != null && t.getCode().matches(tgt.getCode()) && t.getValue() != null && t.getValue().equals(tgt.getValue())) { + return true; + } + } + return false; + } + + private ElementDefinitionBindingAdditionalComponent getMatchingAdditionalBinding(ElementDefinitionBindingComponent nb,ElementDefinitionBindingAdditionalComponent ab) { + for (ElementDefinitionBindingAdditionalComponent t : nb.getAdditional()) { + if (t.getValueSet() != null && t.getValueSet().equals(ab.getValueSet()) && t.getPurpose() == ab.getPurpose()) { + return t; + } + } + return null; + } + private void mergeExtensions(Element tgt, Element src) { tgt.getExtension().addAll(src.getExtension()); } From cd79c491a0ee9a922e2eef7793e7569f975a5267 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 18:37:42 +1000 Subject: [PATCH 08/11] fix for new pubpack version --- .../main/java/org/hl7/fhir/utilities/npm/CommonPackages.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java index a2c600223..e1139c45a 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java @@ -6,6 +6,6 @@ public class CommonPackages { public static final String VER_XVER = "0.0.12"; public static final String ID_PUBPACK = "hl7.fhir.pubpack"; - public static final String VER_PUBPACK = "0.1.5"; + public static final String VER_PUBPACK = "0.1.6"; } From 1dfc11c519650adb2e9ba1f89afec0629a142587 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 29 Sep 2023 19:32:02 +1000 Subject: [PATCH 09/11] set up upgrade --- RELEASE_NOTES.md | 11 +++++++++-- pom.xml | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7b06c6ab5..9be1a84ea 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,14 @@ ## Validator Changes -* no changes +* Change Mapping type validation error to warning validating maps +* Add support for special case codes in v2 (NNnnn) +* Fix problem parsing logical model cda fragments +* Fix parsing logical model list attributes +* Fix issue parsing parameters in a target expression ## Other code changes -* no changes \ No newline at end of file +* Handle additional bindings when generating snapshots for R5 profiles +* Fix problem rendering additional bindings in R5 +* Fix for new pubpack version + diff --git a/pom.xml b/pom.xml index 005df2dda..03422197f 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 32.0.1-jre 6.4.1 - 1.4.6 + 1.4.7 2.15.2 5.9.2 1.8.2 From ddd3889268a3fce6618ae400af3e41106b6ee3b7 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 29 Sep 2023 10:45:20 +0000 Subject: [PATCH 10/11] Release: v6.1.10 ## Validator Changes * Change Mapping type validation error to warning validating maps * Add support for special case codes in v2 (NNnnn) * Fix problem parsing logical model cda fragments * Fix parsing logical model list attributes * Fix issue parsing parameters in a target expression ## Other code changes * Handle additional bindings when generating snapshots for R5 profiles * Fix problem rendering additional bindings in R5 * Fix for new pubpack version ***NO_CI*** --- org.hl7.fhir.convertors/pom.xml | 2 +- org.hl7.fhir.dstu2/pom.xml | 2 +- org.hl7.fhir.dstu2016may/pom.xml | 2 +- org.hl7.fhir.dstu3/pom.xml | 2 +- org.hl7.fhir.r4/pom.xml | 2 +- org.hl7.fhir.r4b/pom.xml | 2 +- org.hl7.fhir.r5/pom.xml | 2 +- org.hl7.fhir.report/pom.xml | 2 +- org.hl7.fhir.utilities/pom.xml | 2 +- org.hl7.fhir.validation.cli/pom.xml | 2 +- org.hl7.fhir.validation/pom.xml | 2 +- pom.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index 72c8517be..b783daa1a 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index c06ebec64..94fe9ecea 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index 994b35249..051a7f100 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index 937e3407f..cd9ebf607 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index 1c2b3a62e..e922efc6d 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.r4b/pom.xml b/org.hl7.fhir.r4b/pom.xml index f26b48362..e8ce0b48e 100644 --- a/org.hl7.fhir.r4b/pom.xml +++ b/org.hl7.fhir.r4b/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml index 79ee50a7a..5881333bb 100644 --- a/org.hl7.fhir.r5/pom.xml +++ b/org.hl7.fhir.r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.report/pom.xml b/org.hl7.fhir.report/pom.xml index 6b9212a38..3f746fc34 100644 --- a/org.hl7.fhir.report/pom.xml +++ b/org.hl7.fhir.report/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml index 710fda0fc..21fa81c67 100644 --- a/org.hl7.fhir.utilities/pom.xml +++ b/org.hl7.fhir.utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index eb86d2a76..a63ba7094 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index 89fa04958..6d422dc52 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 ../pom.xml diff --git a/pom.xml b/pom.xml index 03422197f..9456209b0 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ HAPI FHIR --> org.hl7.fhir.core - 6.1.10-SNAPSHOT + 6.1.10 pom From f9b3dbde57c23bfc4bef82c09c0ad56c8f1dee7d Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 29 Sep 2023 11:11:34 +0000 Subject: [PATCH 11/11] Updating version to: 6.1.11-SNAPSHOT and incrementing test cases dependency. --- RELEASE_NOTES.md | 11 ++--------- org.hl7.fhir.convertors/pom.xml | 2 +- org.hl7.fhir.dstu2/pom.xml | 2 +- org.hl7.fhir.dstu2016may/pom.xml | 2 +- org.hl7.fhir.dstu3/pom.xml | 2 +- org.hl7.fhir.r4/pom.xml | 2 +- org.hl7.fhir.r4b/pom.xml | 2 +- org.hl7.fhir.r5/pom.xml | 2 +- org.hl7.fhir.report/pom.xml | 2 +- org.hl7.fhir.utilities/pom.xml | 2 +- org.hl7.fhir.validation.cli/pom.xml | 2 +- org.hl7.fhir.validation/pom.xml | 2 +- pom.xml | 2 +- 13 files changed, 14 insertions(+), 21 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9be1a84ea..7b06c6ab5 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,14 +1,7 @@ ## Validator Changes -* Change Mapping type validation error to warning validating maps -* Add support for special case codes in v2 (NNnnn) -* Fix problem parsing logical model cda fragments -* Fix parsing logical model list attributes -* Fix issue parsing parameters in a target expression +* no changes ## Other code changes -* Handle additional bindings when generating snapshots for R5 profiles -* Fix problem rendering additional bindings in R5 -* Fix for new pubpack version - +* no changes \ No newline at end of file diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index b783daa1a..361503d76 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index 94fe9ecea..1eb6320bb 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index 051a7f100..e37bdd975 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index cd9ebf607..10ea12b45 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index e922efc6d..0cd9be460 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4b/pom.xml b/org.hl7.fhir.r4b/pom.xml index e8ce0b48e..4f2a087e3 100644 --- a/org.hl7.fhir.r4b/pom.xml +++ b/org.hl7.fhir.r4b/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml index 5881333bb..bb25672df 100644 --- a/org.hl7.fhir.r5/pom.xml +++ b/org.hl7.fhir.r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.report/pom.xml b/org.hl7.fhir.report/pom.xml index 3f746fc34..91764f9d1 100644 --- a/org.hl7.fhir.report/pom.xml +++ b/org.hl7.fhir.report/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml index 21fa81c67..3e71e99de 100644 --- a/org.hl7.fhir.utilities/pom.xml +++ b/org.hl7.fhir.utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index a63ba7094..33f44c241 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index 6d422dc52..ae318c486 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 9456209b0..203868ac2 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ HAPI FHIR --> org.hl7.fhir.core - 6.1.10 + 6.1.11-SNAPSHOT pom