Outside Systems (CA:FeX)
An outside system, such as another organization's EMR acting as a CA:FeX Data Consumer, can ask OpenOrchid for one
patient's chart at a time. OpenOrchid answers as a CA:FeX 2.2.0 Data Responder, options C and D, and says so in its
capability statement (GET /fhir/R4/metadata).
| Option | Requests |
|---|---|
| C | GET Patient/[id], GET Patient?_id=[id], GET Patient?identifier=[system]|[health card number], GET [type]?patient=[id] |
| D | GET Patient/[id]/$summary (see Patient $summary in PS-CA) |
Letting a system in
The project administrator sets it up, following OpenOrchid Core rule ACC-4:
- Create a ClientApplication for the system with
statusoff, and ajwksUrifor its public keys. Turn it on when the exchange is agreed; turn it off to cut it off. The system signs in with SMART Backend Services (client credentials with a signed JWT). Do not give it the client secret. - Give its ProjectMembership an AccessPolicy that allows only
readandsearch, on only the resource types the exchange needs, and that carries the one-patient extension. Name the types rather than*, so the policy limits the system even where the extension does not reach:
{
"resourceType": "AccessPolicy",
"name": "Outside system",
"extension": [{ "url": "https://openorchid.ca/fhir/StructureDefinition/one-patient-per-request", "valueBoolean": true }],
"resource": [
{ "resourceType": "Patient", "interaction": ["read", "search"] },
{ "resourceType": "Organization", "interaction": ["read", "search"] },
{ "resourceType": "Account", "interaction": ["read", "search"] },
{ "resourceType": "AllergyIntolerance", "interaction": ["read", "search"] },
{ "resourceType": "CarePlan", "interaction": ["read", "search"] },
{ "resourceType": "ClinicalImpression", "interaction": ["read", "search"] },
{ "resourceType": "Condition", "interaction": ["read", "search"] },
{ "resourceType": "Coverage", "interaction": ["read", "search"] },
{ "resourceType": "DeviceUseStatement", "interaction": ["read", "search"] },
{ "resourceType": "DiagnosticReport", "interaction": ["read", "search"] },
{ "resourceType": "Encounter", "interaction": ["read", "search"] },
{ "resourceType": "Goal", "interaction": ["read", "search"] },
{ "resourceType": "Immunization", "interaction": ["read", "search"] },
{ "resourceType": "MedicationRequest", "interaction": ["read", "search"] },
{ "resourceType": "MedicationStatement", "interaction": ["read", "search"] },
{ "resourceType": "Observation", "interaction": ["read", "search"] },
{ "resourceType": "Procedure", "interaction": ["read", "search"] },
{ "resourceType": "RelatedPerson", "interaction": ["read", "search"] },
{ "resourceType": "ServiceRequest", "interaction": ["read", "search"] }
]
}
$summary needs every type in this list except MedicationStatement, which it adds when allowed. A policy that lists
fewer types can still use the option C searches.
What the one-patient extension does
With the extension, every request must name exactly one patient. The server allows:
GET Patient/[id]andGET Patient/[id]/$summary;GET Patient?_id=[id]andGET Patient?identifier=[system]|[value], with both a system and a value;GET [type]?patient=[Patient/][id]orGET [type]?subject=Patient/[id].
A search may add criteria that narrow it, and _count, _offset, _cursor, _sort, _total, _elements,
_summary and _format. Everything else is refused with 403 Forbidden, including:
- searches that name no patient, or several;
_include,_revincludeand_filter;- reads of other records by id, history,
$everythingand other operations; - batches, GraphQL and bulk export;
POST, and so every write;- every route outside the FHIR API, such as DICOMweb,
Binaryand the account API.
The server checks the URL exactly as it receives it. A path with . or .. segments, a backslash or
percent-encoding, a base other than /fhir/R4 in that case, or a $ in the query string is refused.
The system cannot name the summary's author: the patient's managing organization is the author. Give every patient
a managingOrganization. Without one, the server falls back to the system's own ClientApplication as the author,
which the policy above does not allow, so the summary is refused.