Stream: conformance
Topic: differences in Validator and IGPublisher
Oliver Egger (Nov 24 2021 at 22:50):
we experienced a very strange issue. we have a FHIR document profile which requires that the composition.subject is a patient and the patient needs to have one identifier. We have an incorrect example without a Patient identifier and the IGPubliser correctly shows the failing in the reasoning (what a cool feature, btw):
This element does not match any known slicedefined_in_the_profilehttp://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-document-medicationcard
Bundle.entry[0]: discriminator = true and resource.conformsTo('http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-composition-medicationcard')
,
Bundle.entry[0]: Profile http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-composition-medicationcard does not match for Bundle because of the following profile issues:
Bundle.entry[0].resource.subject: Unable to find a match for profile Patient/65788 among choices: http://fhir.ch/ig/ch-core/StructureDefinition/ch-core-patient-epr
,
Bundle.entry[0].resource.subject:
Bundle.entry[1].resource.ofType(Patient): Patient.identifier: minimum required = 1, but only found 0 (from http://fhir.ch/ig/ch-core/StructureDefinition/ch-core-patient-epr)
however when we validate the same document with the FHIR validator we do not get an error:
java -jar validator_cli.jar -version 4.0.1 -ig ch.fhir.ig.ch-emed#1.0.0 -profile http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-document-medicationcard http://build.fhir.org/ig/ehealthsuisse/ch-emed/branches/validation/Bundle-medicationcard.json
...
Success: 0 errors, 9 warnings, 6 notes
Information @ Bundle.entry[1] (line 124, col6): This element does not match any known slice defined in the profile http://fhir.ch/ig/ch-emed/StructureDefinition/ch-emed-document-medicationcard
trying to debug it, there is a comment in InstanceValidator that the conformsTo breaks the stack and you end up there, but the code is not entered because hostContext is null
if i adjust the hostContext that is provided as a bundle I get back the validation error, but I'am a bit puzzled why the InstanceValidator is needing an adjustment, but the same is working for the IG Publisher.
@Grahame Grieve @Mark Iantorno do you have any ideas?
Grahame Grieve (Nov 29 2021 at 01:42):
well, I'll have to debug
Grahame Grieve (Nov 29 2021 at 04:28):
can you make a validator test case that shows the problem as a PR to https://github.com/FHIR/fhir-test-cases/pulls ?
Oliver Egger (Nov 29 2021 at 07:10):
it on my todo list :smile: will let you know as soon as i have done it
Oliver Egger (Nov 29 2021 at 22:10):
@Grahame Grieve
- IG where error is correctly raised is here
- added the example and structuredefinitions to this validation testcase PR, the error is not raised (which should be raised) within the validation tests
- Verified with the PR that the error is raised
let me know if you need any additional info to debug.
Grahame Grieve (Nov 30 2021 at 01:51):
I don't really understand the proposed fix - the appContext is not interchangeable with the root resource
Grahame Grieve (Nov 30 2021 at 01:52):
and the app context is set outside the InstanceValidator and passed around so it can be used in callbacks so the application can keep it's context together
Grahame Grieve (Nov 30 2021 at 02:55):
on further investigation.. the IG publisher sets the appContext to the bundle element for it's own convenience. Other applications do something else. So that change you're made works with the IG publisher, but would break other applications that host the validator
Grahame Grieve (Nov 30 2021 at 02:56):
so that code shouldn't be using and looking at the app context (it's broken in the other cases already, casting appContext to Element). It should be using the rootResource, and the rootResource should be set. two fixes...
Grahame Grieve (Nov 30 2021 at 02:57):
I'll close your PR and make my own
Grahame Grieve (Nov 30 2021 at 02:57):
but I'll keep your test case - thanks
Oliver Egger (Nov 30 2021 at 12:54):
thanks a lot for your investigation and explanations and looking forward for you PR!
Last updated: Apr 12 2022 at 19:14 UTC