How to include MedicationRequest object in the card's suggestion

45 views
Skip to first unread message

Tien Thai

unread,
Jan 20, 2021, 10:34:20 AM1/20/21
to CDS Hooks
Hello everyone,
I have been trying to figure out a way to include a list of medications in the returned card.  I basically defined an expression as shown below (see FIG.1) and then referenced it in the card's SUGGESTIONS property (see FIG. 2 for details of hook config).  

To make sure the change is in affect, I restarted the CDS service.

When invoking my CDS Service, the CARD was successfully returned.  However, when looking at the content of the CARD, the SUGGESTIONS property and its content was not included as expected (see FIG.3) 

I would appreciate your help if you could point out anything that I could have missed.

FIG. 1
--------------------
define ActiveFRIDsMeds:
[MedicationRequest: medication in "Fall Risk Increasing Drugs (FRIDs) VS"] A
return{
medcode: A.medication.coding.code.value

---------------------

FIG. 2
---------------------
{
  "id": "fall-prevention-risk-factors-r4",
  "hook": "medication-prescribe",
  "title": "Fall Prevention Risk Factors",
  "description": "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": "Fall Prevention Risk Factors for Patient 65 Years of Age and Older",
        "indicator": "info",
        "detail": "Returned Recommendation: ${Recommendation}",
        "source": {
          "label": "CDS Connect: Fall Prevention Risk Factor - Medication Service",
        },
        "extension": {
          "grade": "${RecommendationGrade}",
          "rationale": "${Rationale}"
        },
"error":"Error: ${Error}"
      }
    }],
"suggestions": "Returned Suggestions: ${ActiveFRIDsMeds}",
    "cql": {
      "library": {
        "id": "Fall-Prevention-Medication-Risk-Factors",
        "version": "1"
      }
    }
  }
}

---------------------------
FIG 3
C:\CQL_Proj\temp>curl -X POST -d @testrequest.json -H "Content-Type: application/json" "localhost:3000/cds-services/fall-prevention-risk-factors-r4"
{"cards":[{"summary":"Fall Prevention Risk Factors for Patient 65 Years of Age and Older","indicator":"info","detail":"Returned Recommendation: Considering 18-week tapering protocol, provide patient education brochure.","source":{"label":"CDS Connect: Fall Prevention Risk Factor - Medication Service","url":"https://cds.ahrq.gov/cdsconnect/artifact/fall-prevention-risk-factors-r4"},"extension":{"grade":"","rationale":""},"error":"Error: "}]}
C:\CQL_Proj\temp>

dennis.p...@cerner.com

unread,
Jan 20, 2021, 12:01:00 PM1/20/21
to CDS Hooks

Tien,  is your question pertaining more to a particular library you're trying to use?  Your figure 2 does not conform to the spec and references figure 1, which is outside the spec.

Tien Thai

unread,
Jan 20, 2021, 2:09:39 PM1/20/21
to CDS Hooks
Hi Dennis,

No, it is actually pertained more to the returned CDS card.  The definition show in FIG 1 is part of the external CQL which I attached to the CDS service using CDS Authoring Tool.  In the hook config file, I referenced this definition as content of the  card suggestion (see  REVISED FIG 2 below).  However, when I started the CDS service, it throws the  "throw new Error('Card has suggestions but no selectionBehavior field.');" error.  I believe I did not define the value for the CARD's suggestion property correctly.  Do you have examples about  suggestion configuration?  Thank you very much.

Regards,
Tien Thai

FIG. 2
---------------------
{
  "id": "fall-prevention-risk-factors-r4",
  "hook": "medication-prescribe",
  "title": "Fall Prevention Risk Factors",
  "description": "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": "Fall Prevention Risk Factors for Patient 65 Years of Age and Older",
        "indicator": "info",
        "detail": "Returned Recommendation: ${Recommendation}",
        "source": {
          "label": "CDS Connect: Fall Prevention Risk Factor - Medication Service",
        },
        "suggestions": "${ActiveFRIDsMeds}",
        "extension": {
          "grade": "${RecommendationGrade}",
          "rationale": "${Rationale}"
        },
"error":"Error: ${Error}"
      }
    }],

Bryn Rhodes

unread,
Jan 20, 2021, 2:42:43 PM1/20/21
to Tien Thai, CDS Hooks
Hi Tien,

This looks like the extensions that are part of the CQL Hooks service, and I'm not sure the folks that maintain that project are part of this group, I'd suggest posting this question in the cql or cds-hooks streams on Zulip.

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/8196de1a-0bf0-458b-b491-a459efc46024n%40googlegroups.com.

Tien Thai

unread,
Jan 20, 2021, 3:17:08 PM1/20/21
to CDS Hooks
Hi Dennis, Bryn

Thank you very much for the suggestions. 

The issue appears to be resolved after adding the "selectionBehavior" attribute to the card configuration.   According the CDS Hook document, "If suggestions are present, selectionBehavior MUST also be provided."

Regards,
Tien Thai
Reply all
Reply to author
Forward
0 new messages