Skip to content

Commit

Permalink
Merge pull request #1821 from hapifhir/2024-11-gg-various-fixes
Browse files Browse the repository at this point in the history
2024 11 gg various fixes
  • Loading branch information
grahamegrieve authored Nov 21, 2024
2 parents 1854a66 + 717ef9c commit aa22897
Show file tree
Hide file tree
Showing 50 changed files with 6,790 additions and 754 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhi
if (src == null)
return null;
org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem();
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
if (src.hasUrlElement())
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL);
if (src.hasUrlElement()) {
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri40_50.convertUri(src.getUrlElement())));
}
if (src.hasVersionElement())
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String40_50.convertString(src.getVersionElement())));
if (src.hasName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2718,18 +2718,24 @@ else if (trimDifferential)
// profiles cannot change : isModifier, defaultValue, meaningWhenMissing
// but extensions can change isModifier
if (isExtension) {
if (derived.hasIsModifierElement() && !(base.hasIsModifierElement() && Base.compareDeep(derived.getIsModifierElement(), base.getIsModifierElement(), false)))
if (derived.hasIsModifierElement() && !(base.hasIsModifierElement() && Base.compareDeep(derived.getIsModifierElement(), base.getIsModifierElement(), false))) {
base.setIsModifierElement(derived.getIsModifierElement().copy());
else if (trimDifferential)
} else if (trimDifferential) {
derived.setIsModifierElement(null);
else if (derived.hasIsModifierElement())
} else if (derived.hasIsModifierElement()) {
derived.getIsModifierElement().setUserData(UserDataNames.SNAPSHOT_DERIVATION_EQUALS, true);
if (derived.hasIsModifierReasonElement() && !(base.hasIsModifierReasonElement() && Base.compareDeep(derived.getIsModifierReasonElement(), base.getIsModifierReasonElement(), false)))
}
if (derived.hasIsModifierReasonElement() && !(base.hasIsModifierReasonElement() && Base.compareDeep(derived.getIsModifierReasonElement(), base.getIsModifierReasonElement(), false))) {
base.setIsModifierReasonElement(derived.getIsModifierReasonElement().copy());
else if (trimDifferential)
} else if (trimDifferential) {
derived.setIsModifierReasonElement(null);
else if (derived.hasIsModifierReasonElement())
} else if (derived.hasIsModifierReasonElement()) {
derived.getIsModifierReasonElement().setUserData(UserDataNames.SNAPSHOT_DERIVATION_EQUALS, true);
}
if (base.getIsModifier() && !base.hasIsModifierReason()) {
// we get here because modifier extensions don't get a modifier reason from the type
base.setIsModifierReason("Modifier extensions are labelled as such because they modify the meaning or interpretation of the resource or element that contains them");
}
}

boolean hasBinding = derived.hasBinding();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,20 @@ public Element getExtension(String url) {
return null;
}

public String getExtensionString(String url) {
if (children != null) {
for (Element child : children) {
if (extensionList.contains(child.getName())) {
String u = child.getChildValue("url");
if (url.equals(u)) {
return child.getNamedChildValue("value");
}
}
}
}
return null;
}

public List<Element> getExtensions(String url) {
List<Element> list = new ArrayList<>();
if (children != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,9 @@ public void compose(Element e, OutputStream stream, OutputStyle style, String id
}
checkComposeComments(e);
json.beginObject();
// if (!isSuppressResourceType())
if (!isSuppressResourceType(e.getProperty())) {
prop("resourceType", e.getType(), null);
}
Set<String> done = new HashSet<String>();
for (Element child : e.getChildren()) {
compose(e.getName(), e, done, child);
Expand All @@ -799,6 +800,15 @@ public void compose(Element e, OutputStream stream, OutputStyle style, String id
osw.flush();
}

private boolean isSuppressResourceType(Property property) {
StructureDefinition sd = property.getStructure();
if (sd != null && sd.hasExtension(ToolingExtensions.EXT_SUPPRESS_RESOURCE_TYPE)) {
return ToolingExtensions.readBoolExtension(sd, ToolingExtensions.EXT_SUPPRESS_RESOURCE_TYPE);
} else {
return false;
}
}

private void checkComposeComments(Element e) {
for (String s : e.getComments()) {
json.comment(s);
Expand All @@ -814,8 +824,9 @@ public void compose(Element e, JsonCreator json) throws Exception {
checkComposeComments(e);
json.beginObject();

// if (!isSuppressResourceType())
if (!isSuppressResourceType(e.getProperty())) {
prop("resourceType", e.getType(), linkResolver == null ? null : linkResolver.resolveProperty(e.getProperty()));
}
Set<String> done = new HashSet<String>();
for (Element child : e.getChildren()) {
compose(e.getName(), e, done, child);
Expand Down Expand Up @@ -931,7 +942,7 @@ else if (item.hasValue()) {
json.elide();
else if (item.hasChildren()) {
open(null,null);
if (item.getProperty().isResource()) {
if (item.getProperty().isResource() && !isSuppressResourceType(item.getProperty())) {
prop("resourceType", item.getType(), linkResolver == null ? null : linkResolver.resolveType(item.getType()));
}
if (linkResolver != null && item.getProperty().isReference()) {
Expand Down Expand Up @@ -987,7 +998,7 @@ private void compose(String path, Element element) throws IOException {
}
if (element.hasChildren()) {
open(name, linkResolver == null ? null : linkResolver.resolveProperty(element.getProperty()));
if (element.getProperty().isResource()) {
if (element.getProperty().isResource() && !isSuppressResourceType(element.getProperty())) {
prop("resourceType", element.getType(), linkResolver == null ? null : linkResolver.resolveType(element.getType()));
}
if (linkResolver != null && element.getProperty().isReference()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6572,8 +6572,13 @@ private boolean hasDataType(ElementDefinition ed) {
}

private ElementDefinitionMatch getElementDefinitionById(StructureDefinition sd, String ref) {
if (ref.startsWith(sd.getUrl()+"#")) {
ref = ref.replace(sd.getUrl()+"#", "#");
StructureDefinition sdt = sd;
while (sdt != null) {
if (ref.startsWith(sdt.getUrl()+"#")) {
ref = ref.replace(sdt.getUrl()+"#", "#");
break;
}
sdt = worker.fetchResource(StructureDefinition.class, sdt.getBaseDefinition());
}
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ref.equals("#"+ed.getId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private ResourceWrapper resolveReference(List<ResourceWrapper> entries, Resource

public static boolean allEntriesAreHistoryProvenance(List<ResourceWrapper> entries) throws UnsupportedEncodingException, FHIRException, IOException {
for (ResourceWrapper be : entries) {
if (!"Provenance".equals(be.child("resource").fhirType())) {
if (!be.has("child") || !"Provenance".equals(be.child("resource").fhirType())) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public class ToolingExtensions {
public static final String EXT_TYPE_PARAMETER = "http://hl7.org/fhir/tools/StructureDefinition/type-parameter";
public static final String EXT_ALTERNATE_CANONICAL = "http://hl7.org/fhir/StructureDefinition/alternate-canonical";
public static final String EXT_SUPPRESSED = "http://hl7.org/fhir/StructureDefinition/elementdefinition-suppress";
public static final String EXT_SUPPRESS_RESOURCE_TYPE = "http://hl7.org/fhir/tools/StructureDefinition/json-suppress-resourcetype";

// specific extension helpers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,6 @@ public class I18nConstants {
public static final String VALUESET_TOO_COSTLY = "VALUESET_TOO_COSTLY";
public static final String VALUESET_TOO_COSTLY_COUNT = "VALUESET_TOO_COSTLY_COUNT";
public static final String VALUESET_TOO_COSTLY_TIME = "VALUESET_TOO_COSTLY_TIME";
public static final String TX_SERVER_NOT_READY = "TX_SERVER_NOT_READY";
public static final String REQUEST_TOO_COSTLY_TIME = "REQUEST_TOO_COSTLY_TIME";
public static final String VALUESET_UNC_SYSTEM_WARNING = "VALUESET_UNC_SYSTEM_WARNING";
public static final String VALUESET_UNC_SYSTEM_WARNING_VER = "VALUESET_UNC_SYSTEM_WARNING_VER";
public static final String VALUESET_UNKNOWN_FILTER_PROPERTY = "VALUESET_UNKNOWN_FILTER_PROPERTY";
Expand Down Expand Up @@ -1123,6 +1121,7 @@ public class I18nConstants {
public static final String PRIMITIVE_TOO_SHORT = "PRIMITIVE_TOO_SHORT";
public static final String CANONICAL_MULTIPLE_VERSIONS_KNOWN = "CANONICAL_MULTIPLE_VERSIONS_KNOWN";
public static final String SD_PATH_NO_SLICING = "SD_PATH_NO_SLICING";
public static final String SD_PATH_SLICING_DEPRECATED_R5 = "SD_PATH_SLICING_DEPRECATED_R5";
public static final String SD_PATH_SLICING_DEPRECATED = "SD_PATH_SLICING_DEPRECATED";
public static final String SD_PATH_NOT_VALID = "SD_PATH_NOT_VALID";
public static final String SD_PATH_ERROR = "SD_PATH_ERROR";
Expand All @@ -1144,4 +1143,8 @@ public class I18nConstants {
public static final String VIEWDEFINITION_COMPLEX_TYPE = "VIEWDEFINITION_COMPLEX_TYPE";
public static final String CODESYSTEM_PROPERTY_ABSOLUTE_URI = "CODESYSTEM_PROPERTY_ABSOLUTE_URI";
public static final String CODESYSTEM_CS_SUPP_HIERARCHY_MEANING = "CODESYSTEM_CS_SUPP_HIERARCHY_MEANING";
public static final String HTA_SCT_DESC = "HTA_SCT_DESC";
public static final String HTA_SCT_MESSAGE = "HTA_SCT_MESSAGE";
public static final String HTA_LOINC_DESC = "HTA_LOINC_DESC";
public static final String HTA_LOINC_MESSAGE = "HTA_LOINC_MESSAGE";
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ public class RenderingI18nContext extends I18nBase {
public static final String CONC_MAP_FROM = "CONC_MAP_FROM";
public static final String CONC_MAP_GRP = "CONC_MAP_GRP";
public static final String CONC_MAP_NOT_SPEC = "CONC_MAP_NOT_SPEC";
public static final String CONC_MAP_NO_PROD_USE = "CONC_MAP_NO_PROD_USE";
public static final String CONC_MAP_PUB_ON = "CONC_MAP_PUB_ON";
public static final String CONC_MAP_REL = "CONC_MAP_REL";
public static final String CONC_MAP_SOURCE = "CONC_MAP_SOURCE";
public static final String CONC_MAP_SRC_DET = "CONC_MAP_SRC_DET";
Expand Down Expand Up @@ -300,7 +298,6 @@ public class RenderingI18nContext extends I18nBase {
public static final String EX_SCEN_TIME = "EX_SCEN_TIME";
public static final String EX_SCEN_UN = "EX_SCEN_UN";
public static final String EX_SCEN_UN_ACT = "EX_SCEN_UN_ACT";
public static final String EX_SCEN_UN_INST = "EX_SCEN_UN_INST";
public static final String GENERAL_VER_LOW = "GENERAL_VER_LOW";
public static final String IMP_GUIDE_URL = "IMP_GUIDE_URL";
public static final String LIB_REND_ART = "LIB_REND_ART";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public class CommonPackages {
public static final String VER_XVER = "0.1.0";

public static final String ID_PUBPACK = "hl7.fhir.pubpack";
public static final String VER_PUBPACK = "0.1.8";
public static final String VER_PUBPACK = "0.1.9";

}
10 changes: 8 additions & 2 deletions org.hl7.fhir.utilities/src/main/resources/Messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ NO_VALID_DISPLAY_FOUND_other = No valid Display Names found for {1}#{2} in the l
NO_VALID_DISPLAY_FOUND_LANG_SOME_one = ''{5}'' is the default display; no valid Display Names found for {1}#{2} in the language {4}
NO_VALID_DISPLAY_FOUND_LANG_SOME_other = ''{5}'' is the default display; no valid Display Names found for {1}#{2} in the language {4}
NO_VALID_DISPLAY_FOUND_LANG_NONE_one = ''{5}'' is the default display; the code system {1} has no Display Names for the language {4}
NO_VALID_DISPLAY_FOUND_LANG_NINE_other = ''{5}'' is the default display; the code system {1} has no Display Names found for the language {4}
NO_VALID_DISPLAY_FOUND_LANG_NONE_other = ''{5}'' is the default display; the code system {1} has no Display Names found for the language {4}
Named_items_are_out_of_order_in_the_slice = Named items are out of order in the slice
No_ExpansionProfile_provided = No ExpansionProfile provided
No_Expansion_Parameters_provided = No Expansion Parameters provided
Expand Down Expand Up @@ -1153,7 +1153,8 @@ CODESYSTEM_CS_COMPLETE_AND_EMPTY = When a CodeSystem has content = ''complete'',
VALIDATION_VAL_VERSION_NOHASH = Version ''{0}'' contains a ''#'', which as this character is used in some URLs to separate the version and the fragment id. When version does include '#', systems will not be able to parse the URL
PRIMITIVE_TOO_SHORT = Value ''{0}'' is shorter than permitted minimum length of {1}
CANONICAL_MULTIPLE_VERSIONS_KNOWN = The version {2} for the {0} {1} is not known. These versions are known: {3}
SD_PATH_SLICING_DEPRECATED = The discriminator type ''{0}'' has been deprecated. Use type=value with a pattern[x] instead
SD_PATH_SLICING_DEPRECATED = The discriminator type ''{0}'' is been deprecated in R5+. For future compatibility, you could consider using type=value with a pattern[x] instead (if this is not an inherited slicing)
SD_PATH_SLICING_DEPRECATED_R5 = The discriminator type ''{0}'' has been deprecated. Use type=value with a pattern[x] instead (if this is not an inherited slicing)
SD_PATH_NOT_VALID = The discriminator path ''{0}'' does not appear to be valid for the element that is being sliced ''{1}''
SD_PATH_ERROR = The discriminator path ''{0}'' does not appear to be valid for the element that is being sliced ''{1}'': {2}
VIEWDEFINITION_SHOULD_HAVE_NAME = No name provided. A name is required in many contexts where a ViewDefinition is used
Expand All @@ -1174,3 +1175,8 @@ VIEWDEFINITION_UNABLE_TO_TYPE = Unable to determine a type (found ''{0}''){1}
VIEWDEFINITION_COMPLEX_TYPE = Column from path ''{0}'' is a complex type (''{1}''){2}. This is not supported in some Runners
CODESYSTEM_PROPERTY_ABSOLUTE_URI = A property URI must be an absolute URI, but ''{0}'' is not
CODESYSTEM_CS_SUPP_HIERARCHY_MEANING = The supplement declares a heirarchyMeaning of ''{0}'' that doesn''t match that in the base code system ''{1}''
HTA_SCT_DESC = SNOMED Clinical Terms&reg; (SNOMED CT&reg;)
HTA_SCT_MESSAGE = This material contains content that is copyright of SNOMED International. Implementers of these specifications must have the appropriate SNOMED CT Affiliate license - for more information contact <a href=\"https://www.snomed.org/get-snomed\">https://www.snomed.org/get-snomed</a> or <a href=\"mailto:[email protected]\">[email protected]</a>.
HTA_LOINC_DESC = LOINC
HTA_LOINC_MESSAGE = This material contains content from <a href=\"http://loinc.org\">LOINC</a>. LOINC is copyright &copy; 1995-2020, Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee and is available at no cost under the <a href=\"http://loinc.org/license\">license</a>. LOINC&reg; is a registered United States trademark of Regenstrief Institute, Inc.
SD_PATH_NO_SLICING = Slicing is not allowed at ''{0}''
Loading

0 comments on commit aa22897

Please sign in to comment.