Doug DeBold
12/23/2025, 8:28 PM"Subscription suppressed due to mismatched accounts" which when I added { meta: { accounts: [{ reference: 'Patient/:id' }] } } to the provider side Communication creating the messages came through.
All of these Communication records all had the patient as the subject and shared a single base part-of and I'm able to load them via http just fine, so I'm a bit confused as to why this is required to get websocket subscriptions working.
Any guidance on how and when to use meta.accounts would be greatly appreciatedreshma
01/04/2026, 6:38 PM$set-accounts operation with propagate: true to update all resources in the patient compartment:Doug DeBold
01/07/2026, 1:58 AMfinnbergquist
01/07/2026, 8:57 PMDoug DeBold
01/07/2026, 9:43 PM{
"resourceType": "Parameters",
"parameter": [
{
"name": "accounts",
"valueReference": {
"reference": "Patient/<new-patient-id>"
}
},
{
"name": "propagate",
"valueBoolean": true
}
]
}
This feels odd that I need to set the account on the patient to be the patientfinnbergquist
01/07/2026, 11:16 PMmeta.compartment which is a read only fieldfinnbergquist
01/07/2026, 11:17 PMCommunication.meta.compartment, why do you need it in`Communitation.meta.accounts`?finnbergquist
01/07/2026, 11:19 PM$set-accountsDoug DeBold
01/08/2026, 2:03 AM{
"resourceType": "Communication",
"status": "completed",
"subject": {
"reference": "Patient/ade63041-9777-4133-ad33-3b586cb5e76e",
"display": "John Doe"
},
"sender": {
"reference": "Practitioner/019a0d5e-2804-711f-9eb7-1d42f8caacb6",
"display": "Dr. Jane Doe"
},
"recipient": [
{
"reference": "Patient/ade63041-9777-4133-ad33-3b586cb5e76e",
"display": "John Doe"
}
],
"sent": "2025-12-10T19:25:34.445Z",
"partOf": [
{
"reference": "Communication/95e17fe0-22b1-4ec1-9341-703b71f2eb3a"
}
],
"payload": [
{
"contentString": "hello"
}
],
"id": "5224fe58-5204-41e8-8a2b-f82180dedeb9",
"meta": {
"versionId": "39b2565c-2803-43a6-88aa-66f672009df7",
"lastUpdated": "2025-12-30T16:53:03.090Z",
"project": "019a0d56-8f3d-72fa-9436-4e2f8fce4e5c",
"compartment": [
{
"reference": "Project/019a0d56-8f3d-72fa-9436-4e2f8fce4e5c"
},
{
"reference": "Patient/ade63041-9777-4133-ad33-3b586cb5e76e"
}
]
},
"received": "2025-12-30T16:53:02.982Z"
}
As you can see, the compartment is set properly but meta.accounts is missing.
I think my core question is how should I setup/configure my resources such that meta.accounts is automatically populated properly for Communications sent TO a patientfinnbergquist
01/08/2026, 9:36 PMmeta.accounts to your Subscription?Doug DeBold
01/09/2026, 3:09 AMuseSubscription . This is the body of the create subscription request:Doug DeBold
01/09/2026, 3:10 AM{
"resourceType": "Subscription",
"status": "active",
"reason": "WebSocket subscription for Patient/019a6ff3-07ac-73aa-a446-a0c430e32454",
"channel": {
"type": "websocket"
},
"criteria": "Communication?part-of%3Amissing=false&subject=Patient%2F019a6ff3-07ac-73aa-a446-a0c430e32454"
}
and it is being automatically given a meta.accounts of [{reference: "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"}] by the server.
The fix that I have found is that when I create the Communication on the Provider app, I have to add meta.accounts: [{reference: "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"}] in order to get past the accounts comparisonfinnbergquist
01/13/2026, 6:14 PMmeta.accounts of [{reference: "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"}]?
Something like
{
"resourceType": "Subscription",
"status": "active",
"reason": "WebSocket subscription for Patient/019a6ff3-07ac-73aa-a446-a0c430e32454",
"channel": { "type": "websocket" },
"criteria": "Communication?part-of%3Amissing=false&subject=Patient%2F019a6ff3-07ac-73aa-a446-a0c430e32454",
"meta" : {
"accounts" : [{reference: "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"}],
//...
}finnbergquist
01/13/2026, 6:16 PMAccessPolicy.compartment?Doug DeBold
01/16/2026, 1:16 AMmeta.accounts to the patient's own task. Where "owner": { "reference": "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454" }
{
"resourceType": "Subscription",
"status": "active",
"reason": "WebSocket subscription for Patient/019a6ff3-07ac-73aa-a446-a0c430e32454",
"channel": {
"type": "websocket"
},
"criteria": "Task",
"id": "c32b7d30-3d79-402e-9849-9d41f62d7da4",
"meta": {
"versionId": "40dbe113-beff-4176-9c63-ff5d068fefd0",
"lastUpdated": "2026-01-16T01:08:16.418Z",
"author": {
"reference": "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454",
"display": "Doug DeBold"
},
"project": "019a0d56-8f3d-72fa-9436-4e2f8fce4e5c",
"account": {
"reference": "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"
},
"accounts": [
{
"reference": "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"
}
],
"compartment": [
{
"reference": "Project/019a0d56-8f3d-72fa-9436-4e2f8fce4e5c"
},
{
"reference": "Patient/019a6ff3-07ac-73aa-a446-a0c430e32454"
}
]
}
}Doug DeBold
01/16/2026, 1:16 AM{
"resourceType": "AccessPolicy",
"name": "Patient Access Policy (SHARED)",
"id": "0198e7ee-6144-739b-a09b-51a00e3bb11b",
"compartment": {
"reference": "%patient"
},
"resource": [
{
"resourceType": "Patient",
"criteria": "Patient?_compartment=%patient"
},
{
"resourceType": "Task",
"criteria": "Task?owner=%patient"
},
{
"resourceType": "Communication",
"criteria": "Communication?_compartment=%patient"
},
{
"resourceType": "Slot",
"readonly": true
},
{
"resourceType": "Subscription"
}
],
"meta": {
"project": "0198e7e7-a516-72f2-aa38-aa28985be53c",
"compartment": [
{
"reference": "Project/0198e7e7-a516-72f2-aa38-aa28985be53c"
}
],
"versionId": "93dc77a6-6aea-468e-b682-388908cb223d",
"lastUpdated": "2025-12-29T15:02:13.881Z",
"author": {
"reference": "Practitioner/abee1f77-4cd2-469d-94f8-90ab4d76eaca",
"display": "Omar Alkhadori"
}
}
}Doug DeBold
01/16/2026, 1:17 AMDoug DeBold
01/16/2026, 3:50 PMDoug DeBold
01/16/2026, 4:17 PMfinnbergquist
01/16/2026, 5:57 PM"compartment": {
"reference": "%patient"
}
If you are able to remove that, then you won't have this issue, because the Subscription will not have the Patient reference in it's meta.accounts.finnbergquist
01/16/2026, 5:58 PM{
"resourceType": "Patient",
"criteria": "Patient?_compartment=%patient"
},
{
"resourceType": "Task",
"criteria": "Task?owner=%patient"
},
{
"resourceType": "Communication",
"criteria": "Communication?_compartment=%patient"
},finnbergquist
01/16/2026, 6:00 PMmeta.compartment will automatically include the patient reference, without needing to include the Patient reference in ``AccessPolicy.compartment`
https://cdn.discordapp.com/attachments/1453122034870521902/1461782183197933589/Screenshot_2026-01-16_at_9.59.17_AM.png?ex=697c48ff&is=697af77f&hm=7b160470721217117efa65ec0d99ced31f6998b7d9524340fc78f70e653fbdee&finnbergquist
01/16/2026, 6:44 PM"compartment": {
"reference": "%patient"
}
so apologies for any confusion this may have causedDoug DeBold
01/19/2026, 5:53 PMcriteria: 'Task' and I have the access policy above, is there any risk that the subscription would return Tasks that are outside of the scope of the access policy?Doug DeBold
01/19/2026, 5:53 PMfinnbergquist
01/19/2026, 5:57 PMfinnbergquist
01/19/2026, 5:58 PMDoug DeBold
01/19/2026, 6:00 PMDoug DeBold
01/19/2026, 6:02 PMfinnbergquist
01/19/2026, 6:03 PMfinnbergquist
01/19/2026, 6:07 PMAccessPolicy.compartment, any resource created by that User will have that reference added to it's meta.account and meta.compartmentfinnbergquist
01/19/2026, 6:09 PMmeta.compartment, even if AccessPolicy.compartment is not set.Doug DeBold
01/19/2026, 6:10 PMfinnbergquist
01/19/2026, 6:10 PMcriteria": "Communication?_compartment=%patient will still workDoug DeBold
01/19/2026, 6:15 PMTask.owner coupled with { "resourceType": "Task", "criteria": "Task?owner=%patient" } because we need to differentiate tasks between those that are for a Practitioner and about a patient from those that are actually assigned for a patient to complete. This is working but 1) do you see any AuthZ concerns with that 2) is there a better way?finnbergquist
01/20/2026, 7:26 PMTask.for reference field (but Task.owner still points to the Practitioner). Semantically, Task.for is for the
Beneficiary of the Task
The entity who benefits from the performance of the service specified in the task (e.g., the patient).
And your Tasks that are assigned to the Patient have the Patient linked in the Task.owner field.
If you can distinguish between these different types with distinct Tasks data modeling, you should have no concerns about AuthZ