Da Vinci - Documentation Templates and Rules 0.2.0 - STU Ballot

This page is part of the Documentation Templates and Rules (v0.2.0: STU 1 Ballot 2) based on FHIR R4. The current version which supercedes this version is 1.0.0. For a full list of available versions, see the Directory of published versions

Questionnaire Evaluation

Comparing CQL Execution Results to Questionnaire

While Structured Data Capture provides methods for Questionnaire (form) population, this implementation guide relies on the approach that has been created within Clinical Reasoning Module of the FHIR specification. With FHIR R4, the Documentation Template concept is a good fit for the use case being addressed by this implementation guide.

As an example, given the following Clinical Quality Language (CQL) fragment:

define "Age": AgeInYears()

This will create a CQL expression named Age. The expression can then be used to populate an item within a Questionnaire. The following JSON fragment represents the portion of the Questionnaire that can be populated from the CQL:

{
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/cqf-expression",
      "valueExpression": {
        "language": "text/cql",
        "expression": "Age"
      }
    }
  ],
  "linkId": "age",
  "code": [
    {
      "system": "http://loinc.org",
      "code": "30525-0"
    }
  ],
  "text": "What is the patient's age?",
  "type": "quantity"
}

Using the cqf-expresion extension, the item SHALL refer to the named expression in the CQL rules that contains the desired information.

Application with FHIR STU3

The same conceptual approach is shared with FHIR R4, though the extensions change slightly between versions. Instead of using the cqf-expression extension, the cqif-calculatedValue extension should be used.

Generation of QuestionnaireResponse

The Documentation Templates and Rules (DTR) application is responsible for iterating through all of the Questionnaire.item elements and checking the cqf-expression when using FHIR R4 or cqif-calculatedValue when using FHIR STU3, for values to populate a QuestionnaireResponse. The DTR application SHALL create a QuestionnaireResponse resource. For each Questionnaire.item, there SHALL be a corresponding QuestionnaireResponse.item. When the cqf-expression or cqif-calculatedValue is not null, the value of the expression SHALL be used as the answer in the QuestionnaireResponse. The following JSON fragment shows an example representation of item in the QuestionnaireResponse based on the example above.

{
  "linkId": "age",
  "answer": {
    "valueQuantity": {"value": 65, "unit": "a", "system": "http://unitsofmeasure.org"}
  }
}

For each Questionnaire.item with a null value for the cqf-expression or cqif-calculatedValue, user input will be required to obtain the desired information, which is described in Section 4.4.4.