Issue 623 (#636)

* wip

* upping pom.xml test-case dep
This commit is contained in:
Mark Iantorno 2021-10-29 16:26:00 -04:00 committed by GitHub
parent 6f32a85d66
commit 69cee8b485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 20 deletions

View File

@ -0,0 +1 @@
* https://github.com/hapifhir/org.hl7.fhir.core/issues/623

View File

@ -5374,57 +5374,76 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
// this is a hack work around for past publication of wrong FHIRPath expressions
// R4
// waiting for 4.0.2
//TODO is this expression below correct? @grahamegrieve
if ("probability is decimal implies (probability as decimal) <= 100".equals(expr)) {
return "probablility.empty() or ((probability is decimal) implies ((probability as decimal) <= 100))";
}
if ("enableWhen.count() > 2 implies enableBehavior.exists()".equals(expr)) {
return "enableWhen.count() >= 2 implies enableBehavior.exists()";
}
if ("txt-2".equals(key)) {
return "htmlChecks2()";
}
// handled in 4.0.1
if ("(component.empty() and hasMember.empty()) implies (dataAbsentReason or value)".equals(expr))
if ("(component.empty() and hasMember.empty()) implies (dataAbsentReason or value)".equals(expr)) {
return "(component.empty() and hasMember.empty()) implies (dataAbsentReason.exists() or value.exists())";
if ("isModifier implies isModifierReason.exists()".equals(expr))
}
if ("isModifier implies isModifierReason.exists()".equals(expr)) {
return "(isModifier.exists() and isModifier) implies isModifierReason.exists()";
if ("(%resource.kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().not() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\\\\..*','')&'.')))".equals(expr))
}
if ("(%resource.kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().not() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\\\\..*','')&'.')))".equals(expr)) {
return "(%resource.kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().empty() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\\\\..*','')&'.')))";
if ("differential.element.all(id) and differential.element.id.trace('ids').isDistinct()".equals(expr))
}
if ("differential.element.all(id) and differential.element.id.trace('ids').isDistinct()".equals(expr)) {
return "differential.element.all(id.exists()) and differential.element.id.trace('ids').isDistinct()";
if ("snapshot.element.all(id) and snapshot.element.id.trace('ids').isDistinct()".equals(expr))
}
if ("snapshot.element.all(id) and snapshot.element.id.trace('ids').isDistinct()".equals(expr)) {
return "snapshot.element.all(id.exists()) and snapshot.element.id.trace('ids').isDistinct()";
}
// R3
if ("(code or value.empty()) and (system.empty() or system = 'urn:iso:std:iso:4217')".equals(expr))
if ("(code or value.empty()) and (system.empty() or system = 'urn:iso:std:iso:4217')".equals(expr)) {
return "(code.exists() or value.empty()) and (system.empty() or system = 'urn:iso:std:iso:4217')";
if ("value.empty() or code!=component.code".equals(expr))
}
if ("value.empty() or code!=component.code".equals(expr)) {
return "value.empty() or (code in component.code).not()";
if ("(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)".equals(expr))
}
if ("(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)".equals(expr)) {
return "(code.exists() or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)";
if ("element.all(definition and min and max)".equals(expr))
}
if ("element.all(definition and min and max)".equals(expr)) {
return "element.all(definition.exists() and min.exists() and max.exists())";
if ("telecom or endpoint".equals(expr))
}
if ("telecom or endpoint".equals(expr)) {
return "telecom.exists() or endpoint.exists()";
if ("(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)".equals(expr))
}
if ("(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)".equals(expr)) {
return "(code.exists() or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)";
if ("searchType implies type = 'string'".equals(expr))
}
if ("searchType implies type = 'string'".equals(expr)) {
return "searchType.exists() implies type = 'string'";
if ("abatement.empty() or (abatement as boolean).not() or clinicalStatus='resolved' or clinicalStatus='remission' or clinicalStatus='inactive'".equals(expr))
}
if ("abatement.empty() or (abatement as boolean).not() or clinicalStatus='resolved' or clinicalStatus='remission' or clinicalStatus='inactive'".equals(expr)) {
return "abatement.empty() or (abatement is boolean).not() or (abatement as boolean).not() or (clinicalStatus = 'resolved') or (clinicalStatus = 'remission') or (clinicalStatus = 'inactive')";
if ("(component.empty() and related.empty()) implies (dataAbsentReason or value)".equals(expr))
}
if ("(component.empty() and related.empty()) implies (dataAbsentReason or value)".equals(expr)) {
return "(component.empty() and related.empty()) implies (dataAbsentReason.exists() or value.exists())";
}
if ("reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))".equals(expr)) {
return "(reference = '#') or reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))";
}
if ("reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))".equals(expr)) {
return "(reference = '#') or reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))";
}
if ("".equals(expr))
if ("probability is decimal implies probability.as(decimal) <= 100".equals(expr)) {
if (key.equals("ras-2")) {
return "probability.empty() or (probability is decimal implies probability.as(decimal) <= 100)";
}
}
if ("".equals(expr)) {
return "";
}
return expr;
}

View File

@ -100,7 +100,6 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
List<Object[]> objects = new ArrayList<Object[]>(examples.size());
for (String id : names) {
//if (id.equals("bundle-documentation-miss-last-updated"))
objects.add(new Object[]{id, examples.get(id)});
}
return objects;

View File

@ -19,7 +19,7 @@
<properties>
<hapi_fhir_version>5.1.0</hapi_fhir_version>
<validator_test_case_version>1.1.70</validator_test_case_version>
<validator_test_case_version>1.1.71-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version>
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M4</maven_surefire_version>