You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#238: Clarified how prefetch templates are processed
Fixes#239: Clarified prefetch data conformance language
Fixes#242: Added definition for prefetch key
Fixes#244: Updated conformance language usage in prefetch restrictions
Fixes#246: Clarified prefetch limitations are on prefetch templates
Fixes#257: Added clarification on responses and notes about multiple services from the same hook
Fixes#262: Added examples for each action type
Fixes#264: Clarified documentation for actions
Fixes#274: Clarified hook context table is an example
Fixes#281: Clarified prefetch response resources may be a searchset bundle
Fixes#282: Provided rationale for the use of null in the prefetch response
Fixes#287: Clarified allowable data types for context fields
Fixes#289: Changed prefetch token status change to Major
Fixes#298: Added examples to hook/prefetch discussion
Fixes#300: Added an overview section discussing CDS Hooks components
Fixes#313: Clarified definitions of prefetch template, prefetch token, and prefetch key
Fixes#314: Clarified prefetch behavior for multiple services attached to the same hook
Fixes#316: Added rationale for not allowing next page links in prefetch data
Fixes#344: Clarified distinction between context and prefetch
Fixes#343: Updated prefetch example to use full key names
Fixes#349: Corrected capitalization of conformance language in prefetch description
To allow for prefetch templates that are dependent on the workflow context, prefetch templates may include references to context using _prefetch tokens_. In the above example, `{{context.patientId}}` is a prefetch token. A prefetch token is a placeholder in a prefetch template that is replaced by a value from the hook's context to construct the FHIR URL used to request the prefetch data.
203
-
204
-
Prefetch tokens MUST be delimited by `{{` and `}}`, and MUST contain only the qualified path to a hook context field.
205
-
206
-
Individual hooks specify which of their `context` fields can be used as 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.
202
+
To allow for prefetch templates that are dependent on the workflow context, prefetch templates may include references to context using [_prefetch tokens_](#prefetch-tokens). In the above example, `{{context.patientId}}` is a prefetch token.
207
203
208
204
The `prefetch` field of a CDS Service description defines the set of prefetch templates for that service, providing a _prefetch key_ for each one that is used to identify the prefetch data in the CDS request. For example:
209
205
@@ -239,65 +235,27 @@ The EHR MUST NOT send any prefetch template key that it chooses not to satisfy.
239
235
240
236
It is the CDS Service's responsibility to check prefetched data against its template to determine what requests were satisfied (if any) and to manually retrieve any additional necessary data. If the CDS Service is unable to obtain required data because it cannot access the FHIR server and the request did not contain the necessary prefetch keys, the service SHALL respond with an HTTP 412 Precondition Failed status code.
A prefetch token is a placeholder in a prefetch template that is replaced by a value from the hook's context to construct the FHIR URL used to request the prefetch data.
253
241
254
-
Here is an example prefetch field from a CDS Service discovery endpoint. The
255
-
goal is to know, at call time:
256
-
257
-
| Key | Description |
258
-
| --- | ----------- |
259
-
|`patient`| Patient demographics. |
260
-
|`hemoglobin-a1c`| Most recent Hemoglobin A1c reading for this patient. |
261
-
| `user` | Information on the current user (Practitioner).
242
+
Prefetch tokens MUST be delimited by `{{` and `}}`, and MUST contain only the qualified path to a hook context field.
262
243
263
-
#### Example prefetch data
244
+
Individual hooks specify which of their `context` fields can be used as 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.
264
245
265
-
```json
266
-
{
267
-
"prefetch": {
268
-
"patient":{
269
-
"resourceType": "Patient",
270
-
"gender": "male",
271
-
"birthDate": "1974-12-25",
272
-
"...": "<snipped for brevity>"
273
-
},
274
-
"hemoglobin-a1c": {
275
-
"resourceType": "Bundle",
276
-
"type": "searchset",
277
-
"entry": [{
278
-
"resource": {
279
-
"resourceType": "Observation",
280
-
"code": {
281
-
"coding": [{
282
-
"system": "http://loinc.org",
283
-
"code": "4548-4",
284
-
"display": "Hemoglobin A1c"
285
-
}]
286
-
},
287
-
"...": "<snipped for brevity>"
288
-
}
289
-
}]
290
-
}
291
-
}
292
-
}
293
-
```
246
+
#### Prefetch query restrictions
294
247
295
-
The CDS Hooks request is augmented to include two prefetch values, where the dictionary
296
-
keys match the request keys (`patient` and `hemoglobin-a1c` in this case).
248
+
To reduce the implementation burden on EHRs that support CDS Services, this specification RECOMMENDS that prefetch queries only use a subset of the full functionality available in the FHIR specification. Valid prefetch templates SHOULD only make use of:
297
249
298
-
Note that the missing `user` key indicates that either the EHR has decided not to satisfy this particular prefetch template or it was not able to retrieve this prefetched data. The CDS Service is responsible for retrieving this Practitioner data from the FHIR server (if required).
250
+
*_instance_ level [read](https://www.hl7.org/fhir/http.html#read) interactions (for resources with known ids such as `Patient` and `Practitioner`)
*_token_ search parameters using equality (e.g. `code=4548-4`) and optionally the `:in` modifier (no other modifiers for token parameters)
254
+
*_date_ search parameters on `date`, `dateTime`, `instant`, or `Period` types only, and using only the prefixes `eq`, `lt`, `gt`, `ge`, `le`
255
+
* the `_count` parameter to limit the number of results returned
256
+
* the `_sort` parameter to allow for _most recent_ and _first_ queries
299
257
300
-
#### Prefetch tokens
258
+
#### Example prefetch token
301
259
302
260
Often a prefetch template builds on the contextual data associated with the hook. For example, a particular CDS Service might recommend guidance based on a patient's conditions when the chart is opened. The FHIR query to retrieve these conditions might be `Condition?patient=123`. In order to express this as a prefetch template, the CDS Service must express the FHIR identifier of the patient as a token so that the EHR can replace the token with the appropriate value. When context fields are used as tokens, their token name MUST be `context.name-of-the-field`. For example, given a context like:
303
261
@@ -360,17 +318,63 @@ Only the `encounterId` field in this example is eligible to be a prefetch token
360
318
}
361
319
```
362
320
363
-
#### Prefetch query restrictions
321
+
#### Example prefetch templates
364
322
365
-
To reduce the implementation burden on EHRs that support CDS Services, this specification RECOMMENDS that prefetch queries only use a subset of the full functionality available in the FHIR specification. Valid prefetch templates SHOULD only make use of:
*_token_ search parameters using equality (e.g. `code=4548-4`) and optionally the `:in` modifier (no other modifiers for token parameters)
371
-
*_date_ search parameters on `date`, `dateTime`, `instant`, or `Period` types only, and using only the prefixes `eq`, `lt`, `gt`, `ge`, `le`
372
-
* the `_count` parameter to limit the number of results returned
373
-
* the `_sort` parameter to allow for _most recent_ and _first_ queries
333
+
Here is an example prefetch field from a CDS Service discovery endpoint. The
334
+
goal is to know, at call time:
335
+
336
+
| Key | Description |
337
+
| --- | ----------- |
338
+
|`patient`| Patient demographics. |
339
+
|`hemoglobin-a1c`| Most recent Hemoglobin A1c reading for this patient. |
340
+
| `user` | Information on the current user (Practitioner).
341
+
342
+
#### Example prefetch data
343
+
344
+
```json
345
+
{
346
+
"prefetch": {
347
+
"patient":{
348
+
"resourceType": "Patient",
349
+
"gender": "male",
350
+
"birthDate": "1974-12-25",
351
+
"...": "<snipped for brevity>"
352
+
},
353
+
"hemoglobin-a1c": {
354
+
"resourceType": "Bundle",
355
+
"type": "searchset",
356
+
"entry": [{
357
+
"resource": {
358
+
"resourceType": "Observation",
359
+
"code": {
360
+
"coding": [{
361
+
"system": "http://loinc.org",
362
+
"code": "4548-4",
363
+
"display": "Hemoglobin A1c"
364
+
}]
365
+
},
366
+
"...": "<snipped for brevity>"
367
+
}
368
+
}]
369
+
}
370
+
}
371
+
}
372
+
```
373
+
374
+
The CDS Hooks request is augmented to include two prefetch values, where the dictionary
375
+
keys match the request keys (`patient` and `hemoglobin-a1c` in this case).
376
+
377
+
Note that the missing `user` key indicates that either the EHR has decided not to satisfy this particular prefetch template or it was not able to retrieve this prefetched data. The CDS Service is responsible for retrieving this Practitioner data from the FHIR server (if required).
0 commit comments