Calculating Situation Quality and Usage Quality
When posting Measurements the Citizen application is required to establish Situation Quality and Usage Quality as context to Observations, QuestionnaireResponses and Media resources.
The eHealth Infrastructure exposes Library resource to help calculate the Quality attributes.
Calling an instance of a Library resource is done using the $evaluate operation.
Qualities are based on responses on Questionnaires designed specifically for this purpose.
Code example returning a GuidanceResponse
EHealthQuestionnaireResponse createdQuestionnaireResponse = QuestionnaireResponseEntityFactory.createQuestionnaireResponse(questionnaireResponse -> { questionnaireResponse.setId(ReferenceFactory.createReference(EHealthQuestionnaireResponse.class).getReference()); questionnaireResponse.setSubject(new Reference(patient)); questionnaireResponse.setQuestionnaire(new Reference(questionnaire)); questionnaireResponse.addItem().setLinkId("question1").addAnswer().setValue(new BooleanType(true)); }); Parameters inParams = new Parameters(); Parameters questionnaireResponseParameter = new Parameters(); questionnaireResponseParameter.addParameter().setName("questionnaireResponse").setResource(createdQuestionnaireResponse); inParams.addParameter().setName("parameters").setResource(questionnaireResponseParameter); // Act EHealthGuidanceResponse guidanceResponse = genericClient .operation() .onInstance(library.getIdElement()) .named("$evaluate") .withParameters(inParams) .returnResourceType(EHealthGuidanceResponse.class) .execute();