Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Return of MedicationRequest When Using CQL Execution #13

Open
JSRankins opened this issue Jul 21, 2022 · 8 comments
Open

No Return of MedicationRequest When Using CQL Execution #13

JSRankins opened this issue Jul 21, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@JSRankins
Copy link

@JPercival and @brynrhodes , there does not appear to be a return of MedicationRequest resource when provided the following CQL and a Bundle containing a MedicationRequest Resource:

CQL
define "MedicationRequest Test": [MedicationRequest]

Resource Bundle
{ "resourceType": "Bundle", "id": "tests-numer-pos-HFACEIorARBorARNIforLVSDQICore4-bundle", "type": "transaction", "entry": [ { "resource": { "resourceType": "Medication", "id": "numer-pos-HFACEIorARBorARNIforLVSDQICore4-6", "meta": { "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication" ] }, "code": { "coding": [ { "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "1091646", "display": "azilsartan medoxomil 40 MG Oral Tablet" } ] } }, "request": { "method": "PUT", "url": "Medication/numer-pos-HFACEIorARBorARNIforLVSDQICore4-6" } }, { "resource": { "resourceType": "MedicationRequest", "id": "numer-pos-HFACEIorARBorARNIforLVSDQICore4-5", "meta": { "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ] }, "status": "active", "intent": "order", "medicationReference": { "reference": "Medication/numer-pos-HFACEIorARBorARNIforLVSDQICore4-6" }, "authoredOn": "2022-03-02T10:15:00.000Z", "note": [ { "text": "Patient told to take with food" } ], "dosageInstruction": [ { "sequence": 1, "text": "One tablet", "additionalInstruction": [ { "coding": [ { "system": "http://snomed.info/sct", "code": "311504000", "display": "With or after food" } ] } ], "timing": { "repeat": { "frequency": 1, "period": 1, "periodUnit": "d" } }, "route": { "coding": [ { "system": "http://snomed.info/sct", "code": "26643006", "display": "Oral Route" } ] }, "method": { "coding": [ { "system": "http://snomed.info/sct", "code": "421521009", "display": "Swallow - dosing instruction imperative (qualifier value)" } ] }, "doseAndRate": [ { "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type", "code": "ordered", "display": "Ordered" } ] }, "doseQuantity": { "value": 1, "unit": "TAB", "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm", "code": "TAB" } } ] }, { "sequence": 2, "text": "One tablet daily", "additionalInstruction": [ { "coding": [ { "system": "http://snomed.info/sct", "code": "311504000", "display": "With or after food" } ] } ], "timing": { "repeat": { "frequency": 1, "period": 1, "periodUnit": "d" } }, "route": { "coding": [ { "system": "http://snomed.info/sct", "code": "26643006", "display": "Oral Route" } ] }, "doseAndRate": [ { "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type", "code": "ordered", "display": "Ordered" } ] }, "doseQuantity": { "value": 1, "unit": "TAB", "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm", "code": "TAB" } } ] } ], "dispenseRequest": { "validityPeriod": { "start": "2022-03-02", "end": "2022-05-31" }, "numberOfRepeatsAllowed": 2, "quantity": { "value": 30, "unit": "TAB", "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm", "code": "TAB" }, "expectedSupplyDuration": { "value": 30, "unit": "days", "system": "http://unitsofmeasure.org", "code": "d" } }, "substitution": { "allowedBoolean": true, "reason": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", "code": "FP", "display": "formulary policy" } ] } } }, "request": { "method": "PUT", "url": "MedicationRequest/numer-pos-HFACEIorARBorARNIforLVSDQICore4-5" } } ] }

Result is an empty array: []

I even tried using a medicationCodeableConcept in the above MedicationRequest resource (as opposed to medicationReference), and still no result.

Thoughts?

@rob-reynolds
Copy link

@JSRankins I was able to get a result by adding a subject.

@rob-reynolds
Copy link

{
    "resourceType": "MedicationRequest",
    "id": "numer-pos-HFACEIorARBorARNIforLVSDQICore4-5",
    "status": "active",
    "intent": "order",
    "medicationReference": {	
		"reference": "Medication/numer-pos-HFACEIorARBorARNIforLVSDQICore4-6"
	},
    "subject": {
        "reference": "Patient/hist-closed-HCC189"
    }
}

=>

MedicationRequest Test=[MedicationRequest(id=numer-pos-HFACEIorARBorARNIforLVSDQICore4-5)]

@rob-reynolds
Copy link

Which would make sense if it were in Patient context.

@rob-reynolds
Copy link

But I also tried moving it out of Patient context:

define "MedicationRequest Test": 
  [MedicationRequest]

context Patient

and did not get a MR unless I had the subject.

@rob-reynolds
Copy link

I also tried no context at all:

library TestMR version '0.0.1'

using FHIR version '4.0.1'

define "MedicationRequest Test": 
  [MedicationRequest]

^that's my entire file... and no MR unless the MR resource has a subject.

@rob-reynolds
Copy link

Now that I think about it, I think there's something about the vs code plugin that behaves like there's patient context regardless. Like it expects the evaluation to be in context of a Patient.

@rob-reynolds
Copy link

rob-reynolds commented Jul 21, 2022

IOW, I think what you're seeing is expected (albeit maybe surprising) behavior for the VS Code plugin.

But Bryn/JP would need to verify.

And you can get the behavior you expect by adding a subject reference to your MedicationRequest resource.

@JSRankins
Copy link
Author

Thanks @rob-reynolds. I can confirm that the addition of a subject to the resource allowed me to return the MedicationRequest. Perhaps the missing required element caused the MedicationResource not to return. Not sure. If that's true, it would have been more user-friendly to identify that as the cause in the resulting output.

@brynrhodes brynrhodes added the enhancement New feature or request label Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants