Skip to content

Commit 3e7c9ec

Browse files
authored
Merge pull request #625 from cds-hooks/realworld-context-example
don't use patient in context as example
2 parents 9353fcf + 846c903 commit 3e7c9ec

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

docs/specification/current.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -317,54 +317,64 @@ The token name would be `{{context.patientId}}`. Again using our above condition
317317

318318
Only the first level fields in context may be considered for tokens.
319319

320-
For example, given the following context that contains amongst other things, a Patient FHIR resource:
320+
For example, given the following context that contains amongst other things, a MedicationRequest FHIR resource:
321321

322322
```json
323323
{
324324
"context": {
325325
"encounterId": "456",
326-
"patient": {
327-
"resourceType": "Patient",
328-
"id": "123",
329-
"active": true,
330-
"name": [
331-
{
332-
"use": "official",
333-
"family": "Watts",
334-
"given": [
335-
"Wade"
336-
]
326+
"draftOrders": {
327+
"resourceType": "Bundle",
328+
"entry": [ {
329+
"resource": {
330+
"resourceType": "MedicationRequest",
331+
"id": "123",
332+
"status": "draft",
333+
"intent": "order",
334+
"medicationCodeableConcept": {
335+
"coding": [ {
336+
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
337+
"code": "617993",
338+
"display": "Amoxicillin 120 MG/ML / clavulanate potassium 8.58 MG/ML Oral Suspension"
339+
}]},
340+
"subject": {
341+
"reference": "Patient/1288992"
342+
}
343+
}
337344
}
338-
],
339-
"gender": "male",
340-
"birthDate": "2024-08-12"
345+
]
341346
}
342347
}
343348
}
344349
```
345350

346-
Only the `encounterId` field in this example is eligible to be a prefetch token as it is a first level field and the datatype (string) can be placed into the FHIR query. The Patient.id value in the context is not eligible to be a prefetch token because it is not a first level field. If the hook creator intends for the Patient.id value to be available as a prefetch token, it must be made available as a first level field. Using the aforementioned example, we simply add a new `patientId` field:
351+
Only the `encounterId` field in this example is eligible to be a prefetch token as it is a first level field and the datatype (string) can be placed into the FHIR query. The MedicationRequest.id value in the context is not eligible to be a prefetch token because it is not a first level field. If the hook creator intends for the MedicationRequest.id value to be available as a prefetch token, it must be made available as a first level field. Using the aforementioned example, we simply add a new `medicationRequestId` field:
347352

348353
```json
349354
{
350355
"context": {
351-
"patientId": "123",
356+
"medicationRequestId": "123",
352357
"encounterId": "456",
353-
"patient": {
354-
"resourceType": "Patient",
355-
"id": "123",
356-
"active": true,
357-
"name": [
358-
{
359-
"use": "official",
360-
"family": "Watts",
361-
"given": [
362-
"Wade"
363-
]
358+
"draftOrders": {
359+
"resourceType": "Bundle",
360+
"entry": [ {
361+
"resource": {
362+
"resourceType": "MedicationRequest",
363+
"id": "123",
364+
"status": "draft",
365+
"intent": "order",
366+
"medicationCodeableConcept": {
367+
"coding": [ {
368+
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
369+
"code": "617993",
370+
"display": "Amoxicillin 120 MG/ML / clavulanate potassium 8.58 MG/ML Oral Suspension"
371+
}]},
372+
"subject": {
373+
"reference": "Patient/1288992"
374+
}
375+
}
364376
}
365-
],
366-
"gender": "male",
367-
"birthDate": "2024-08-12"
377+
]
368378
}
369379
}
370380
}

0 commit comments

Comments
 (0)