Merge pull request #546 from hapifhir/gg-20210624-misc

Gg 20210624 misc
This commit is contained in:
Grahame Grieve 2021-06-24 22:23:03 +10:00 committed by GitHub
commit 3e8137abd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 158 additions and 77 deletions

View File

@ -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

View File

@ -1,5 +1,7 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors;
import org.hl7.fhir.r5.renderers.QuestionnaireRenderer;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. 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_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_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;
} }

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.convertors.conv10_50; 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.VersionConvertor_10_50;
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50; import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
import org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat; 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;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent;
import org.hl7.fhir.r5.utils.ToolingExtensions;
public class Questionnaire10_50 { public class Questionnaire10_50 {
@ -126,8 +128,11 @@ public class Questionnaire10_50 {
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return null; return null;
org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory()); org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory());
VersionConvertor_10_50.copyElement(src, tgt); VersionConvertor_10_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
switch(src.getValue()) { 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: case BOOLEAN:
tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN); tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN);
break; break;
@ -174,6 +179,7 @@ public class Questionnaire10_50 {
tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL); tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL);
break; break;
} }
}
return tgt; return tgt;
} }
@ -239,6 +245,7 @@ public class Questionnaire10_50 {
return null; return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
VersionConvertor_10_50.copyElement(src, tgt); VersionConvertor_10_50.copyElement(src, tgt);
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
switch(src.getValue()) { switch(src.getValue()) {
case BOOLEAN: case BOOLEAN:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN); tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN);

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.convertors.conv14_50; 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.convertors.VersionConvertor_14_50;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.exceptions.FHIRException; 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.ContactDetail;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.r5.model.UsageContext; import org.hl7.fhir.r5.model.UsageContext;
public class Questionnaire14_50 { public class Questionnaire14_50 {
@ -202,6 +204,7 @@ public class Questionnaire14_50 {
return null; return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
VersionConvertor_14_50.copyElement(src, tgt); VersionConvertor_14_50.copyElement(src, tgt);
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
switch(src.getValue()) { switch(src.getValue()) {
case GROUP: case GROUP:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP);
@ -268,8 +271,11 @@ public class Questionnaire14_50 {
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return null; return null;
org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
VersionConvertor_14_50.copyElement(src, tgt); VersionConvertor_14_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
switch(src.getValue()) { 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: case GROUP:
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP); tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP);
break; break;
@ -322,6 +328,7 @@ public class Questionnaire14_50 {
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL); tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL);
break; break;
} }
}
return tgt; return tgt;
} }

View File

@ -1,10 +1,13 @@
package org.hl7.fhir.convertors.conv30_50; 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.convertors.VersionConvertor_30_50;
import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.exceptions.FHIRException; 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;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
import org.hl7.fhir.r5.utils.ToolingExtensions;
public class Questionnaire30_50 { public class Questionnaire30_50 {
@ -229,8 +232,11 @@ public class Questionnaire30_50 {
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return null; return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
VersionConvertor_30_50.copyElement(src, tgt); VersionConvertor_30_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
switch(src.getValue()) { 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: case GROUP:
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP); tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP);
break; break;
@ -282,6 +288,7 @@ public class Questionnaire30_50 {
default: default:
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL); tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL);
break; break;
}
} }
return tgt; return tgt;
} }
@ -291,6 +298,7 @@ public class Questionnaire30_50 {
return null; return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
VersionConvertor_30_50.copyElement(src, tgt); VersionConvertor_30_50.copyElement(src, tgt);
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
switch(src.getValue()) { switch(src.getValue()) {
case GROUP: case GROUP:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP);

View File

@ -1,6 +1,7 @@
package org.hl7.fhir.convertors.conv40_50.resources40_50; 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.VersionConvertor_40_50;
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Element40_50; import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Element40_50;
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Type40_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.r4.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
import org.hl7.fhir.r5.utils.ToolingExtensions;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
@ -216,6 +218,7 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
return null; return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
Element40_50.copyElement(src, tgt); Element40_50.copyElement(src, tgt);
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
switch(src.getValue()) { switch(src.getValue()) {
case GROUP: case GROUP:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.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()) if (src == null || src.isEmpty())
return null; return null;
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
Element40_50.copyElement(src, tgt); Element40_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
switch(src.getValue()) { if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) {
case GROUP: tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL));
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP); } else {
break; switch(src.getValue()) {
case DISPLAY: case GROUP:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP);
break; 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 QUESTION: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION;
case BOOLEAN: case BOOLEAN:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN);
break; break;
case DECIMAL: case DECIMAL:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL);
break; break;
case INTEGER: case INTEGER:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER);
break; break;
case DATE: case DATE:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE);
break; break;
case DATETIME: case DATETIME:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
break; break;
case TIME: case TIME:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME);
break; break;
case STRING: case STRING:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING);
break; break;
case TEXT: case TEXT:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT);
break; break;
case URL: case URL:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL);
break; break;
case CODING: case CODING:
if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING) if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
else else
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
break; break;
case ATTACHMENT: case ATTACHMENT:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
break; break;
case REFERENCE: case REFERENCE:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE);
break; break;
case QUANTITY: case QUANTITY:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY);
break; break;
default: default:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL); tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL);
break; break;
}
} }
return tgt; return tgt;
} }

View File

@ -38,6 +38,7 @@ import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public class QuestionnaireRenderer extends TerminologyRenderer { 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) { public QuestionnaireRenderer(RenderingContext context) {
super(context); super(context);
@ -222,7 +223,12 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
String txt = (i.hasPrefix() ? i.getPrefix() + ". " : "") + i.getText(); 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, 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, 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) { if (hasFlags) {
// flags: // flags:

View File

@ -20,6 +20,7 @@ import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser; import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.PackageHacker;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -84,7 +85,7 @@ public class XVerExtensionManager {
StructureDefinition sd = new StructureDefinition(); StructureDefinition sd = new StructureDefinition();
sd.setUserData(XVER_EXT_MARKER, "true"); 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.setUrl(url);
sd.setVersion(context.getVersion()); sd.setVersion(context.getVersion());
sd.setFhirVersion(FHIRVersion.fromCode(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("\\|")) { for (String p : s.substring(0, s.length()-1).split("\\|")) {
if ("Any".equals(p)) { if ("Any".equals(p)) {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource"); 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); tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p);
} }
} }

View File

@ -71,6 +71,11 @@ public class VersionUtilities {
if (isR4Ver(v)) { if (isR4Ver(v)) {
return "hl7.fhir.r4.core"; return "hl7.fhir.r4.core";
} }
if (isR4BVer(v)) {
return "hl7.fhir.r4b.core";
}
if ("current".equals(v)) { if ("current".equals(v)) {
return "hl7.fhir.r5.core"; return "hl7.fhir.r5.core";
} }
@ -122,17 +127,21 @@ public class VersionUtilities {
} }
public static boolean isSupportedVersion(String version) { 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() { 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) { public static boolean isR5Ver(String ver) {
return ver != null && ver.startsWith(CURRENT_VERSION); 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) { public static boolean isR4Ver(String ver) {
return ver != null && ver.startsWith("4.0"); return ver != null && ver.startsWith("4.0");
} }

View File

@ -719,7 +719,8 @@ public class NpmPackage {
public String fhirVersion() { public String fhirVersion() {
if ("hl7.fhir.core".equals(JSONUtil.str(npm, "name"))) if ("hl7.fhir.core".equals(JSONUtil.str(npm, "name")))
return JSONUtil.str(npm, "version"); 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"); return JSONUtil.str(npm, "version");
else { else {
JsonObject dep = npm.getAsJsonObject("dependencies"); JsonObject dep = npm.getAsJsonObject("dependencies");

View File

@ -24,8 +24,10 @@ import com.google.gson.JsonObject;
*/ */
public class PackageHacker { public class PackageHacker {
private static boolean useSecureReferences = false;
public static void main(String[] args) throws FileNotFoundException, IOException { 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 { private void edit(String name) throws FileNotFoundException, IOException {
@ -57,8 +59,8 @@ public class PackageHacker {
private void change(JsonObject npm, Map<String, byte[]> content) throws FileNotFoundException, IOException { private void change(JsonObject npm, Map<String, byte[]> content) throws FileNotFoundException, IOException {
fixVersions(npm); fixVersions(npm);
npm.remove("url"); npm.remove("notForPublication");
npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1"); // npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1");
// npm.remove("name"); // npm.remove("name");
// npm.addProperty("name", "hl7.fhir.uv.smart-app-launch"); // npm.addProperty("name", "hl7.fhir.uv.smart-app-launch");
// npm.remove("canonical"); // 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.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"; 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;
} }
} }

View File

@ -857,7 +857,6 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
private void checkModel(TableModel model) throws FHIRException { private void checkModel(TableModel model) throws FHIRException {
check(!model.getRows().isEmpty(), "Must have rows");
check(!model.getTitles().isEmpty(), "Must have titles"); check(!model.getTitles().isEmpty(), "Must have titles");
int tc = 0; int tc = 0;
for (Cell c : model.getTitles()) { for (Cell c : model.getTitles()) {

View File

@ -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", "4.0.1"));
Assertions.assertTrue(!client.exists("hl7.fhir.r4.core", "1.0.2")); 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.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 @Test

View File

@ -22,7 +22,7 @@ public class PackageCacheTests {
System.out.println("remaining packages: "+list.toString()); System.out.println("remaining packages: "+list.toString());
} }
Assertions.assertTrue(list.isEmpty(), "List should be true but is "+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(); npm.loadAllFiles();
Assertions.assertNotNull(npm); Assertions.assertNotNull(npm);
File dir = new File(Utilities.path("[tmp]", "cache")); File dir = new File(Utilities.path("[tmp]", "cache"));

View File

@ -291,8 +291,8 @@ public class StructureDefinitionValidator extends BaseValidator {
StructureDefinition t = determineBaseType(sd); StructureDefinition t = determineBaseType(sd);
if (t == null) { if (t == null) {
rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_NOTYPE, p); rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), false, I18nConstants.SD_ED_TYPE_PROFILE_NOTYPE, p);
} else { } else if (!isInstanceOf(t, code)) {
rule(errors, IssueType.EXCEPTION, stack.getLiteralPath(), isInstanceOf(t, code), I18nConstants.SD_ED_TYPE_PROFILE_WRONG, p, t, code, path); 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) { 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()); sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
} }
return sd; return sd;

View File

@ -121,7 +121,7 @@ public class ComparisonTests {
System.out.println("---- Set up Output ----------------------------------------------------------"); System.out.println("---- Set up Output ----------------------------------------------------------");
Utilities.createDirectory(Utilities.path("[tmp]", "comparison")); Utilities.createDirectory(Utilities.path("[tmp]", "comparison"));
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION); 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")) { for (String f : npm.list("other")) {
TextFile.streamToFile(npm.load("other", f), Utilities.path("[tmp]", "comparison", f)); TextFile.streamToFile(npm.load("other", f), Utilities.path("[tmp]", "comparison", f));
} }

View File

@ -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"); // 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.us.core#1.0.1", false);
// ve.loadIg("hl7.fhir.au.base#current", 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"; // String left = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient";