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
@@ -173,12 +173,28 @@ Similarly, each EHR will decide what FHIR resources to authorize and to prefetch
173
173
### Prefetch Template
174
174
175
175
The prefetch template is a dictionary of `read` and `search` requests to supply
176
-
relevant data, where the following variables are defined:
176
+
relevant data. In order to allow for prefetch templates that are dependent upon the particular CDS Service request, prefetch tokens or variables may be defined.
177
+
178
+
Prefetch tokens are delimited by `{{` and `}}` and named based upon the field they correspond to, including any objects they may be nested within.
179
+
180
+
The CDS Hooks specification defines just one prefetch token:
177
181
178
182
|variable|meaning|
179
183
---------|--------
180
-
|`{{Patient.id}}`|The id of the patient in context for this activity (e.g. `123`)|
181
-
|`{{User.id}}`|The type and id of the user for this session (e.g. `Practitioner/123`)|
184
+
|`{{user}}`|The value of the `user` field from this CDS Service request (e.g. `Practitioner/123`)|
185
+
186
+
Individual hooks can define their own prefetch tokens from its hook-specific `context` object. The hook documentation will specify, for each field in the context, whether it can be used as a prefetch token. For instance, given a hook of `example-hook` with the following context in which the `patientId` and `medicationId` fields are both denoted as prefix tokens:
187
+
188
+
```json
189
+
"context": {
190
+
"patientId": "123",
191
+
"medication": {
192
+
"medicationId": "456"
193
+
}
194
+
}
195
+
```
196
+
197
+
The prefetch tokens defined by this `example-hook` would be `{{context.patientId}}` and `{{context.medication.medicationId}}`.
182
198
183
199
An EHR MAY choose to honor some or all of the desired prefetch templates, and is free to choose the most appropriate source for these data. For example:
184
200
@@ -198,9 +214,9 @@ The CDS Service MUST NOT receive any prefetch template key that the EHR chooses
0 commit comments