diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e69de29bb..b36e9274c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -0,0 +1,15 @@ +Validator: +* Fix problem importing x-version extensions with multiple targets +* fix bug validating profiles on bundle.entry.resource + +Version Conversion: + +* Round trip old questionnaires properly with R5 (item.type) + +Other code changes: + +* Fix up questionnaire rendering for old versions +* Add support for using https:// references to HL7 website +* Add support for using https:// references to HL7 website +* Add support for R4B to context +* update pubpack to v0.0.9 \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorConstants.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorConstants.java index 7e1a38214..ac321448a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorConstants.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorConstants.java @@ -1,5 +1,7 @@ package org.hl7.fhir.convertors; +import org.hl7.fhir.r5.renderers.QuestionnaireRenderer; + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,4 +103,5 @@ public class VersionConvertorConstants { public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence"; public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name"; + public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = QuestionnaireRenderer.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL; } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java index ede458bb0..dd5795735 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java @@ -1,5 +1,6 @@ package org.hl7.fhir.convertors.conv10_50; +import org.hl7.fhir.convertors.VersionConvertorConstants; import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50; import org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat; @@ -10,6 +11,7 @@ import org.hl7.fhir.r5.model.ContactDetail; import org.hl7.fhir.r5.model.Questionnaire; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; +import org.hl7.fhir.r5.utils.ToolingExtensions; public class Questionnaire10_50 { @@ -126,8 +128,11 @@ public class Questionnaire10_50 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory()); - VersionConvertor_10_50.copyElement(src, tgt); - switch(src.getValue()) { + VersionConvertor_10_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); + if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { + tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)); + } else { + switch(src.getValue()) { case BOOLEAN: tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN); break; @@ -174,6 +179,7 @@ public class Questionnaire10_50 { tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL); break; } + } return tgt; } @@ -239,6 +245,7 @@ public class Questionnaire10_50 { return null; org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); VersionConvertor_10_50.copyElement(src, tgt); + tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString())); switch(src.getValue()) { case BOOLEAN: tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java index 5960af264..140704595 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java @@ -1,5 +1,6 @@ package org.hl7.fhir.convertors.conv14_50; +import org.hl7.fhir.convertors.VersionConvertorConstants; import org.hl7.fhir.convertors.VersionConvertor_14_50; import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.exceptions.FHIRException; @@ -7,6 +8,7 @@ import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.ContactDetail; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator; +import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.model.UsageContext; public class Questionnaire14_50 { @@ -202,6 +204,7 @@ public class Questionnaire14_50 { return null; org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); VersionConvertor_14_50.copyElement(src, tgt); + tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString())); switch(src.getValue()) { case GROUP: tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); @@ -268,8 +271,11 @@ public class Questionnaire14_50 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Enumeration tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); - VersionConvertor_14_50.copyElement(src, tgt); - switch(src.getValue()) { + VersionConvertor_14_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); + if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { + tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)); + } else { + switch(src.getValue()) { case GROUP: tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP); break; @@ -322,6 +328,7 @@ public class Questionnaire14_50 { tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL); break; } + } return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java index d3ede0336..57db0d20a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java @@ -1,10 +1,13 @@ package org.hl7.fhir.convertors.conv30_50; +import org.hl7.fhir.convertors.VersionConvertorConstants; import org.hl7.fhir.convertors.VersionConvertor_30_50; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.Questionnaire; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; +import org.hl7.fhir.r5.utils.ToolingExtensions; public class Questionnaire30_50 { @@ -229,8 +232,11 @@ public class Questionnaire30_50 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); - VersionConvertor_30_50.copyElement(src, tgt); - switch(src.getValue()) { + VersionConvertor_30_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); + if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { + tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)); + } else { + switch(src.getValue()) { case GROUP: tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP); break; @@ -282,6 +288,7 @@ public class Questionnaire30_50 { default: tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL); break; + } } return tgt; } @@ -291,6 +298,7 @@ public class Questionnaire30_50 { return null; org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); VersionConvertor_30_50.copyElement(src, tgt); + tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString())); switch(src.getValue()) { case GROUP: tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Questionnaire40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Questionnaire40_50.java index 0f4073f94..42b59450b 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Questionnaire40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Questionnaire40_50.java @@ -1,6 +1,7 @@ package org.hl7.fhir.convertors.conv40_50.resources40_50; +import org.hl7.fhir.convertors.VersionConvertorConstants; import org.hl7.fhir.convertors.VersionConvertor_40_50; import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Element40_50; import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Type40_50; @@ -15,6 +16,7 @@ import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; +import org.hl7.fhir.r5.utils.ToolingExtensions; /* Copyright (c) 2011+, HL7, Inc. @@ -216,6 +218,7 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 { return null; org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); Element40_50.copyElement(src, tgt); + tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString())); switch(src.getValue()) { case GROUP: tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); @@ -279,60 +282,64 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); - Element40_50.copyElement(src, tgt); - switch(src.getValue()) { - case GROUP: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP); - break; - case DISPLAY: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY); - break; + Element40_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); + if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { + tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)); + } else { + switch(src.getValue()) { + case GROUP: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP); + break; + case DISPLAY: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY); + break; // case QUESTION: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN); - break; - case DECIMAL: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL); - break; - case INTEGER: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER); - break; - case DATE: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE); - break; - case DATETIME: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME); - break; - case TIME: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME); - break; - case STRING: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING); - break; - case TEXT: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT); - break; - case URL: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL); - break; - case CODING: - if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING) - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE); - else - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE); - break; - case ATTACHMENT: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT); - break; - case REFERENCE: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE); - break; - case QUANTITY: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY); - break; - default: - tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL); - break; + case BOOLEAN: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN); + break; + case DECIMAL: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL); + break; + case INTEGER: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER); + break; + case DATE: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE); + break; + case DATETIME: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME); + break; + case TIME: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME); + break; + case STRING: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING); + break; + case TEXT: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT); + break; + case URL: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL); + break; + case CODING: + if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING) + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE); + else + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE); + break; + case ATTACHMENT: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT); + break; + case REFERENCE: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE); + break; + case QUANTITY: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY); + break; + default: + tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL); + break; + } } return tgt; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java index ad80d7ae4..4c9769072 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java @@ -38,6 +38,7 @@ import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel; import org.hl7.fhir.utilities.xhtml.XhtmlNode; public class QuestionnaireRenderer extends TerminologyRenderer { + public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = "http://hl7.org/fhir/tools/StructureDefinition/original-item-type"; public QuestionnaireRenderer(RenderingContext context) { super(context); @@ -222,7 +223,12 @@ public class QuestionnaireRenderer extends TerminologyRenderer { String txt = (i.hasPrefix() ? i.getPrefix() + ". " : "") + i.getText(); r.getCells().add(gen.new Cell(null, null, txt, null, null)); r.getCells().add(gen.new Cell(null, null, (i.getRequired() ? "1" : "0")+".."+(i.getRepeats() ? "*" : "1"), null, null)); - r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#"+i.getType().toCode(), i.getType().toCode(), null, null)); + if (i.getTypeElement().hasExtension(EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { + String t = i.getTypeElement().getExtensionString(EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); + r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#item-type-"+t, t, null, null)); + } else { + r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#item-type-"+i.getType().toCode(), i.getType().toCode(), null, null)); + } if (hasFlags) { // flags: diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java index fd682d128..bfdf2ac05 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java @@ -20,6 +20,7 @@ import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.json.JsonTrackingParser; +import org.hl7.fhir.utilities.npm.PackageHacker; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -84,7 +85,7 @@ public class XVerExtensionManager { StructureDefinition sd = new StructureDefinition(); sd.setUserData(XVER_EXT_MARKER, "true"); - sd.setUserData("path", "http://hl7.org/fhir/versions.html#extensions"); + sd.setUserData("path", PackageHacker.fixPackageUrl("https://hl7.org/fhir/versions.html#extensions")); sd.setUrl(url); sd.setVersion(context.getVersion()); sd.setFhirVersion(FHIRVersion.fromCode(context.getVersion())); @@ -138,7 +139,11 @@ public class XVerExtensionManager { for (String p : s.substring(0, s.length()-1).split("\\|")) { if ("Any".equals(p)) { tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource"); - } else { + } else if (p.contains(",")) { + for (String pp : p.split("\\,")) { + tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+pp); + } + } else { tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p); } } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java index ce706d0fe..5cba7179a 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java @@ -71,6 +71,11 @@ public class VersionUtilities { if (isR4Ver(v)) { return "hl7.fhir.r4.core"; } + + if (isR4BVer(v)) { + return "hl7.fhir.r4b.core"; + } + if ("current".equals(v)) { return "hl7.fhir.r5.core"; } @@ -122,17 +127,21 @@ public class VersionUtilities { } public static boolean isSupportedVersion(String version) { - return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", CURRENT_FULL_VERSION); + return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", CURRENT_FULL_VERSION); } public static String listSupportedVersions() { - return "1.0.2, 1.4.0, 3.0.2, 4.0.1, "+CURRENT_FULL_VERSION; + return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, "+CURRENT_FULL_VERSION; } public static boolean isR5Ver(String ver) { return ver != null && ver.startsWith(CURRENT_VERSION); } + public static boolean isR4BVer(String ver) { + return ver != null && ver.startsWith("4.1"); + } + public static boolean isR4Ver(String ver) { return ver != null && ver.startsWith("4.0"); } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java index 310872d96..ae3bc4039 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java @@ -719,7 +719,8 @@ public class NpmPackage { public String fhirVersion() { if ("hl7.fhir.core".equals(JSONUtil.str(npm, "name"))) return JSONUtil.str(npm, "version"); - else if (JSONUtil.str(npm, "name").startsWith("hl7.fhir.r2.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r2b.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r3.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r4.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r5.")) + else if (JSONUtil.str(npm, "name").startsWith("hl7.fhir.r2.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r2b.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r3.") || + JSONUtil.str(npm, "name").startsWith("hl7.fhir.r4.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r4b.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r5.")) return JSONUtil.str(npm, "version"); else { JsonObject dep = npm.getAsJsonObject("dependencies"); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java index 26e7d9637..76c1e5cfc 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java @@ -24,8 +24,10 @@ import com.google.gson.JsonObject; */ public class PackageHacker { + private static boolean useSecureReferences = false; + public static void main(String[] args) throws FileNotFoundException, IOException { - new PackageHacker().edit("M:\\web\\hl7.org\\fhir\\us\\carin-rtpbc\\package.tgz"); + new PackageHacker().edit("M:\\web\\hl7.org\\fhir\\2021Mar\\hl7.fhir.r4b.expansions.tgz"); } private void edit(String name) throws FileNotFoundException, IOException { @@ -57,8 +59,8 @@ public class PackageHacker { private void change(JsonObject npm, Map content) throws FileNotFoundException, IOException { fixVersions(npm); - npm.remove("url"); - npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1"); + npm.remove("notForPublication"); +// npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1"); // npm.remove("name"); // npm.addProperty("name", "hl7.fhir.uv.smart-app-launch"); // npm.remove("canonical"); @@ -137,7 +139,19 @@ public class PackageHacker { case "file://C:\\GitHub\\hl7.fhir.uv.security-label-ds4p#0.1.0\\output": return "http://hl7.org/fhir/uv/security-label-ds4p/2020May"; case "file://C:\\GitHub\\hl7.fhir.uv.shorthand#0.12.0\\output": return "http://hl7.org/fhir/uv/shorthand/2020May"; } - return webref; + if (isUseSecureReferences()) { + return webref.replace("http://hl7.org/fhir", "https://hl7.org/fhir").replace("http://build.fhir.org", "https://build.fhir.org"); + } else { + return webref; + } + } + + public static boolean isUseSecureReferences() { + return useSecureReferences; + } + + public static void setUseSecureReferences(boolean useSecureReferences) { + PackageHacker.useSecureReferences = useSecureReferences; } } \ No newline at end of file diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java index 0a814823f..b197b484b 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java @@ -857,7 +857,6 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { private void checkModel(TableModel model) throws FHIRException { - check(!model.getRows().isEmpty(), "Must have rows"); check(!model.getTitles().isEmpty(), "Must have titles"); int tc = 0; for (Cell c : model.getTitles()) { diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/CachingPackageClientTests.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/CachingPackageClientTests.java index fceb206ea..c4534d237 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/CachingPackageClientTests.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/CachingPackageClientTests.java @@ -66,7 +66,7 @@ public class CachingPackageClientTests { Assertions.assertTrue(client.exists("hl7.fhir.r4.core", "4.0.1")); Assertions.assertTrue(!client.exists("hl7.fhir.r4.core", "1.0.2")); Assertions.assertTrue(!client.exists("hl7.fhir.nothing", "1.0.1")); - Assertions.assertTrue(client.exists("hl7.fhir.pubpack", "0.0.7")); + Assertions.assertTrue(client.exists("hl7.fhir.pubpack", "0.0.9")); } @Test diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/PackageCacheTests.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/PackageCacheTests.java index 97a6c70a1..a20d5f382 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/PackageCacheTests.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/PackageCacheTests.java @@ -22,7 +22,7 @@ public class PackageCacheTests { System.out.println("remaining packages: "+list.toString()); } Assertions.assertTrue(list.isEmpty(), "List should be true but is "+list.toString()); - NpmPackage npm = cache.loadPackage("hl7.fhir.pubpack", "0.0.7"); + NpmPackage npm = cache.loadPackage("hl7.fhir.pubpack", "0.0.9"); npm.loadAllFiles(); Assertions.assertNotNull(npm); File dir = new File(Utilities.path("[tmp]", "cache")); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java index e9aaedfcc..311b05973 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java @@ -291,8 +291,8 @@ public class StructureDefinitionValidator extends BaseValidator { StructureDefinition t = determineBaseType(sd); if (t == null) { rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_NOTYPE, p); - } else { - rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), isInstanceOf(t, code), I18nConstants.SD_ED_TYPE_PROFILE_WRONG, p, t, code, path); + } else if (!isInstanceOf(t, code)) { + rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_WRONG, p, t, code, path); } } } @@ -343,7 +343,7 @@ public class StructureDefinitionValidator extends BaseValidator { } private StructureDefinition determineBaseType(StructureDefinition sd) { - while (sd != null && !sd.hasType() && sd.getDerivation() == TypeDerivationRule.CONSTRAINT) { + while (sd != null && sd.getDerivation() == TypeDerivationRule.CONSTRAINT) { sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); } return sd; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/comparison/tests/ComparisonTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/comparison/tests/ComparisonTests.java index eac208e8b..ed91f33cd 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/comparison/tests/ComparisonTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/comparison/tests/ComparisonTests.java @@ -121,7 +121,7 @@ public class ComparisonTests { System.out.println("---- Set up Output ----------------------------------------------------------"); Utilities.createDirectory(Utilities.path("[tmp]", "comparison")); FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION); - NpmPackage npm = pcm.loadPackage("hl7.fhir.pubpack", "0.0.7"); + NpmPackage npm = pcm.loadPackage("hl7.fhir.pubpack", "0.0.9"); for (String f : npm.list("other")) { TextFile.streamToFile(npm.load("other", f), Utilities.path("[tmp]", "comparison", f)); } diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java index 39cbc6c25..41bc4376e 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java @@ -13,7 +13,7 @@ public class ProfileComparisonTests { // ValidationEngine ve = new ValidationEngine("hl7.fhir.r3.core#3.0.2", DEF_TX, null, FhirPublication.STU3, "3.0.2"); // ve.loadIg("hl7.fhir.us.core#1.0.1", false); // ve.loadIg("hl7.fhir.au.base#current", false); -// ve.getContext().loadFromPackage(new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION).loadPackage("hl7.fhir.pubpack", "0.0.7"), new R5ToR5Loader(new String[] {"Binary"}), "Binary"); +// ve.getContext().loadFromPackage(new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION).loadPackage("hl7.fhir.pubpack", "0.0.9"), new R5ToR5Loader(new String[] {"Binary"}), "Binary"); // // // String left = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient";