Estelle
10/07/2025, 3:31 PMsimonj
10/08/2025, 2:08 AMthomabig
10/08/2025, 1:54 PMIan Plunkett
10/08/2025, 7:54 PMthomabig
10/09/2025, 12:39 AMthomabig
10/09/2025, 12:40 AMthomabig
10/09/2025, 12:41 AMthomabig
10/10/2025, 9:42 AMthomabig
10/15/2025, 8:16 AMthomabig
10/20/2025, 8:26 AMIan Plunkett
10/20/2025, 6:27 PMIan Plunkett
10/20/2025, 11:16 PMthomabig
10/22/2025, 7:39 AMthomabig
10/30/2025, 4:31 PMIan Plunkett
10/30/2025, 4:34 PMthomabig
10/30/2025, 4:57 PMfinnbergquist
11/03/2025, 11:47 PMthomabig
11/04/2025, 12:50 PM{
"resourceType": "AccessPolicy",
"name": "Practitioner CareTeam Access",
"resource": [
{
"resourceType": "Patient",
"criteria": "Patient?general-practitioner=%profile"
},
{
"resourceType": "Observation",
"criteria": "Observation?subject:Patient.general-practitioner=%profile"
},
{
"resourceType": "DiagnosticReport",
"criteria": "DiagnosticReport?subject:Patient.general-practitioner=%profile"
},
{
"resourceType": "Procedure",
"criteria": "Procedure?subject:Patient.general-practitioner=%profile"
}
]
}
When retrieving Observation, using REST Api, the access policy is correctly implemented, and the practitioner can access all observations of patients that have general-practitioner set as the current Practitioner.
Using GraphQL request, the Access policy is not working, and no observation are retrieved.
My understanding is that there will be a rollback in the REST Api so that chained search will not work anymore on REST requests.
What would you then recommend for us to handle this use case ?thomabig
11/04/2025, 3:34 PMfinnbergquist
11/04/2025, 5:12 PMfinnbergquist
11/04/2025, 5:14 PM$set-accounts
const response = await medplum.post('/fhir/R4/Patient/123/$set-accounts', {
resourceType: 'Parameters',
parameter: [
{
name: 'accounts',
valueReference: {
reference: 'Organization/456',
},
},
{
name: 'accounts',
valueReference: {
reference: 'Practitioner/789',
},
},
{
name: 'propagate',
valueBoolean: true,
},
],
});
and your access policy use _compartment for every different resourceType:
{
"resourceType": "AccessPolicy",
"name": "Managed Service Organization Access Policy with Patient Consent",
"compartment": {
"reference": "%organization"
},
"resource": [
{
"resourceType": "Patient",
"criteria": "Patient?_compartment=%organization&_compartment=%profile"
},
{
"resourceType": "Observation",
"criteria": "Observation?_compartment=%organization&_compartment=%profile"
},
{
"resourceType": "DiagnosticReport",
"criteria": "DiagnosticReport?_compartment=%organization&_compartment=%profile"
},
{
"resourceType": "Encounter",
"criteria": "Encounter?_compartment=%organization&_compartment=%profile"
},
{
"resourceType": "Communication",
"criteria": "Communication?_compartment=%organization&_compartment=%profile"
},
//...
]
}
note: in your case you probably don't need the %organization parameterfinnbergquist
11/04/2025, 5:18 PM$set-accounts and then pass those CareTeams into the AccessPolicy using [parameterized AccessPolicies](https://www.medplum.com/docs/access/access-policies#parameterized-policies)
ex:
{
"resourceType": "ProjectMembership",
//...
"access": [
{
"parameter": [
{
"name": "care_team",
"valueReference": {
"reference": "CareTeam/0195b4a4-0ed7-71ed-80cf-c6fff1e31152"
}
}
],
"policy": {
"reference": "AccessPolicy/0195b4a3-374e-75cf-a6f0-0bcee7c754c5"
}
}
]
}
And then use`_compartment=%care_team` as criteria in your AccessPolicy