Technical Question

64 views
Skip to first unread message

Tien Thai

unread,
Feb 17, 2021, 5:11:18 PM2/17/21
to CDS Hooks
I have defined an expression (i.e. Summary) and have been trying to display this "Summary" in the response card but unsuccessful.  In fact, I kept getting a string "Object object" in place of the "${Summary}" in the response card (see attached screenshot).  Can you please show me how you can display the content of the Summary in the response card?  Thank you all very much.

Regards,
Tien Thai

{
  "id": "aspire_medication_service_v1",
  "hook": "medication-prescribe",
  "title": "ASPIRE - MEDICATION SERVICE",
  "description": "ASPIRE CDS Service that provides guidance to the prescriber if the patient is at least 65 years of age and is on FRIDs medication.",
  "_config": {
    "cards": [{
      "conditionExpression": "InPopulation",
      "card": {
        "summary": "Summary: ${Summary}",
        "indicator": "info",
        "detail": "Returned Recommendation: ${Recommendation}",
        "source": {
          "label": "CDS Connect: Fall Prevention Risk Factor - Medication Service",
        },
"suggestions": "${On Fall Risk Increasing Drugs (FRIDs)}",
"selectionBehavior" : "at-most-one",
        "extension": {
          "grade": "${RecommendationGrade}",
          "rationale": "${Rationale}"
        },
"error":"Error: ${Error}"
      }
    }],
    "cql": {
      "library": {
        "id": "ASPIREMedicationService",
        "version": "1"
      }
    }
  }
}
--------------------------------------


define "Summary":
  "ASPIRECommonLib"."Report Active FRIDS"


define "Report Active FRIDS":
  "Fall Risk Increasing Drugs Within 180 Days" FRIDS
  return {
      Type:  'Statement',
      Name:  ConceptText(FRIDS.medication as FHIR.CodeableConcept),
      Start: MedicationStatementDate(FRIDS),
      End:   DateTimeText((FRIDS.effective as FHIR.Period)."end"),
      Status: FRIDS.status.value
    }
    sort by Start desc, End desc
Capture.JPG

darte...@gmail.com

unread,
Feb 17, 2021, 5:16:09 PM2/17/21
to CDS Hooks
If you're getting "Object object", then you need to convert your JSON data into a string prior to storing it into a variable, using JSON.stringify(data) for javascript, for python use json.dumps. If you later need to extract the JSON data, use JSON.parse(stringified_data). I'm guessing that's your issue.

Tien Thai

unread,
Feb 17, 2021, 5:24:24 PM2/17/21
to CDS Hooks
Hi Darte,
Can you do this in CQL?

TT

darte...@gmail.com

unread,
Feb 17, 2021, 5:33:42 PM2/17/21
to CDS Hooks
Yes you should be able to use any back-end language you want. Just make sure that when you pass the data back to the front-end, to convert it to a string first, otherwise when you try to parse the JSON data you'll get "Object object".

Bryn Rhodes

unread,
Feb 17, 2021, 6:49:45 PM2/17/21
to darte...@gmail.com, CDS Hooks
Hi Tien,

Yes, you can use CQL to construct a string representation of the summary. Here's an example from the Opioid IG:
CQL has string-building functions so that you can convert the data to a string representation, which is what the CDS Card is expecting in this case.

Regards,
Bryn Rhodes


--
You received this message because you are subscribed to the Google Groups "CDS Hooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cds-hooks+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cds-hooks/9dc1a910-c7aa-454c-b7c6-c9e097da11bdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages