Case 1a - Alex - no PHQ-9

Alex is a 46 year old female patient who has a diagnosis of major depression with no PHQ-9. The source system has a weight and height value for Alex.

The source system would send the following FHIR resource to RAPIDS:

{
  "hookInstance": "d1577c69-dfbe-44ad-ba6d-3e05e953b2ea",
  "fhirServer": "https://example.org/fhir",
  "hook": "patient-view",
  "context": {
    "patientId": "Patient/urn:emr:telus:chr:HSCN3212:2462",
    "userId": "Practitioner/urn:emr:telus:chr:HSCN3212:practitioner:22"
  },
  "prefetch": {
    "patient": {
      "resource": {
        "resourceType": "Bundle",
        "type": "transaction",
        "entry": [
          {
            "request": {
              "method": "POST",
              "url": "Patient"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Patient/urn:emr:telus:chr:HSCN3212:2462",
            "resource": {
              "resourceType": "Patient",
              "id": "urn:emr:telus:chr:HSCN3212:2462",
              "meta": {
                "lastUpdated": "2022-04-10T03:48:33.708+00:00"
              },
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Patient 2462 Female</div>"
              },
              "identifier": [
                {
                  "system": "urn:emr:telus:chr:HSCN3212",
                  "value": "2462"
                }
              ],
              "active": true,
              "gender": "female",
              "deceasedBoolean": "false",
              "managingOrganization": [
                {
                  "reference": "RPSOrganization/urn:emr:telus:chr:HSCN3212"
                }
              ]
            }
          },
          
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11222",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11222",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Body weight Measured at 185lbs on 2022-03-28 for patient 2462</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "vital-signs",
                      "display": "Vital Signs"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "3141-9",
                    "display": "Body weight Measured"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueQuantity": {
                "value": 83.9,
                "unit": "Kg"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11223",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11223",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Body Height Measured at 170.2cm on 2022-03-28 for patient 2462</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "vital-signs",
                      "display": "Vital Signs"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "8302-2",
                    "display": "Body Height Measured"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueQuantity": {
                "value": 170.2,
                "unit": "cm"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11224",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11224",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Patient 2462 is 46 years old on 2022-03-28</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "social-history",
                      "display": "Social History"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "21612-7",
                    "display": "Age Reported"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueInteger": 46
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Condition"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:condition:123",
            "resource": {
              "resourceType": "Condition",
              "id": "urn:emr:telus:chr:HSCN3212:2462:condition:123",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Major Depressive Disorder</div>"
              },
              "clinicalStatus": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                    "code": "active"
                  }
                ]
              },
              "verificationStatus": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
                    "code": "confirmed"
                  }
                ]
              },
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                      "code": "problem-list-item",
                      "display": "Problem List Item"
                    },
                    {
                      "system": "http://snomed.info/sct",
                      "code": "439401001",
                      "display": "Diagnosis"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/sid/icd-9-cm",
                    "code": "296.22",
                    "display": "Major depressive disorder, single episode"
                  }
                ],
                "text": "Major depressive disorder, single episode"
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              }
            }
          }
        ]
      }
    }
  }
}

In this case RAPIDS would respond, requesting a PHQ-9 and would send the Questionnaire resource to the source system:

{
  "cards": [
    {
      "uuid": "781e08d7-5598-47b7-b1a9-72c19875682e",
      "summary": "Please Complete a PHQ-9",
      "source": {
        "label": "TELUS RAPIDS CDS",
        "url": "http://telus.rapids.com/"
      },
      "indicator": "info",
      "suggestions": [
        {
          "label": "None of the supporting scales for diagnosis MDD have been provided. Please provide the following scales: PHQ-9",
          "actions": [
            {
              "type": "create",
              "description": "PHQ-9 Questionnaire",
              "resource": {
                "resourceType": "Questionnaire",
                "id": "questionnaire-example-PHQ9",
                "contained": [
                  {
                    "resourceType": "ValueSet",
                    "id": "RPSPHQ9",
                    "name": "RPSPHQ9",
                    "status": "draft",
                    "description": "The answer list for questions in the PHQ9 Questionnaire.",
                    "immutable": true,
                    "compose": {
                      "include": [
                        {
                          "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9",
                          "concept": [
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 0
                                }
                              ],
                              "code": "Not-at-all",
                              "display": "Not at all"
                            },
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 1
                                }
                              ],
                              "code": "Several-days",
                              "display": "Several days"
                            },
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 2
                                }
                              ],
                              "code": "More than half the days",
                              "display": "More than half the days"
                            },
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 3
                                }
                              ],
                              "code": "Nearly every day",
                              "display": "Nearly every day"
                            }
                          ]
                        }
                      ]
                    }
                  }
                ],
                "name": "RAPIDS PHQ9",
                "title": "Patient Health Questionnaire 9 Item Scale",
                "status": "final",
                "experimental": false,
                "subjectType": [
                  "Patient"
                ],
                "item": [
                  {
                    "linkId": "GQ",
                    "code": [
                      {
                        "system": "http://loinc.org",
                        "code": "44249-1"
                      }
                    ],
                    "type": "group",
                    "required": true,
                    "item": [
                      {
                        "linkId": "GQH",
                        "text": "Over the last 2 weeks, how often have you been bothered by any of the following problems? (Use “X” to indicate your answer)",
                        "type": "display"
                      },
                      {
                        "linkId": "GQ1",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44250-9"
                          }
                        ],
                        "prefix": "1.",
                        "text": "Little interest or pleasure in doing things,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ2",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44255-8"
                          }
                        ],
                        "prefix": "2.",
                        "text": "Feeling down, depressed, or hopeless,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ3",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44259-0"
                          }
                        ],
                        "prefix": "3.",
                        "text": "Trouble falling or staying asleep, or sleeping too much",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ4",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44254-1"
                          }
                        ],
                        "prefix": "4.",
                        "text": "Feeling tired or having little energy,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ5",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44251-7"
                          }
                        ],
                        "prefix": "5.",
                        "text": "Poor appetite or overeating,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ6",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44258-2"
                          }
                        ],
                        "prefix": "6.",
                        "text": "Feeling bad about yourself - or that you are a failure or have let yourself or your family down,",
                        "type": "choice",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ7",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44252-5"
                          }
                        ],
                        "prefix": "7.",
                        "text": "Trouble concentrating on things, such as reading the newspaper or watching television,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ8",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44253-3"
                          }
                        ],
                        "prefix": "8.",
                        "text": "Moving or speaking so slowly that other people could have noticed. Or the opposite - being so fidgety or restless that you have been moving around a lot more than usual,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ9",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44260-8"
                          }
                        ],
                        "prefix": "9.",
                        "text": "Thoughts that you would be better off dead, or of hurting yourself",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ10",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44261-6"
                          }
                        ],
                        "prefix": "9.",
                        "text": "Thoughts that you would be better off dead, or of hurting yourself",
                        "type": "quantity",
                        "required": true,
                        "repeats": false
                      }
                    ]
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}

Case 1b - Alex - outdated PHQ-9

Alex is a 46 year old female patient who has a diagnosis of major depression. The source system has a weight and height value for Alex. The source system also has a PHQ-9 value of 15 dated March 1, 2022 (greater than one month old).

The source system would send the following FHIR resource to RAPIDS:

{
  "hookInstance": "1f18d6c8-1fce-405d-a88c-e46f98c70945",
  "fhirServer": "https://example.org/fhir",
  "hook": "patient-view",
  "context": {
    "patientId": "Patient/urn:emr:telus:chr:HSCN3212:2462",
    "userId": "Practitioner/urn:emr:telus:chr:HSCN3212:practitioner:22"
  },
  "prefetch": {
    "patient": {
      "resource": {
        "resourceType": "Bundle",
        "type": "transaction",
        "entry": [
          {
            "request": {
              "method": "POST",
              "url": "Patient"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Patient/urn:emr:telus:chr:HSCN3212:2462",
            "resource": {
              "resourceType": "Patient",
              "id": "urn:emr:telus:chr:HSCN3212:2462",
              "meta": {
                "lastUpdated": "2022-04-10T03:48:33.708+00:00"
              },
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Patient 2462 Female</div>"
              },
              "identifier": [
                {
                  "system": "urn:emr:telus:chr:HSCN3212",
                  "value": "2462"
                }
              ],
              "active": true,
              "gender": "female",
              "deceasedBoolean": "false",
              "managingOrganization": [
                {
                  "reference": "RPSOrganization/urn:emr:telus:chr:HSCN3212"
                }
              ]
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11222",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11222",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Body weight Measured at 185lbs on 2022-03-28 for patient 2462</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "vital-signs",
                      "display": "Vital Signs"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "3141-9",
                    "display": "Body weight Measured"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueQuantity": {
                "value": 83.9,
                "unit": "Kg"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11223",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11223",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Body Height Measured at 170.2cm on 2022-03-28 for patient 2462</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "vital-signs",
                      "display": "Vital Signs"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "8302-2",
                    "display": "Body Height Measured"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueQuantity": {
                "value": 170.2,
                "unit": "cm"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11224",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11224",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Patient 2462 is 46 years old on 2022-03-28</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "social-history",
                      "display": "Social History"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "21612-7",
                    "display": "Age Reported"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueInteger": 46
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11225",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11225",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Patient 2462 has a caluculated PHQ-9 score of 15 as recorded on 2022-03-01</div>"
              },
              "status": "final",
              "category": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                    "code": "survey",
                    "display": "survey"
                  }
                ]
              },
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "44261-6",
                    "display": "Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-01",
              "valueQuantity": {
                "value": 15,
                "unit": "score"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Condition"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:condition:123",
            "resource": {
              "resourceType": "Condition",
              "id": "urn:emr:telus:chr:HSCN3212:2462:condition:123",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Major Depressive Disorder</div>"
              },
              "clinicalStatus": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                    "code": "active"
                  }
                ]
              },
              "verificationStatus": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
                    "code": "confirmed"
                  }
                ]
              },
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                      "code": "problem-list-item",
                      "display": "Problem List Item"
                    },
                    {
                      "system": "http://snomed.info/sct",
                      "code": "439401001",
                      "display": "Diagnosis"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/sid/icd-9-cm",
                    "code": "296.22",
                    "display": "Major depressive disorder, single episode"
                  }
                ],
                "text": "Major depressive disorder, single episode"
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              }
            }
          }
        ]
      }
    }
  }
}

In this case RAPIDS would respond:

```javascript
{
  "cards": [
    {
      "uuid": "781e08d7-5598-47b7-b1a9-72c19875682e",
      "summary": "Please Complete a PHQ-9",
      "source": {
        "label": "TELUS RAPIDS CDS",
        "url": "http://telus.rapids.com/"
      },
      "indicator": "info",
      "suggestions": [
        {
          "label": "Scale PHQ-9 is not valid since it is greater than one month old. Please provide an updated PHQ-9.",
          "actions": [
            {
              "type": "create",
              "description": "PHQ-9 Questionnaire",
              "resource": {
                "resourceType": "Questionnaire",
                "id": "questionnaire-example-PHQ9",
                "contained": [
                  {
                    "resourceType": "ValueSet",
                    "id": "RPSPHQ9",
                    "name": "RPSPHQ9",
                    "status": "draft",
                    "description": "The answer list for questions in the PHQ9 Questionnaire.",
                    "immutable": true,
                    "compose": {
                      "include": [
                        {
                          "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9",
                          "concept": [
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 0
                                }
                              ],
                              "code": "Not-at-all",
                              "display": "Not at all"
                            },
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 1
                                }
                              ],
                              "code": "Several-days",
                              "display": "Several days"
                            },
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 2
                                }
                              ],
                              "code": "More than half the days",
                              "display": "More than half the days"
                            },
                            {
                              "extension": [
                                {
                                  "url": "http://hl7.org/fhir/StructureDefinition/ordinalValue",
                                  "valueDecimal": 3
                                }
                              ],
                              "code": "Nearly every day",
                              "display": "Nearly every day"
                            }
                          ]
                        }
                      ]
                    }
                  }
                ],
                "name": "RAPIDS PHQ9",
                "title": "Patient Health Questionnaire 9 Item Scale",
                "status": "final",
                "experimental": false,
                "subjectType": [
                  "Patient"
                ],
                "item": [
                  {
                    "linkId": "GQ",
                    "code": [
                      {
                        "system": "http://loinc.org",
                        "code": "44249-1"
                      }
                    ],
                    "type": "group",
                    "required": true,
                    "item": [
                      {
                        "linkId": "GQH",
                        "text": "Over the last 2 weeks, how often have you been bothered by any of the following problems? (Use “X” to indicate your answer)",
                        "type": "display"
                      },
                      {
                        "linkId": "GQ1",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44250-9"
                          }
                        ],
                        "prefix": "1.",
                        "text": "Little interest or pleasure in doing things,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ2",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44255-8"
                          }
                        ],
                        "prefix": "2.",
                        "text": "Feeling down, depressed, or hopeless,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ3",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44259-0"
                          }
                        ],
                        "prefix": "3.",
                        "text": "Trouble falling or staying asleep, or sleeping too much",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ4",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44254-1"
                          }
                        ],
                        "prefix": "4.",
                        "text": "Feeling tired or having little energy,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ5",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44251-7"
                          }
                        ],
                        "prefix": "5.",
                        "text": "Poor appetite or overeating,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ6",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44258-2"
                          }
                        ],
                        "prefix": "6.",
                        "text": "Feeling bad about yourself - or that you are a failure or have let yourself or your family down,",
                        "type": "choice",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ7",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44252-5"
                          }
                        ],
                        "prefix": "7.",
                        "text": "Trouble concentrating on things, such as reading the newspaper or watching television,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ8",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44253-3"
                          }
                        ],
                        "prefix": "8.",
                        "text": "Moving or speaking so slowly that other people could have noticed. Or the opposite - being so fidgety or restless that you have been moving around a lot more than usual,",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ9",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44260-8"
                          }
                        ],
                        "prefix": "9.",
                        "text": "Thoughts that you would be better off dead, or of hurting yourself",
                        "type": "choice",
                        "answerValueSet": "#RPSPHQ9",
                        "required": true,
                        "repeats": false
                      },
                      {
                        "linkId": "GQ10",
                        "code": [
                          {
                            "system": "http://loinc.org",
                            "code": "44261-6"
                          }
                        ],
                        "prefix": "9.",
                        "text": "Thoughts that you would be better off dead, or of hurting yourself",
                        "type": "quantity",
                        "required": true,
                        "repeats": false
                      }
                    ]
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}

Case 1c - Alex - diagnosis and medication suggestion

Alex is a 46 year old female patient who has a diagnosis of generalized anxiety disorder with no GAD-7. The source system has a weight and height value for Alex. The source system also has a PHQ-9 value of 15 dated today.

The source system would send the following FHIR resource to RAPIDS:

{
  "hookInstance": "1f18d6c8-1fce-405d-a88c-e46f98c70945",
  "fhirServer": "https://example.org/fhir",
  "hook": "patient-view",
  "context": {
    "patientId": "Patient/urn:emr:telus:chr:HSCN3212:2462",
    "userId": "Practitioner/urn:emr:telus:chr:HSCN3212:practitioner:22"
  },
  "prefetch": {
    "patient": {
      "resource": {
        "resourceType": "Bundle",
        "type": "transaction",
        "entry": [
          {
            "request": {
              "method": "POST",
              "url": "Patient"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Patient/urn:emr:telus:chr:HSCN3212:2462",
            "resource": {
              "resourceType": "Patient",
              "id": "urn:emr:telus:chr:HSCN3212:2462",
              "meta": {
                "lastUpdated": "2022-04-10T03:48:33.708+00:00"
              },
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Patient 2462 Female</div>"
              },
              "identifier": [
                {
                  "system": "urn:emr:telus:chr:HSCN3212",
                  "value": "2462"
                }
              ],
              "active": true,
              "gender": "female",
              "deceasedBoolean": "false",
              "managingOrganization": [
                {
                  "reference": "RPSOrganization/urn:emr:telus:chr:HSCN3212"
                }
              ]
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11222",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11222",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Body weight Measured at 185lbs on 2022-03-28 for patient 2462</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "vital-signs",
                      "display": "Vital Signs"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "3141-9",
                    "display": "Body weight Measured"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueQuantity": {
                "value": 83.9,
                "unit": "Kg"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11223",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11223",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Body Height Measured at 170.2cm on 2022-03-28 for patient 2462</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "vital-signs",
                      "display": "Vital Signs"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "8302-2",
                    "display": "Body Height Measured"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueQuantity": {
                "value": 170.2,
                "unit": "cm"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11224",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11224",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><b>Patient 2462 is 46 years old on 2022-03-28</b></div>"
              },
              "status": "final",
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                      "code": "social-history",
                      "display": "Social History"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "21612-7",
                    "display": "Age Reported"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "2022-03-28",
              "valueInteger": 46
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Observation"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:observation:11225",
            "resource": {
              "resourceType": "Observation",
              "id": "urn:emr:telus:chr:HSCN3212:2462:observation:11225",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Patient 2462 has a caluculated PHQ-9 score of 15 as recorded on today</div>"
              },
              "status": "final",
              "category": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                    "code": "survey",
                    "display": "survey"
                  }
                ]
              },
              "code": {
                "coding": [
                  {
                    "system": "http://loinc.org",
                    "code": "44261-6",
                    "display": "Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]"
                  }
                ]
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              },
              "effectiveDateTime": "today placeholder",
              "valueQuantity": {
                "value": 12,
                "unit": "score"
              }
            }
          },
          {
            "request": {
              "method": "POST",
              "url": "Condition"
            },
            "fullUrl": "http://telus.com/rapids/StructureDefinition/Observation/urn:emr:telus:chr:HSCN3212:2462:condition:123",
            "resource": {
              "resourceType": "Condition",
              "id": "urn:emr:telus:chr:HSCN3212:2462:condition:123",
              "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Major Depressive Disorder</div>"
              },
              "clinicalStatus": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                    "code": "active"
                  }
                ]
              },
              "verificationStatus": {
                "coding": [
                  {
                    "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
                    "code": "confirmed"
                  }
                ]
              },
              "category": [
                {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                      "code": "problem-list-item",
                      "display": "Problem List Item"
                    },
                    {
                      "system": "http://snomed.info/sct",
                      "code": "439401001",
                      "display": "Diagnosis"
                    }
                  ]
                }
              ],
              "code": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/sid/icd-9-cm",
                    "code": "296.22",
                    "display": "Major depressive disorder, single episode"
                  }
                ],
                "text": "Major depressive disorder, single episode"
              },
              "subject": {
                "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
              }
            }
          }
        ]
      }
    }
  }
}

In this case RAPIDS would respond:

{
  "cards": [
    {
      "uuid": "781e08d7-5598-47b7-b1a9-72c19875682e",
      "summary": "A score of 15 on PHQ-9 supports a diagnosis of MDD: Moderate to severe depression.  For MDD it is important to screen for the following: Anxious distress, BP disorders, insomnia.",
      "source": {
        "label": "TELUS RAPIDS CDS",
        "url": "http://telus.rapids.com/"
      },
      "indicator": "info",
      "suggestions": [
        {
          "label": "The given diagnosis is MDD with no specifiers",
          "actions": [
            {
              "type": "create",
              "description": "MDD Diagnosis",
              "resource": {
                "resourceType": "Condition",
                "id": "urn:emr:telus:chr:HSCN3212:2462:condition:123",
                "text": {
                  "status": "generated",
                  "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Major Depressive Disorder</div>"
                },
                "clinicalStatus": {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                      "code": "active"
                    }
                  ]
                },
                "verificationStatus": {
                  "coding": [
                    {
                      "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
                      "code": "provisional"
                    }
                  ]
                },
                "category": [
                  {
                    "coding": [
                      {
                        "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                        "code": "problem-list-item",
                        "display": "Problem List Item"
                      },
                      {
                        "system": "http://snomed.info/sct",
                        "code": "439401001",
                        "display": "Diagnosis"
                      }
                    ]
                  }
                ],
                "code": {
                  "coding": [
                    {
                      "system": "http://hl7.org/fhir/sid/icd-9-cm",
                      "code": "296.22",
                      "display": "Major depressive disorder, single episode"
                    }
                  ],
                  "text": "Major depressive disorder, single episode"
                },
                "subject": {
                  "reference": "Patient/urn:emr:telus:chr:HSCN3212:2462"
                },
                "recordedDate": "2022-04-01"
              }
            }
          ]
        },
        {
          "label": "Consider initiating treatment with a preferred first-choice antidepressant: bupropion xl, desvenlafaxine, duloxetine, escitalopram, levomilnacipran, mirtazapine, sertraline, vilazodone, vortioxetine",
          "actions": [
            {
              "type": "create",
              "description": "Create a presciption for bupropion xl",
              "resource": {
                "resourceType": "Medication",
                "id": "telus:rapids:medication:bupropionxl",
                "text": {
                  "status": "generated",
                  "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Medication bupropionxl 150mg Extended Release Tablet</div>"
                },
                "code": {
                  "coding": [
                    {
                      "system": "http://hl7.org/fhir/NamingSystem/ca-hc-din",
                      "code": "02275090",
                      "display": "WELLBUTRIN XL 150MG EXTENDED RELEASE TABLETS"
                    }
                  ]
                },
                "form": {
                  "coding": [
                    {
                      "system": "http://hl7.org/fhir/ValueSet/medication-form-codes",
                      "code": "420627008",
                      "display": "Tablet (Extended-Release)"
                    }
                  ]
                },
                "ingredient": [
                  {
                    "item": {
                      "concept": {
                        "coding": [
                          {
                            "system": "https://health-products.canada.ca/dpd-bdpp",
                            "code": "bupropion hydrochloride",
                            "display": "bupropion hydrochloride"
                          }
                        ]
                      }
                    },
                    "strengthRatio": {
                      "numerator": {
                        "value": 150,
                        "system": "http://unitsofmeasure.org",
                        "code": "mg"
                      },
                      "denominator": {
                        "value": 1,
                        "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm",
                        "code": "TAB"
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}