Merge pull request #472 from hapifhir/gg-202103-r2b-fixes

Gg 202103 r2b fixes
This commit is contained in:
Grahame Grieve 2021-04-08 12:57:53 +10:00 committed by GitHub
commit 94305abf03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 4 deletions

View File

@ -0,0 +1,3 @@
* fix R2B for checking resource IDs
* Properly check code validity when an expansion is provided, but the code system is unknown
* fix problem with R2B StructureDefinition transform

View File

@ -73,6 +73,19 @@
<optional>true</optional>
</dependency>
<!-- HTTP Client -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
<optional>true</optional>
</dependency>
<!-- JUnit Jupiter -->
<dependency>
<groupId>org.junit.jupiter</groupId>

View File

@ -177,8 +177,10 @@ public class StructureDefinition14_50 {
if (src.hasDifferential()) {
if (src.hasDifferential())
tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
if (!tgt.getDifferential().getElementFirstRep().getPath().contains(".")) {
tgt.getDifferential().getElementFirstRep().getType().clear();
}
}
if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
for (ElementDefinition ed : tgt.getSnapshot().getElement()) {
if (!ed.hasBase()) {

View File

@ -149,9 +149,13 @@ public class ValueSetCheckerSimple implements ValueSetChecker {
if (cs == null) {
warningMessage = "Unable to resolve system "+system;
if (!inExpansion) {
if (valueset.hasExpansion()) {
return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.CODESYSTEM_CS_UNK_EXPANSION, valueset.getUrl(), code.getCode().toString(), code.getSystem()));
} else {
throw new FHIRException(warningMessage);
}
}
}
if (cs != null && cs.hasSupplements()) {
return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.CODESYSTEM_CS_NO_SUPPLEMENT, cs.getUrl()));
}

View File

@ -53,6 +53,7 @@ public class I18nConstants {
public static final String CODESYSTEM_CS_NO_SUPPLEMENT = "CODESYSTEM_CS_NO_SUPPLEMENT";
public static final String CODESYSTEM_CS_SUPP_CANT_CHECK = "CODESYSTEM_CS_SUPP_CANT_CHECK";
public static final String CODESYSTEM_CS_SUPP_INVALID_CODE = "CODESYSTEM_CS_SUPP_INVALID_CODE";
public static final String CODESYSTEM_CS_UNK_EXPANSION = "CODESYSTEM_CS_UNK_EXPANSION";
public static final String CODE_FOUND_IN_EXPANSION_HOWEVER_ = "Code_found_in_expansion_however_";
public static final String CODING_HAS_NO_SYSTEM__CANNOT_VALIDATE = "Coding_has_no_system__cannot_validate";
public static final String CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_ = "Contained_resource_does_not_appear_to_be_a_FHIR_resource_unknown_name_";

View File

@ -641,3 +641,4 @@ CODESYSTEM_CS_SUPP_CANT_CHECK = CodeSystem {0} cannot be found, so can't check i
CODESYSTEM_CS_SUPP_INVALID_CODE = The code ''{1}'' is not declared in the base CodeSystem {0} so is not valid in the supplement
SD_VALUE_TYPE_IILEGAL = The element {0} has a {1} of type {2}, which is not in the list of allowed types ({3})
SD_NO_TYPES_OR_CONTENTREF = The element {0} has no assigned types, and no content reference
CODESYSTEM_CS_UNK_EXPANSION = The code provided ({2}) is not in the value set {0}, and a code is required from this value set. The system {1} is unknown.

View File

@ -2002,7 +2002,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
if (type.equals(ID)) {
// work around an old issue with ElementDefinition.id
if (!context.getPath().equals("ElementDefinition.id") && !VersionUtilities.versionsCompatible("1.4", this.context.getVersion())) {
if (!context.getPath().equals("ElementDefinition.id") || VersionUtilities.versionsCompatible("1.4", this.context.getVersion())) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.isValidId(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_ID_VALID, e.primitiveValue());
}
}
@ -4330,7 +4330,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
if (ei.definition != null) {
if (debug) {
System.out.println(Utilities.padLeft("", ' ', stack.depth())+ "Check "+ei.getPath()+" against defn "+ei.definition.getId());
System.out.println(Utilities.padLeft("", ' ', stack.depth())+ "Check "+ei.getPath()+" against defn "+ei.definition.getId()+" from "+profile.getUrl());
}
checkChildByDefinition(hostContext, errors, profile, definition, resource, element, actualType, stack, inCodeableConcept, checkDisplayInContext, ei, extensionUrl, ei.definition, false);
}