On this page

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).

OptionRequests
CGET Patient/[id], GET Patient?_id=[id], GET Patient?identifier=[system]|[health card number], GET [type]?patient=[id]
DGET 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:

  1. Create a ClientApplication for the system with status off, and a jwksUri for 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.
  2. Give its ProjectMembership an AccessPolicy that allows only read and search, 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] and GET Patient/[id]/$summary;
  • GET Patient?_id=[id] and GET Patient?identifier=[system]|[value], with both a system and a value;
  • GET [type]?patient=[Patient/][id] or GET [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, _revinclude and _filter;
  • reads of other records by id, history, $everything and other operations;
  • batches, GraphQL and bulk export;
  • POST, and so every write;
  • every route outside the FHIR API, such as DICOMweb, Binary and 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.