Stream: smart
Topic: Accessing Patient related resources via Practitioner's Role
Volkan Kalın (Jan 19 2022 at 15:53):
Hello everyone,
I am currently implementing an app on top of ibm/fhir. In one of my scenarios there are Practitioner users. And a Practitioner:
- Can create an
Organization
and connect itsPractitioner
resource to thisOrganization
viaPractitionerRole
. - Can also include other
Practitioner
s to theOrganization
viaPractitionerRole
. - Can create new
Patient
s under theOrganization
by providingmanagingOrganization
element to it. - Has read/write access to the
Observation
records of aPatient
who is under his/herOrganization
.
So an example scenario is:
There are following resources:
{
resourceType: 'Organization',
id: 'Organization1',
//...
}
{
resourceType: 'Practitioner',
id: 'Practitioner1',
//...
}
{
resourceType: 'PractitionerRole',
active: true,
practitioner: {
reference: 'Practitioner/Practitioner1'
},
organization: {
reference: 'Organization/Organization1'
},
code: [{
coding: [{
system: 'http://terminology.hl7.org/CodeSystem/practitioner-role',
code: 'doctor'
}]
}]
//...
}
{
resourceType: 'Patient',
id: 'Patient1',
managingOrganization: {
reference: 'Organization/Organization1'
},
//...
}
{
resourceType: 'Observation',
id: 'Observation1',
subject: {
reference: 'Patient/Patient1'
},
//...
}
Now lets say a Practitioner
wants to get all Observation
s belongs to the Patient
s that are under the Organization
of this Practitioner
.
In another saying Practitioner
reads all Observation
s by using the chain: Practitioner -> PractitionerRole -> Organization -> Patient -> Observation
- To get Organization we use endpoint:
/Organization?_has:PractitionerRole:organization:practitioner=Practitioner/{practitioner_id}
- So by taking the organization Id from the Organization, I will get all the Patients's ids by using endpoint
Patient?organization=Organization/{organization.id}&_elements=id
- By using all the Patient Ids, I will get all the Observations belongs to those Patients
So for this scenerio I have encountered 2 limitations so far:
- Fhir-smart implementation forces to use a claim
patient_id
inaccess_token
, but instead, what I want is to providepractitioner_id
(related line of code) - I couldn't find any logic on
fhir-smart
module's interceptor which considers the relation between a Compartment and resource (additional example to the scenario above can be: Practitioner ↔ Encounter ↔ Patient).
My questions are:
- How much of those limitations I encountered are resulted from the specification itself or due to lack of implementation?
- Is it possible to configure policy enforcement via fhir resources (e.g.
Encounter
,Organization
andPractitionerRole
) while using SMART specifications? - Does this scenerio make sense at all under the specification of SMART on FHIR specification?
Lee Surprenant (Jan 21 2022 at 16:38):
Hi Vokan. the spec stops well short of defining a permissions model (which practitioners should have access to which resources). as you pointed out, the IBM FHIR server fhir-smart module uses a patient_id claim on the access token to restrict access to resources related to the patient compartment for one or more patient. This is an internal detail of our implementation...the spec itself does not impose any restrictions on the access token...it is "opaque".
Last updated: Apr 12 2022 at 19:14 UTC