Skip to content

$cpg next step Operation

Jonathan Percival edited this page Mar 1, 2022 · 4 revisions

$cpg-next-step

The focus of the cpg-next-step operation is to provide clinical decision support using the Questionnaire and QuestionnaireResponse FHIR resources. The operation is triggered by POSTing a QuestionnaireResponse resource, which references the Questionnaire that holds the necessary questions to be answered by the user, to the operation with a status of 'in-progress'.

Usage

POST: {fhirServerBase}/QuestionnaireResponse/$cpg-next-step

BODY: { "resourceType": "QuestionnaireResponse", "status": "in-progress", "questionnaire": "Questionnaire/<questionnaireId>*", ... }

*The id of the Questionnaire that you would like to complete. (A Questionnaire Resource with this id must exist on the server)

Workflow

To initiate the workflow for a particular Questionnaire, you will post a QuestionnaireResponse resource embedded in Parameters resource in the body of the $cpg-next-step Operation request.

For example:

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "response",
      "resource": {
        "resourceType": "QuestionnaireResponse",
        "id": "trigger-has-anaemia",
        "questionnaire": "Questionnaire/anc-recommendation-a2",
        "status": "in-progress",
        "subject": {
          "reference": "Patient/mom"
        },
        "encounter": {
          "reference": "Encounter/mom-first-contact"
        }
      }
    }
  ]
}

This initial QuestionnaireResponse has the following constraints:

  • The Subject reference must contain a reference to a Patient resource that exists on the server.
  • The Encounter reference must contain a reference to an Encounter resource that exists on the server.
  • The Status code value must be in-progress.

In the above example, the Questionnaire/anc-recommendation-a2 Questionnaire is being requested in context of the 'Patient/mom' Patient and the Encounter/mom-first-contact encounter. These resources must exist on the server. The response to this request will be a Questionnaire with a list of questions that must be answered by the user in order to provide Clinical Decision Support (CDS).

An example Questionnaire resource response from the initial request:

{
  "resourceType": "Questionnaire",
  "id": "anc-recommendation-a2",
  "title": "Has Anaemia Questionnaire",
  "status": "active",
  "item": [
    {
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType",
          "valueString": "Observation"
        }
      ],
      "linkId": "gestational-age-method",
      "text": "What method was used to determine gestational age?",
      "type": "choice",
      "required": true,
      "answerOption": [
        {
          "valueCoding": {
            "system": "http://fhir.org/guides/who/anc-cds/CodeSystem/anc-codes",
            "code": "UseLMP"
          }
        },
        {
          "valueCoding": {
            "system": "http://fhir.org/guides/who/anc-cds/CodeSystem/anc-codes",
            "code": "UseUltrasound"
          }
        },
        {
          "valueCoding": {
            "system": "http://fhir.org/guides/who/anc-cds/CodeSystem/anc-codes",
            "code": "UseSFH"
          }
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType",
          "valueString": "Observation"
        }
      ],
      "linkId": "lmp-date",
      "text": "What was the date of the Patient's last menstrual period?",
      "type": "dateTime",
      "required": true
    },
    {
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType",
          "valueString": "Observation"
        }
      ],
      "linkId": "hb-value",
      "text": "What is the Patient's Haemoglobin measured from haemoglobinometer (g/dl)?",
      "type": "quantity",
      "required": true
    }
  ]
}

Once the questions from the Questionnaire have been answered, they should be returned in the form of a QuestionnaireResponse with a Status code of complete.

For example:

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "response",
      "resource": {
        "resourceType": "QuestionnaireResponse",
        "id": "anc-recommendation-a2-answered",
        "questionnaire": "Questionnaire/anc-recommendation-a2",
        "status": "completed",
        "subject": {
          "reference": "Patient/mom"
        },
        "encounter": {
          "reference": "Encounter/mom-first-contact"
        },
        "item": [
          {
            "linkId": "gestational-age-method",
            "answer": [
              {
                "valueCoding": {
                  "system": "http://fhir.org/guides/who/anc-cds/CodeSystem/anc-codes",
                  "code": "UseLMP"
                }
              }
            ]
          },
          {
            "linkId": "lmp-date",
            "answer": [
              {
                "valueDateTime": "2019-03-01"
              }
            ]
          },
          {
            "linkId": "hb-value",
            "answer": [
              {
                "valueQuantity": {
                  "value": "7.2",
                  "system": "http://unitsofmeasure.org",
                  "unit": "g/dL"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}

When the server receives this completed QuestionnaireResponse, it will create the requisite resources for the answers provided and load them into the server. Additionally, the $apply Operation will be called on the PlanDefinition that is associated with the Questionnaire - accomplished by assigning the same id to both the Questionnaire and its corresponding PlanDefinition.

Once the Questionnaire is completed and the PlanDefinition applied, the response will be a CarePlan resource like the following:

{
  "resourceType": "CarePlan",
  "instantiatesCanonical": [
    "anc-recommendation-a2"
  ],
  "status": "draft",
  "subject": {
    "reference": "Patient/mom"
  },
  "encounter": {
    "reference": "Encounter/mom-first-contact"
  }
}