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

Invalid Prefetch in CDS Hooks Discovery #296

Open
cfeltner opened this issue May 17, 2024 · 0 comments
Open

Invalid Prefetch in CDS Hooks Discovery #296

cfeltner opened this issue May 17, 2024 · 0 comments

Comments

@cfeltner
Copy link

According to the CDS Hooks specification (https://cds-hooks.hl7.org/2.0/#prefetch-tokens),

"Only root-level fields with a primitive value within the context object are eligible to be used as prefetch tokens. For example, {{context.medication.id}} is not a valid prefetch token because it attempts to access the id field of the medication field."

The prefetch specified in CDS Hooks Discovery response returned from the Davinci CRD Reference Implementation is not following the above prefetch token guidance. Specifically, the following prefetch tokens are not "root-level fields with a primitive value": context.draftOrders.ServiceRequest.id, context.medications.MedicationRequest.id, and context.draftOrders.DeviceRequest.id

Prefetch excerpt:

"prefetch": {
  "serviceRequestBundle": "ServiceRequest?_id={{context.draftOrders.ServiceRequest.id}}&_include=ServiceRequest:patient&_include=ServiceRequest:performer&_include=ServiceRequest:requester&_include:iterate=PractitionerRole:organization&_include:iterate=PractitionerRole:practitioner",
  "medicationRequestBundle": "MedicationRequest?_id={{context.medications.MedicationRequest.id}}&_include=MedicationRequest:patient&_include=MedicationRequest:intended-dispenser&_include=MedicationRequest:requester:PractitionerRole&_include=MedicationRequest:medication&_include:iterate=PractitionerRole:organization&_include:iterate=PractitionerRole:practitioner",
  "coverageBundle": "Coverage?patient={{context.patientId}}",
  "deviceRequestBundle": "DeviceRequest?_id={{context.draftOrders.DeviceRequest.id}}&_include=DeviceRequest:patient&_include=DeviceRequest:performer&_include=DeviceRequest:requester&_include=DeviceRequest:device&_include:iterate=PractitionerRole:organization&_include:iterate=PractitionerRole:practitioner"
},  

Recommend refactoring prefetch to request the Patient and Practitioner resources by themselves. Since these are draft orders they may not be persisted and even able to be accessed with a FHIR search which the current prefetch is dependent on.

"prefetch": {
    "patient": "Patient/{{context.patientId}}",
    "practitioner": "Practitioner/{{context.userId}}"
    "coverageBundle": "Coverage?patient={{context.patientId}}",
},  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant