Stream: hapi
Topic: best practice for validation chain
Patrick Werner (Apr 26 2020 at 15:36):
As hapi 5.0.0 has some changes in the validation modules i'd like to ask for the best practice of creating a validation chain.
- SnapshotGeneratingValidationSupport know only takes the context, so no more wrapping - just putting it into the chain would be sufficient. Right?
- 'the validator will try each module in the chain until one of them returns a non-null response.' So the order of the Modules is important.
In the recipe: https://hapifhir.io/hapi-fhir/docs/validation/validation_support_modules.html#recipe-supplying-custom-definitions default support is added before the PrePopulatedValidationSupport. To me this would mean that all validations are done by the DefaultProfileValidationSupport, as it supports all FHIR resource types, and PrePopulatedValidationSupport will never be called.
Patrick Werner (Apr 26 2020 at 15:42):
What is the proper order if i want to combine:
- DefaultProfileValidationSupport
- PrePopulatedValidationSupport
- InMemoryTerminologyServerValidationSupport <- needed because DefaultProfileValidationSupport doesn't validate Terminology an more
- SnapshotGeneratingValidationSupport
- CommonCodeSystemsTerminologyService
I then would wrap this whole chain in a CachingValidationSupport.
Until now i was under the assumption that each validator is called after another and is independent from the others. But seeing InMemoryTerminologyServerValidationSupport separated from DefaultProfileValidationSupport leads me to the idea that all modules are sharing all Conformance Resources?
Patrick Werner (May 05 2020 at 14:18):
push
Grahame Grieve (May 05 2020 at 20:01):
@Mark Iantorno
Mark Iantorno (May 06 2020 at 13:50):
@Patrick Werner can we have a quick call either tomorrow or Friday just so I can clarify this with you?
Patrick Werner (May 06 2020 at 13:52):
Sure. Friday after 12:00 CET works best for me.
Mark Iantorno (May 06 2020 at 13:56):
What email can I send the invite to?
Patrick Werner (May 06 2020 at 13:59):
Patrick Werner (May 06 2020 at 13:59):
thank you!
Mark Iantorno (May 06 2020 at 14:01):
Sent.
Morten Ernebjerg (May 06 2020 at 19:35):
Could you perchance capture a summery if your discussion somewhere? - I would be interested :slight_smile:
James Agnew (May 07 2020 at 22:12):
I'm gonna take a crack at these...
SnapshotGeneratingValidationSupport know only takes the context, so no more wrapping - just putting it into the chain would be sufficient. Right? 'the validator will try each module in the chain until one of them returns a non-null response.' So the order of the Modules is important.
Correct. SnapshotGen gets a back-reference to the whole chain when it's called, so it can look for any other resources it needs. It will use the whole chain to find anything.
In the recipe: https://hapifhir.io/hapi-fhir/docs/validation/validation_support_modules.html#recipe-supplying-custom-definitions default support is added before the PrePopulatedValidationSupport. To me this would mean that all validations are done by the DefaultProfileValidationSupport, as it supports all FHIR resource types, and PrePopulatedValidationSupport will never be called.
DefaultProfileValidationSupport gets tried first as you suggest, but it can only supply the base definitions so I wouldn't expect that to be a bad thing. I would expect people to use PrePopulatedValidationSupport to supply profiles and definitions that build on the base definitions, as opposed to replacing them.
James Agnew (May 07 2020 at 22:13):
(Sorry, not trying to override your call, just getting some info down)
Patrick Werner (May 08 2020 at 07:43):
Morten Ernebjerg said:
Could you perchance capture a summery if your discussion somewhere? - I would be interested :slight_smile:
sure! Will try to extend/improve the documentation about it.
Last updated: Apr 12 2022 at 19:14 UTC