main Build fixes: new version of FHIR (4.3.0) + transit to using release indicators in version + fix various build issues

This commit is contained in:
Grahame Grieve 2021-12-15 07:28:19 +11:00
parent 5b1412ce25
commit c15e60f2c6
19 changed files with 122 additions and 36 deletions

View File

@ -613,10 +613,10 @@ public class ElementDefinition30_40 {
Type t = ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getValueSet()); Type t = ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getValueSet());
if (t instanceof org.hl7.fhir.r4.model.Reference) { if (t instanceof org.hl7.fhir.r4.model.Reference) {
tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference());
tgt.getValueSetElement().addExtension(VersionConvertor_30_40.EXT_SRC_TYPE, new UriType("Reference")); tgt.getValueSetElement().addExtension(VersionConvertor_30_40.EXT_SRC_TYPE, new org.hl7.fhir.r4.model.UrlType("Reference"));
} else { } else {
tgt.setValueSet(t.primitiveValue()); tgt.setValueSet(t.primitiveValue());
tgt.getValueSetElement().addExtension(VersionConvertor_30_40.EXT_SRC_TYPE, new UriType("uri")); tgt.getValueSetElement().addExtension(VersionConvertor_30_40.EXT_SRC_TYPE, new org.hl7.fhir.r4.model.UrlType("uri"));
} }
tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet()));
} }

View File

@ -625,10 +625,10 @@ public class ElementDefinition30_50 {
DataType t = ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getValueSet()); DataType t = ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getValueSet());
if (t instanceof org.hl7.fhir.r5.model.Reference) { if (t instanceof org.hl7.fhir.r5.model.Reference) {
tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference());
tgt.getValueSetElement().addExtension(VersionConvertor_30_50.EXT_SRC_TYPE, new UriType("Reference")); tgt.getValueSetElement().addExtension(VersionConvertor_30_50.EXT_SRC_TYPE, new org.hl7.fhir.r5.model.UrlType("Reference"));
} else { } else {
tgt.setValueSet(t.primitiveValue()); tgt.setValueSet(t.primitiveValue());
tgt.getValueSetElement().addExtension(VersionConvertor_30_50.EXT_SRC_TYPE, new UriType("uri")); tgt.getValueSetElement().addExtension(VersionConvertor_30_50.EXT_SRC_TYPE, new org.hl7.fhir.r5.model.UrlType("uri"));
} }
tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet()));
} }

View File

@ -10036,6 +10036,7 @@ The primary difference between a medication statement and a medication administr
* R4B - manually added * R4B - manually added
*/ */
_4_1_0, _4_1_0,
_4_3_0_CIBUILD,
NULL; NULL;
public static FHIRVersion fromCode(String codeString) throws FHIRException { public static FHIRVersion fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString)) if (codeString == null || "".equals(codeString))
@ -10088,6 +10089,8 @@ The primary difference between a medication statement and a medication administr
return _4_0_1; return _4_0_1;
if ("4.1.0".equals(codeString)) if ("4.1.0".equals(codeString))
return _4_1_0; return _4_1_0;
if ("4.3.0-CIBUILD".equals(codeString))
return _4_3_0_CIBUILD;
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
} }
@Override @Override
@ -10120,6 +10123,8 @@ The primary difference between a medication statement and a medication administr
case _4_0_0: return "4.0.0"; case _4_0_0: return "4.0.0";
case _4_0_1: return "4.0.1"; case _4_0_1: return "4.0.1";
case _4_1_0: return "4.1.0"; case _4_1_0: return "4.1.0";
case _4_3_0_CIBUILD: return "4.3.0-CIBUILD";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
@ -10150,6 +10155,7 @@ The primary difference between a medication statement and a medication administr
case _4_0_0: return "http://hl7.org/fhir/FHIR-version"; case _4_0_0: return "http://hl7.org/fhir/FHIR-version";
case _4_0_1: return "http://hl7.org/fhir/FHIR-version"; case _4_0_1: return "http://hl7.org/fhir/FHIR-version";
case _4_1_0: return "http://hl7.org/fhir/FHIR-version"; case _4_1_0: return "http://hl7.org/fhir/FHIR-version";
case _4_3_0_CIBUILD: return "http://hl7.org/fhir/FHIR-version";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
@ -10179,7 +10185,8 @@ The primary difference between a medication statement and a medication administr
case _3_5_0: return "R4 Ballot #2."; case _3_5_0: return "R4 Ballot #2.";
case _4_0_0: return "FHIR Release 4 (Normative + STU)."; case _4_0_0: return "FHIR Release 4 (Normative + STU).";
case _4_0_1: return "FHIR Release 4 Technical Correction #1."; case _4_0_1: return "FHIR Release 4 Technical Correction #1.";
case _4_1_0: return "FHIR Release 4B"; case _4_1_0: return "FHIR Release 4B Ballot #1";
case _4_3_0_CIBUILD: return "FHIR Release 4B CI-Builld";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
@ -10210,6 +10217,7 @@ The primary difference between a medication statement and a medication administr
case _4_0_0: return "4.0.0"; case _4_0_0: return "4.0.0";
case _4_0_1: return "4.0.1"; case _4_0_1: return "4.0.1";
case _4_1_0: return "4.1.0"; case _4_1_0: return "4.1.0";
case _4_3_0_CIBUILD: return "4.3.0-CIBUILD";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
@ -10275,6 +10283,8 @@ The primary difference between a medication statement and a medication administr
return FHIRVersion._4_0_1; return FHIRVersion._4_0_1;
if ("4.1.0".equals(codeString)) if ("4.1.0".equals(codeString))
return FHIRVersion._4_1_0; return FHIRVersion._4_1_0;
if ("4.3.0-CIBUILD".equals(codeString))
return FHIRVersion._4_3_0_CIBUILD;
throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'"); throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'");
} }
public Enumeration<FHIRVersion> fromType(Base code) throws FHIRException { public Enumeration<FHIRVersion> fromType(Base code) throws FHIRException {
@ -10333,6 +10343,8 @@ The primary difference between a medication statement and a medication administr
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_0_1); return new Enumeration<FHIRVersion>(this, FHIRVersion._4_0_1);
if ("4.1.0".equals(codeString)) if ("4.1.0".equals(codeString))
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_1_0); return new Enumeration<FHIRVersion>(this, FHIRVersion._4_1_0);
if ("4.3.0-CIBUILD".equals(codeString))
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_3_0_CIBUILD);
throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'");
} }
public String toCode(FHIRVersion code) { public String toCode(FHIRVersion code) {
@ -10384,6 +10396,8 @@ The primary difference between a medication statement and a medication administr
return "4.0.1"; return "4.0.1";
if (code == FHIRVersion._4_1_0) if (code == FHIRVersion._4_1_0)
return "4.1.0"; return "4.1.0";
if (code == FHIRVersion._4_3_0_CIBUILD)
return "4.3.0_CIBUILD";
return "?"; return "?";
} }
public String toSystem(FHIRVersion code) { public String toSystem(FHIRVersion code) {

View File

@ -6716,6 +6716,10 @@ The MedicationUsage resource was previously called MedicationStatement.
* R5 Preview #1. * R5 Preview #1.
*/ */
_4_2_0, _4_2_0,
/**
* R4B
*/
_4_3_0_CIBUILD,
/** /**
* R5 Preview #2. * R5 Preview #2.
*/ */
@ -6733,8 +6737,6 @@ The MedicationUsage resource was previously called MedicationStatement.
*/ */
NULL; NULL;
public static final FHIRVersion R4B = FHIRVersion._4_1_0;
public static FHIRVersion fromCode(String codeString) throws FHIRException { public static FHIRVersion fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString)) if (codeString == null || "".equals(codeString))
return null; return null;
@ -6788,6 +6790,8 @@ The MedicationUsage resource was previously called MedicationStatement.
return _4_1_0; return _4_1_0;
if ("4.2.0".equals(codeString)) if ("4.2.0".equals(codeString))
return _4_2_0; return _4_2_0;
if ("4.3.0-CIBUILD".equals(codeString))
return _4_3_0_CIBUILD;
if ("4.4.0".equals(codeString)) if ("4.4.0".equals(codeString))
return _4_4_0; return _4_4_0;
if ("4.5.0".equals(codeString)) if ("4.5.0".equals(codeString))
@ -6823,6 +6827,7 @@ The MedicationUsage resource was previously called MedicationStatement.
case _4_0_1: return "4.0.1"; case _4_0_1: return "4.0.1";
case _4_1_0: return "4.1.0"; case _4_1_0: return "4.1.0";
case _4_2_0: return "4.2.0"; case _4_2_0: return "4.2.0";
case _4_3_0_CIBUILD: return "4.3.0-CIBUILD";
case _4_4_0: return "4.4.0"; case _4_4_0: return "4.4.0";
case _4_5_0: return "4.5.0"; case _4_5_0: return "4.5.0";
case _4_6_0: return "4.6.0"; case _4_6_0: return "4.6.0";
@ -6857,6 +6862,7 @@ The MedicationUsage resource was previously called MedicationStatement.
case _4_0_1: return "http://hl7.org/fhir/FHIR-version"; case _4_0_1: return "http://hl7.org/fhir/FHIR-version";
case _4_1_0: return "http://hl7.org/fhir/FHIR-version"; case _4_1_0: return "http://hl7.org/fhir/FHIR-version";
case _4_2_0: return "http://hl7.org/fhir/FHIR-version"; case _4_2_0: return "http://hl7.org/fhir/FHIR-version";
case _4_3_0_CIBUILD: return "http://hl7.org/fhir/FHIR-version";
case _4_4_0: return "http://hl7.org/fhir/FHIR-version"; case _4_4_0: return "http://hl7.org/fhir/FHIR-version";
case _4_5_0: return "http://hl7.org/fhir/FHIR-version"; case _4_5_0: return "http://hl7.org/fhir/FHIR-version";
case _4_6_0: return "http://hl7.org/fhir/FHIR-version"; case _4_6_0: return "http://hl7.org/fhir/FHIR-version";
@ -6891,6 +6897,7 @@ The MedicationUsage resource was previously called MedicationStatement.
case _4_0_1: return "FHIR Release 4 (Normative + STU) with 1 technical errata."; case _4_0_1: return "FHIR Release 4 (Normative + STU) with 1 technical errata.";
case _4_1_0: return "Interim Version."; case _4_1_0: return "Interim Version.";
case _4_2_0: return "R5 Preview #1."; case _4_2_0: return "R5 Preview #1.";
case _4_3_0_CIBUILD: return "R4B CIBuild";
case _4_4_0: return "R5 Preview #2."; case _4_4_0: return "R5 Preview #2.";
case _4_5_0: return "R5 Preview #3."; case _4_5_0: return "R5 Preview #3.";
case _4_6_0: return "R5 Draft Ballot."; case _4_6_0: return "R5 Draft Ballot.";
@ -6925,6 +6932,7 @@ The MedicationUsage resource was previously called MedicationStatement.
case _4_0_1: return "4.0.1"; case _4_0_1: return "4.0.1";
case _4_1_0: return "4.1.0"; case _4_1_0: return "4.1.0";
case _4_2_0: return "4.2.0"; case _4_2_0: return "4.2.0";
case _4_3_0_CIBUILD: return "4.3.0-CIBUILD";
case _4_4_0: return "4.4.0"; case _4_4_0: return "4.4.0";
case _4_5_0: return "4.5.0"; case _4_5_0: return "4.5.0";
case _4_6_0: return "4.6.0"; case _4_6_0: return "4.6.0";
@ -6988,6 +6996,8 @@ public String toCode(int len) {
return true; return true;
if ("4.2.0".equals(codeString)) if ("4.2.0".equals(codeString))
return true; return true;
if ("4.3.0-CIBUILD".equals(codeString))
return true;
return false; return false;
} }
@ -6998,7 +7008,7 @@ public String toCode(int len) {
public boolean isR4B() { public boolean isR4B() {
return toCode().startsWith("4.1"); return toCode().startsWith("4.1") || toCode().startsWith("4.3");
} }
// end addition // end addition
@ -7059,6 +7069,8 @@ public String toCode(int len) {
return FHIRVersion._4_1_0; return FHIRVersion._4_1_0;
if ("4.2.0".equals(codeString)) if ("4.2.0".equals(codeString))
return FHIRVersion._4_2_0; return FHIRVersion._4_2_0;
if ("4.3.0-CIBUILD".equals(codeString))
return FHIRVersion._4_3_0_CIBUILD;
if ("4.4.0".equals(codeString)) if ("4.4.0".equals(codeString))
return FHIRVersion._4_4_0; return FHIRVersion._4_4_0;
if ("4.5.0".equals(codeString)) if ("4.5.0".equals(codeString))
@ -7125,6 +7137,8 @@ public String toCode(int len) {
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_1_0); return new Enumeration<FHIRVersion>(this, FHIRVersion._4_1_0);
if ("4.2.0".equals(codeString)) if ("4.2.0".equals(codeString))
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_2_0); return new Enumeration<FHIRVersion>(this, FHIRVersion._4_2_0);
if ("4.3.0-CIBUILD".equals(codeString))
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_3_0_CIBUILD);
if ("4.4.0".equals(codeString)) if ("4.4.0".equals(codeString))
return new Enumeration<FHIRVersion>(this, FHIRVersion._4_4_0); return new Enumeration<FHIRVersion>(this, FHIRVersion._4_4_0);
if ("4.5.0".equals(codeString)) if ("4.5.0".equals(codeString))
@ -7184,6 +7198,8 @@ public String toCode(int len) {
return "4.1.0"; return "4.1.0";
if (code == FHIRVersion._4_2_0) if (code == FHIRVersion._4_2_0)
return "4.2.0"; return "4.2.0";
if (code == FHIRVersion._4_3_0_CIBUILD)
return "4.3.0-CIBUILD";
if (code == FHIRVersion._4_4_0) if (code == FHIRVersion._4_4_0)
return "4.4.0"; return "4.4.0";
if (code == FHIRVersion._4_5_0) if (code == FHIRVersion._4_5_0)

View File

@ -120,6 +120,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
generateByProfile(r, sd, r.root(), sd.getSnapshot().getElement(), ed, context.getProfileUtilities().getChildList(sd, ed), x, r.fhirType(), context.isTechnicalMode(), 0); generateByProfile(r, sd, r.root(), sd.getSnapshot().getElement(), ed, context.getProfileUtilities().getChildList(sd, ed), x, r.fhirType(), context.isTechnicalMode(), 0);
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("Error Generating Narrative for "+r.fhirType()+"/"+r.getId()+": "+e.getMessage());
e.printStackTrace(); e.printStackTrace();
x.para().b().style("color: maroon").tx("Exception generating Narrative: "+e.getMessage()); x.para().b().style("color: maroon").tx("Exception generating Narrative: "+e.getMessage());
} }

View File

@ -49,7 +49,7 @@ public class DOMWrappers {
@Override @Override
public Base getBase() throws UnsupportedEncodingException, IOException, FHIRException { public Base getBase() throws UnsupportedEncodingException, IOException, FHIRException {
if (type == null || type.equals("Resource") || type.equals("BackboneElement") || type.equals("Element")) if (Utilities.noString(type) || type.equals("Resource") || type.equals("BackboneElement") || type.equals("Element"))
return null; return null;
String xml; String xml;

View File

@ -33,6 +33,8 @@ package org.hl7.fhir.r5.terminologies;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -51,6 +53,7 @@ import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.DataType; import org.hl7.fhir.r5.model.DataType;
import org.hl7.fhir.r5.model.DateTimeType; import org.hl7.fhir.r5.model.DateTimeType;
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus; import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities.ConceptDefinitionComponentSorter;
import org.hl7.fhir.r5.model.Identifier; import org.hl7.fhir.r5.model.Identifier;
import org.hl7.fhir.r5.model.Meta; import org.hl7.fhir.r5.model.Meta;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
@ -60,6 +63,15 @@ import org.hl7.fhir.utilities.Utilities;
public class CodeSystemUtilities { public class CodeSystemUtilities {
public static class ConceptDefinitionComponentSorter implements Comparator<ConceptDefinitionComponent> {
@Override
public int compare(ConceptDefinitionComponent o1, ConceptDefinitionComponent o2) {
return o1.getCode().compareTo(o2.getCode());
}
}
public static final String USER_DATA_CROSS_LINK = "cs.utils.cross.link"; public static final String USER_DATA_CROSS_LINK = "cs.utils.cross.link";
public static class CodeSystemNavigator { public static class CodeSystemNavigator {
@ -273,6 +285,10 @@ public class CodeSystemUtilities {
} }
public static CodeSystem makeShareable(CodeSystem cs) { public static CodeSystem makeShareable(CodeSystem cs) {
if (!cs.hasExperimental()) {
cs.setExperimental(false);
}
if (!cs.hasMeta()) if (!cs.hasMeta())
cs.setMeta(new Meta()); cs.setMeta(new Meta());
for (UriType t : cs.getMeta().getProfile()) for (UriType t : cs.getMeta().getProfile())
@ -350,8 +366,12 @@ public class CodeSystemUtilities {
} }
if (fmm != null) { if (fmm != null) {
String sfmm = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_FMM_LEVEL); String sfmm = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_FMM_LEVEL);
if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) {
ToolingExtensions.setIntegerExtension(cs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm)); ToolingExtensions.setIntegerExtension(cs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
}
if (Integer.parseInt(fmm) <= 1) {
cs.setExperimental(true);
}
} }
} }
@ -500,4 +520,17 @@ public class CodeSystemUtilities {
return false; return false;
} }
public static void sortAllCodes(CodeSystem cs) {
sortAllCodes(cs.getConcept());
}
private static void sortAllCodes(List<ConceptDefinitionComponent> list) {
Collections.sort(list, new ConceptDefinitionComponentSorter());
for (ConceptDefinitionComponent cd : list) {
if (cd.hasConcept()) {
sortAllCodes(cd.getConcept());
}
}
}
} }

View File

@ -48,6 +48,9 @@ import org.hl7.fhir.utilities.Utilities;
public class ValueSetUtilities { public class ValueSetUtilities {
public static ValueSet makeShareable(ValueSet vs) { public static ValueSet makeShareable(ValueSet vs) {
if (!vs.hasExperimental()) {
vs.setExperimental(false);
}
if (!vs.hasMeta()) if (!vs.hasMeta())
vs.setMeta(new Meta()); vs.setMeta(new Meta());
for (UriType t : vs.getMeta().getProfile()) for (UriType t : vs.getMeta().getProfile())
@ -129,8 +132,12 @@ public class ValueSetUtilities {
} }
if (fmm != null) { if (fmm != null) {
String sfmm = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_FMM_LEVEL); String sfmm = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_FMM_LEVEL);
if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) {
ToolingExtensions.setIntegerExtension(vs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm)); ToolingExtensions.setIntegerExtension(vs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
}
if (Integer.parseInt(fmm) <= 1) {
vs.setExperimental(true);
}
} }
if (vs.hasUserData("cs")) if (vs.hasUserData("cs"))
CodeSystemUtilities.markStatus((CodeSystem) vs.getUserData("cs"), wg, status, pckage, fmm, normativeVersion); CodeSystemUtilities.markStatus((CodeSystem) vs.getUserData("cs"), wg, status, pckage, fmm, normativeVersion);

View File

@ -276,7 +276,7 @@ public class NPMPackageGenerator {
return "hl7.fhir.r3.core"; return "hl7.fhir.r3.core";
if (v.startsWith("4.0")) if (v.startsWith("4.0"))
return "hl7.fhir.r4.core"; return "hl7.fhir.r4.core";
if (v.startsWith("4.1")) if (v.startsWith("4.1") || v.startsWith("4.3"))
return "hl7.fhir.r4b.core"; return "hl7.fhir.r4b.core";
return null; return null;
} }

View File

@ -230,6 +230,7 @@ public class QuestionnaireBuilder {
questionnaire.setPublisher(profile.getPublisher()); questionnaire.setPublisher(profile.getPublisher());
Questionnaire.QuestionnaireItemComponent item = new Questionnaire.QuestionnaireItemComponent(); Questionnaire.QuestionnaireItemComponent item = new Questionnaire.QuestionnaireItemComponent();
questionnaire.addItem(item); questionnaire.addItem(item);
item.setLinkId("meta");
item.getCode().addAll(profile.getKeyword()); item.getCode().addAll(profile.getKeyword());
questionnaire.setId(nextId("qs")); questionnaire.setId(nextId("qs"));
} }
@ -241,6 +242,7 @@ public class QuestionnaireBuilder {
response.setStatus(QuestionnaireResponseStatus.INPROGRESS); response.setStatus(QuestionnaireResponseStatus.INPROGRESS);
QuestionnaireResponse.QuestionnaireResponseItemComponent item = new QuestionnaireResponse.QuestionnaireResponseItemComponent(); QuestionnaireResponse.QuestionnaireResponseItemComponent item = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
response.addItem(item); response.addItem(item);
item.setLinkId("meta");
item.setUserData("object", resource); item.setUserData("object", resource);
} }
@ -260,9 +262,10 @@ public class QuestionnaireBuilder {
display.setType(QuestionnaireItemType.DISPLAY); display.setType(QuestionnaireItemType.DISPLAY);
display.setText(element.getComment()); display.setText(element.getComment());
group.addItem(display); group.addItem(display);
display.setLinkId(element.getId()+"-display");
} }
group.setType(QuestionnaireItemType.GROUP); group.setType(QuestionnaireItemType.GROUP);
ToolingExtensions.addFlyOver(group, element.getDefinition()); ToolingExtensions.addFlyOver(group, element.getDefinition(), element.getId()+"-flyover");
group.setRequired(element.getMin() > 0); group.setRequired(element.getMin() > 0);
if (element.getMin() > 0) if (element.getMin() > 0)
ToolingExtensions.addMin(group, element.getMin()); ToolingExtensions.addMin(group, element.getMin());
@ -284,10 +287,11 @@ public class QuestionnaireBuilder {
nparents.addAll(parents); nparents.addAll(parents);
nparents.add(child); nparents.add(child);
QuestionnaireItemComponent childGroup = group.addItem(); QuestionnaireItemComponent childGroup = group.addItem();
childGroup.setLinkId(child.getId()+"-grp");
childGroup.setType(QuestionnaireItemType.GROUP); childGroup.setType(QuestionnaireItemType.GROUP);
List<QuestionnaireResponse.QuestionnaireResponseItemComponent> nResponse = new ArrayList<QuestionnaireResponse.QuestionnaireResponseItemComponent>(); List<QuestionnaireResponse.QuestionnaireResponseItemComponent> nResponse = new ArrayList<QuestionnaireResponse.QuestionnaireResponseItemComponent>();
processExisting(child.getPath(), answerGroups, nResponse); processExisting(child.getPath(), answerGroups, childGroup, nResponse);
// if the element has a type, we add a question. else we add a group on the basis that // if the element has a type, we add a question. else we add a group on the basis that
// it will have children of its own // it will have children of its own
if (child.getType().isEmpty() || isAbstractType(child.getType())) if (child.getType().isEmpty() || isAbstractType(child.getType()))
@ -334,13 +338,14 @@ public class QuestionnaireBuilder {
return path.substring(path.lastIndexOf('.')+1); return path.substring(path.lastIndexOf('.')+1);
} }
private void processExisting(String path, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> nResponse) throws FHIRException { private void processExisting(String path, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups, QuestionnaireItemComponent item, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> nResponse) throws FHIRException {
// processing existing data // processing existing data
for (QuestionnaireResponse.QuestionnaireResponseItemComponent ag : answerGroups) { for (QuestionnaireResponse.QuestionnaireResponseItemComponent ag : answerGroups) {
List<Base> children = ((Element) ag.getUserData("object")).listChildrenByName(tail(path)); List<Base> children = ((Element) ag.getUserData("object")).listChildrenByName(tail(path));
for (Base child : children) { for (Base child : children) {
if (child != null) { if (child != null) {
QuestionnaireResponse.QuestionnaireResponseItemComponent ans = ag.addItem(); QuestionnaireResponse.QuestionnaireResponseItemComponent ans = ag.addItem();
ag.setLinkId(item.getLinkId());
ans.setUserData("object", child); ans.setUserData("object", child);
nResponse.add(ans); nResponse.add(ans);
} }
@ -366,9 +371,9 @@ public class QuestionnaireBuilder {
} }
if (!Utilities.noString(element.getComment())) if (!Utilities.noString(element.getComment()))
ToolingExtensions.addFlyOver(group, element.getDefinition()+" "+element.getComment()); ToolingExtensions.addFlyOver(group, element.getDefinition()+" "+element.getComment(), group.getLinkId()+"-flyover");
else else
ToolingExtensions.addFlyOver(group, element.getDefinition()); ToolingExtensions.addFlyOver(group, element.getDefinition(), group.getLinkId()+"-flyover");
if (element.getType().size() > 1 || element.getType().get(0).getWorkingCode().equals("*")) { if (element.getType().size() > 1 || element.getType().get(0).getWorkingCode().equals("*")) {
List<TypeRefComponent> types = expandTypeList(element.getType()); List<TypeRefComponent> types = expandTypeList(element.getType());

View File

@ -468,11 +468,12 @@ public class ToolingExtensions {
// return findBooleanExtension(c, EXT_DEPRECATED); // return findBooleanExtension(c, EXT_DEPRECATED);
// } // }
public static void addFlyOver(QuestionnaireItemComponent item, String text){ public static void addFlyOver(QuestionnaireItemComponent item, String text, String linkId){
if (!StringUtils.isBlank(text)) { if (!StringUtils.isBlank(text)) {
QuestionnaireItemComponent display = item.addItem(); QuestionnaireItemComponent display = item.addItem();
display.setType(QuestionnaireItemType.DISPLAY); display.setType(QuestionnaireItemType.DISPLAY);
display.setText(text); display.setText(text);
display.setLinkId(linkId);
display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true)); display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true));
} }
} }

View File

@ -35,6 +35,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.VersionUtilities.VersionURLInfo;
public class TypesUtilities { public class TypesUtilities {
@ -111,7 +113,7 @@ public class TypesUtilities {
res.add(new WildcardInformation("id", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("id", TypeClassification.PRIMITIVE));
res.add(new WildcardInformation("instant", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("instant", TypeClassification.PRIMITIVE));
res.add(new WildcardInformation("integer", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("integer", TypeClassification.PRIMITIVE));
if (!version.startsWith("4.1")) { if (!VersionUtilities.isR4BVer(version)) {
res.add(new WildcardInformation("integer64", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("integer64", TypeClassification.PRIMITIVE));
} }
res.add(new WildcardInformation("markdown", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("markdown", TypeClassification.PRIMITIVE));
@ -130,6 +132,7 @@ public class TypesUtilities {
res.add(new WildcardInformation("Annotation", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Annotation", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Attachment", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Attachment", TypeClassification.DATATYPE));
res.add(new WildcardInformation("CodeableConcept", TypeClassification.DATATYPE)); res.add(new WildcardInformation("CodeableConcept", TypeClassification.DATATYPE));
res.add(new WildcardInformation("CodeableReference", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Coding", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Coding", TypeClassification.DATATYPE));
res.add(new WildcardInformation("ContactPoint", TypeClassification.DATATYPE)); res.add(new WildcardInformation("ContactPoint", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Count", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Count", TypeClassification.DATATYPE));
@ -142,6 +145,7 @@ public class TypesUtilities {
res.add(new WildcardInformation("Quantity", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Quantity", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Range", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Range", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Ratio", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Ratio", TypeClassification.DATATYPE));
res.add(new WildcardInformation("RatioRange", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Reference", " - a reference to another resource", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Reference", " - a reference to another resource", TypeClassification.DATATYPE));
res.add(new WildcardInformation("SampledData", TypeClassification.DATATYPE)); res.add(new WildcardInformation("SampledData", TypeClassification.DATATYPE));
res.add(new WildcardInformation("Signature", TypeClassification.DATATYPE)); res.add(new WildcardInformation("Signature", TypeClassification.DATATYPE));

View File

@ -127,11 +127,14 @@ 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", "4.1.0", CURRENT_FULL_VERSION); if (version.contains("-")) {
version = version.substring(0, version.indexOf("-"));
}
return Utilities.existsInList(version, "1.0.2", "1.4.0", "3.0.2", "4.0.1", "4.1.0", "4.3.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, 4.1.0, "+CURRENT_FULL_VERSION; return "1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, "+CURRENT_FULL_VERSION;
} }
public static boolean isR5Ver(String ver) { public static boolean isR5Ver(String ver) {
@ -139,7 +142,7 @@ public class VersionUtilities {
} }
public static boolean isR4BVer(String ver) { public static boolean isR4BVer(String ver) {
return ver != null && ver.startsWith("4.1"); return ver != null && (ver.startsWith("4.1") || ver.startsWith("4.3"));
} }
public static boolean isR4Ver(String ver) { public static boolean isR4Ver(String ver) {

View File

@ -83,8 +83,6 @@ import java.util.Map.Entry;
*/ */
public class FilesystemPackageCacheManager extends BasePackageCacheManager implements IPackageCacheManager { public class FilesystemPackageCacheManager extends BasePackageCacheManager implements IPackageCacheManager {
public static final String PRIMARY_SERVER = "http://packages.fhir.org";
public static final String SECONDARY_SERVER = "https://packages2.fhir.org/packages";
// private static final String SECONDARY_SERVER = "http://local.fhir.org:960/packages"; // private static final String SECONDARY_SERVER = "http://local.fhir.org:960/packages";
public static final String PACKAGE_REGEX = "^[a-zA-Z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+$"; public static final String PACKAGE_REGEX = "^[a-zA-Z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+$";
public static final String PACKAGE_VERSION_REGEX = "^[A-Za-z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+\\#[A-Za-z0-9\\-\\_\\$]+(\\.[A-Za-z0-9\\-\\_\\$]+)*$"; public static final String PACKAGE_VERSION_REGEX = "^[A-Za-z][A-Za-z0-9\\_\\-]*(\\.[A-Za-z0-9\\_\\-]+)+\\#[A-Za-z0-9\\-\\_\\$]+(\\.[A-Za-z0-9\\-\\_\\$]+)*$";
@ -102,8 +100,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
* Constructor * Constructor
*/ */
public FilesystemPackageCacheManager(boolean userMode, int toolsVersion) throws IOException { public FilesystemPackageCacheManager(boolean userMode, int toolsVersion) throws IOException {
addPackageServer(PRIMARY_SERVER); addPackageServer(PackageClient.PRIMARY_SERVER);
addPackageServer(SECONDARY_SERVER); addPackageServer(PackageClient.SECONDARY_SERVER);
if (userMode) if (userMode)
cacheFolder = Utilities.path(System.getProperty("user.home"), ".fhir", "packages"); cacheFolder = Utilities.path(System.getProperty("user.home"), ".fhir", "packages");
@ -226,7 +224,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
public String getLatestVersion(String id) throws IOException { public String getLatestVersion(String id) throws IOException {
for (String nextPackageServer : getPackageServers()) { for (String nextPackageServer : getPackageServers()) {
// special case: // special case:
if (!(CommonPackages.ID_PUBPACK.equals(id) && PRIMARY_SERVER.equals(nextPackageServer))) { if (!(CommonPackages.ID_PUBPACK.equals(id) && PackageClient.PRIMARY_SERVER.equals(nextPackageServer))) {
CachingPackageClient pc = new CachingPackageClient(nextPackageServer); CachingPackageClient pc = new CachingPackageClient(nextPackageServer);
try { try {
return pc.getLatestVersion(id); return pc.getLatestVersion(id);

View File

@ -25,6 +25,9 @@ import java.util.Set;
public class PackageClient { public class PackageClient {
public static final String PRIMARY_SERVER = "http://packages.fhir.org";
public static final String SECONDARY_SERVER = "https://packages2.fhir.org/packages";
private String address; private String address;
private String cacheFolder; private String cacheFolder;

View File

@ -10,6 +10,7 @@ import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.npm.CachingPackageClient; import org.hl7.fhir.utilities.npm.CachingPackageClient;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage; import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.PackageClient;
import org.hl7.fhir.utilities.npm.PackageInfo; import org.hl7.fhir.utilities.npm.PackageInfo;
import org.hl7.fhir.utilities.npm.ToolsVersion; import org.hl7.fhir.utilities.npm.ToolsVersion;
@ -22,7 +23,7 @@ public class PackageValidator {
private void execute() throws IOException { private void execute() throws IOException {
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION); FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
CachingPackageClient pc = new CachingPackageClient(FilesystemPackageCacheManager.PRIMARY_SERVER); CachingPackageClient pc = new CachingPackageClient(PackageClient.PRIMARY_SERVER);
for (PackageInfo t : pc.search(null, null, null, false)) { for (PackageInfo t : pc.search(null, null, null, false)) {
System.out.println("Check Package "+t.getId()); System.out.println("Check Package "+t.getId());
List<PackageInfo> vl = pc.getVersions(t.getId()); List<PackageInfo> vl = pc.getVersions(t.getId());

View File

@ -113,7 +113,7 @@ public class ProfileValidator extends BaseValidator {
if (snapshotElements != null) { if (snapshotElements != null) {
for (ElementDefinition diffElement : profile.getDifferential().getElement()) { for (ElementDefinition diffElement : profile.getDifferential().getElement()) {
if (diffElement == null) if (diffElement == null)
throw new Error("What?"); throw new Error("Diff Element is null - this is not an expected thing");
ElementDefinition snapElement = snapshotElements.get(diffElement.getId()); ElementDefinition snapElement = snapshotElements.get(diffElement.getId());
if (snapElement!=null) { // Happens with profiles in the main build - should be able to fix once snapshot generation is fixed - Lloyd if (snapElement!=null) { // Happens with profiles in the main build - should be able to fix once snapshot generation is fixed - Lloyd
warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), !checkMustSupport || snapElement.hasMustSupport(), "Elements included in the differential should declare mustSupport"); warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), !checkMustSupport || snapElement.hasMustSupport(), "Elements included in the differential should declare mustSupport");

View File

@ -19,7 +19,7 @@
<properties> <properties>
<hapi_fhir_version>5.1.0</hapi_fhir_version> <hapi_fhir_version>5.1.0</hapi_fhir_version>
<validator_test_case_version>1.1.82</validator_test_case_version> <validator_test_case_version>1.1.83-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version> <junit_jupiter_version>5.7.1</junit_jupiter_version>
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version> <junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version> <maven_surefire_version>3.0.0-M5</maven_surefire_version>