FHIRPath conformsTo Validation of Warnings/Error handling pull request

XMLWordPrintableJSON

    • Type: Change Request
    • Resolution: Persuasive
    • Priority: Medium
    • FHIRPath (FHIR)
    • STU3
    • FHIR Infrastructure
    • fluentpath
    • Hide

      Agreed, correct validation tooling as suggested.

      Show
      Agreed, correct validation tooling as suggested.
    • Bryn Rhodes/Andy Stechishin: 2-0-0
    • Clarification
    • Non-substantive

      If a resource is evaluated with the FHIRPath conforms function against a profile, the function is returning false when there are warnings.

      FHIRPath specifies for the conformTo function that:

      _Returns true if the single input element conforms to the profile specified by the structure argument, and false otherwise. _

      In the conformance section it is stated about warning constraints:

      _ *Warning *Report this as a warning that there may be a problem with the resource, but it is considered valid and can be processed normally_

      From the specification I would assume that a Warning Validation Message would still return true for the conformsTo function.

      The current Validator/Java Reference Implementation handles the error like this:

      boolean ok = true;
      for (ValidationMessage v : valerrors)
      ok = ok && v.getLevel().isError();
      return ok;

      As soon as there is a Validation Message and it is not an error, false is returned, i think it should be the inverse:

      boolean ok = true;
      for (ValidationMessage v : valerrors)
      ok = ok && !v.getLevel().isError();
      return ok;

      I will create a pull request which includes

      fix that tests can run: org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java

      change to above mentioned behavior: org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java

      extendenting TestSuite: org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java

      modified: org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json

      patient with an error: org.hl7.fhir.validation/src/test/resources/validation-examples/patient-bad-gender.xml

      a profile with a constraint that contains the conformTo function: org.hl7.fhir.validation/src/test/resources/validation-examples/patient-conform-profile.xml

      patient with just a warning: org.hl7.fhir.validation/src/test/resources/validation-examples/patient-warning-maritalstatus.xml

      There are multiple occurences of this evaluation pattern for the conformsTo function in the code, if the pull request is accepted, they would need to be changed to probably.

            Assignee:
            Unassigned
            Reporter:
            Oliver Egger
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: