Skip to content

Commit b437b01

Browse files
brynrhodeskpshek
authored andcommitted
#232: Move "user" from the request to each individual hook (#425)
* #232: Removed "user" from the request and added it to each of the defined hooks as "userId". Updated relevant examples, yaml, and removed the "user" prefetch token defined by the spec. * Incorporated changes from #220 Fixes #232 Fixes #307
1 parent 5f69991 commit b437b01

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

docs/hooks/medication-prescribe.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The set of medications proposed or in progress of being prescribed. All FHIR res
1515

1616
Field | Optionality | Prefetch Token | Type | Description
1717
----- | -------- | ---- | ---- | ----
18+
`userId` | REQUIRED | Yes | *string* | The id of the current user.<br />For this hook, the user is expected to be of type [Practitioner](https://www.hl7.org/fhir/practitioner.html).<br />For example, `Practitioner/123`
1819
`patientId` | REQUIRED | Yes | *string* | The FHIR `Patient.id` of the current patient in context
1920
`encounterId` | OPTIONAL | Yes | *string* | The FHIR `Encounter.id` of the current encounter in context
2021
`medications` | REQUIRED | No | *object* | DSTU2 - FHIR Bundle of _draft_ MedicationOrder resources <br/> STU3 - FHIR Bundle of _draft_ MedicationRequest resources
@@ -24,6 +25,7 @@ Field | Optionality | Prefetch Token | Type | Description
2425
```json
2526
{
2627
"context":{
28+
"userId":"Practitioner/123",
2729
"patientId":"1288992",
2830
"encounterId":"89284",
2931
"medications":{
@@ -168,6 +170,7 @@ Field | Optionality | Prefetch Token | Type | Description
168170
```json
169171
{
170172
"context":{
173+
"userId":"Practitioner/123",
171174
"patientId":"1288992",
172175
"encounterId":"89284",
173176
"medications":{

docs/hooks/order-review.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The set of orders being reviewed for signature on-screen. All FHIR resources in
1515

1616
Field | Optionality | Prefetch Token | Type | Description
1717
----- | -------- | ---- | ---- | ----
18+
`userId` | REQUIRED | Yes | *string* | The id of the current user.<br />For this hook, the user is expected to be of type [Practitioner](https://www.hl7.org/fhir/practitioner.html).<br />For example, `Practitioner/123`
1819
`patientId` | REQUIRED | Yes | *string* | The FHIR `Patient.id` of the current patient in context
1920
`encounterId` | OPTIONAL | Yes | *string* | The FHIR `Encounter.id` of the current encounter in context
2021
`orders` | REQUIRED | No | *object* | DSTU2 - FHIR Bundle of MedicationOrder, DiagnosticOrder, DeviceUseRequest, ReferralRequest, ProcedureRequest, NutritionOrder, VisionPrescription with _draft_ status <br/> STU3 - FHIR Bundle of MedicationRequest, ReferralRequest, ProcedureRequest, NutritionOrder, VisionPrescription with _draft_ status
@@ -24,6 +25,7 @@ Field | Optionality | Prefetch Token | Type | Description
2425
```json
2526
{
2627
"context":{
28+
"userId":"Practitioner/123",
2729
"patientId":"1288992",
2830
"encounterId":"89284",
2931
"orders":{
@@ -202,6 +204,7 @@ Field | Optionality | Prefetch Token | Type | Description
202204

203205
```json
204206
"context":{
207+
"userId":"Practitioner/123",
205208
"patientId":"1288992",
206209
"encounterId":"89284",
207210
"orders":{

docs/hooks/patient-view.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@ The patient whose record was opened, including their encounter, if applicable.
1515

1616
Field | Optionality | Prefetch Token | Type | Description
1717
----- | -------- | ---- | ---- | ----
18+
`userId` | REQUIRED | Yes | *string* | The id of the current user.<br />For example, if the user represents a FHIR resource on the given FHIR server, the resource type would be one of [Practitioner](https://www.hl7.org/fhir/practitioner.html), [Patient](https://www.hl7.org/fhir/patient.html), or [RelatedPerson](https://www.hl7.org/fhir/relatedperson.html).<br />If the user was a Practitioner, this value would be `Practitioner/123`
1819
`patientId` | REQUIRED | Yes | *string* | The FHIR `Patient.id` of the current patient in context
1920
`encounterId` | OPTIONAL | Yes | *string* | The FHIR `Encounter.id` of the current encounter in context
2021

2122
### Examples
2223

2324
```json
2425
"context":{
26+
"userId" : "Practitioner/123",
2527
"patientId" : "1288992"
2628
}
2729
```
2830

2931
```json
3032
"context":{
33+
"userId" : "Practitioner/123",
3134
"patientId" : "1288992",
3235
"encounterId" : "456"
3336
}

docs/specification/1.0-api.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,10 @@ definitions:
106106
fhirServer:
107107
type: string
108108
format: url
109-
oauth:
109+
fhirAuthorization:
110110
type: object
111-
user:
112-
type: string
113-
patient:
114-
type: string
115-
encounter:
116-
type: string
117111
context:
118-
type: array
119-
items:
120-
type: object
112+
type: object
121113
prefetch:
122114
type: object
123115

docs/specification/1.0.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ Field | Optionality | Type | Description
111111
<nobr>`hookInstance`</nobr> | REQUIRED | *string* | A UUID for this particular hook call (see more information below).
112112
`fhirServer` | OPTIONAL | *URL* | The base URL EHR's [FHIR](https://www.hl7.org/fhir/) server. If fhirAuthorization is provided, this field is REQUIRED. The scheme should be `https`
113113
`fhirAuthorization` | OPTIONAL | *object* | A structure holding an [OAuth 2.0][OAuth 2.0] bearer access token granting the CDS Service access to FHIR resources, along with supplemental information relating to the token. See the [FHIR Resource Access](#fhir-resource-access) section for more information.
114-
`user` | REQUIRED | *string* | The id of the current user.<br />For example, if the user represents a FHIR resource on the given FHIR server, the resource type would be one of [Practitioner](https://www.hl7.org/fhir/practitioner.html), [Patient](https://www.hl7.org/fhir/patient.html), or [RelatedPerson](https://www.hl7.org/fhir/relatedperson.html).<br />If the user was a Practitioner, this value would be `Practitioner/123`
115114
`context` | REQUIRED | *object* | Hook-specific contextual data that the CDS service will need.<br />For example, with the `patient-view` hook this will include the FHIR identifier of the [Patient](https://www.hl7.org/fhir/patient.html) being viewed. For details, see the Hooks specification page.
116115
`prefetch` | OPTIONAL | *object* | The FHIR data that was prefetched by the EHR (see more information below).
117116

@@ -143,8 +142,8 @@ curl
143142
"scope" : "patient/Patient.read patient/Observation.read",
144143
"subject" : "cds-service4"
145144
},
146-
"user" : "Practitioner/example",
147145
"context" : {
146+
"userId" : "Practitioner/example",
148147
"patientId" : "1288992",
149148
"encounterId" : "89284"
150149
},
@@ -178,12 +177,6 @@ relevant data. In order to allow for prefetch templates that are dependent upon
178177

179178
Prefetch tokens MUST be delimited by `{{` and `}}`, MUST be named based upon the field they correspond to, and MUST have a primitive value.
180179

181-
The CDS Hooks specification defines just one prefetch token:
182-
183-
|Variable|Meaning|
184-
---------|--------
185-
|`{{user}}`|The value of the `user` field from this CDS Service request (e.g. `Practitioner/123`).|
186-
187180
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.
188181

189182
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:
@@ -224,7 +217,7 @@ The CDS Service MUST NOT receive any prefetch template key that the EHR chooses
224217
"prefetch": {
225218
"p": "Patient/{{context.patientId}}",
226219
"a1c": "Observation?patient={{context.patientId}}&code=4548-4&_count=1&sort:desc=date",
227-
"u": "Practitioner/{{user}}"
220+
"u": "Practitioner/{{context.userId}}"
228221
}
229222
}
230223
```
@@ -588,7 +581,9 @@ For example, an extension on a request could look like this:
588581
"hookInstance" : "d1577c69-dfbe-44ad-ba6d-3e05e953b2ea",
589582
"fhirServer" : "http://fhir.example.org:9080",
590583
"hook" : "patient-view",
591-
"user" : "Practitioner/example",
584+
"context" : {
585+
"userId" : "Practitioner/example"
586+
},
592587
"extension" : {
593588
"com.example.timestamp": "2017-11-27T22:13:25Z",
594589
"myextension-practitionerspecialty" : "gastroenterology"

0 commit comments

Comments
 (0)