Stream: hapi
Topic: Language-dependent validation
Morten Ernebjerg (Dec 15 2020 at 10:42):
Hi HAPI people :wave: We are writing a validation module with HAPI FHIR 5.2 for use during data ingestion. In particular, we want to validate QuestionnaireResponse instances against the corresponding Questionnaires. Each Questionnaire could potentially exist in different versions. In addition, since we are working in a cross-country setting, each version of a given questionnaire exists in multiple languages. We now want to match the incoming QuestionnaireResponses to the right Questionnaire based on all this, i.e.
- Questionnaire canonical (
QuestionnaireResponse.questionnaire
/Questionnaire.url
) - Questionnaire version (
QuestionnaireResponse.questionnaire
as versioned canonical URL/Questionnaire.version
) - Language l (
QuestionnaireResponse.language
/Questionnaire.language
)
We would like to simply load all the different variations of the the Questionnaires and then automatically validate against the right one. For URL and version, we got it working by writing our own implementation of IValidationSupport. It overrides fetchResource()
to return the questionnaires that matches the (possibly versioned) canonical passed, e.g. if we get the URL http://example.com/myQ|1.2.3
, we return version 1.2.3 of the questionnaire with canonical http://example.com/myQ
.
However, we cannot see how to return the right Questionnaire based on language. The IValidationSupport#fetchResource
method takes only a URI as parameter, which (AFAIK) does not leave any room for passing the required language. Can it be dynamically set (at runtime) somewhere else? I see that the embedded ConceptDesignation class has a getLanguage()
method, but I'm not sure if/how that is set & whether it makes the core validation code do the right thing.
Jens Villadsen (Dec 15 2020 at 10:50):
@Erik Nielsen
Last updated: Apr 12 2022 at 19:14 UTC