On this page

Canadian Profiles

Canadian Profiles​

A profile is a set of rules a resource must follow, such as "a Patient's MRN must name the system that issued it". OpenOrchid holds the CA Core+, PS-CA and CA:FeX profiles, and checks your writes against them.

Where the profiles are​

The profiles, and the value sets and extensions they use, are kept in one shared project on the server. Your project is linked to it, so you can read them but not change them, and every project on the server uses the same copy.

To see one, search by its URL:

curl 'https://api.openorchid.ca/fhir/R4/StructureDefinition?url=http://fhir.infoway-inforoute.ca/cacore/StructureDefinition/patient-ca-core&_elements=url,version,name' \
  -H "Authorization: Bearer $ACCESS_TOKEN"

The version of a profile is its own version, which is not always the package's: patient-ca-core in CA Core+ 1.2.1-dft is version 1.1.0.

What your project is set up with​

A project for Canadian data is set up by the server's operator with:

  • the link to the shared project;
  • a default profile for 22 resource types, one CA Core+ profile each. A write that names no profile in meta.profile is given the default and checked against it. See Profiles for how meta.profile works;
  • strict mode, so a resource that breaks the base FHIR rules or one of its profiles is refused, not just logged;
  • transaction bundles, so a transaction with one wrong entry is refused whole rather than half kept.

A project admin can change the default profiles, but not the link or the other settings.

How a write is checked​

A resource is checked against every profile in its meta.profile, and refused if it breaks one. The check covers which elements must be present, how many of each, their types, fixed values, and slices: the named parts of a list, such as the MRN among a patient's identifiers, and the values inside them.

For example, CA Core+ says a Patient identifier typed as an MRN (MR) must have a system and a value. This one has no system:

curl -X POST 'https://api.openorchid.ca/fhir/R4/Patient' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/fhir+json' \
  -d '{
    "resourceType": "Patient",
    "identifier": [
      {
        "type": { "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR" }] },
        "value": "00012345"
      }
    ],
    "name": [{ "family": "Roy", "given": ["Léa"] }],
    "birthDate": "1980-02-03"
  }'

The server refuses it with 400 Bad Request:

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "structure",
      "details": { "text": "Invalid number of values in slice 'MRN': expected 1..1, but found 0" },
      "expression": ["Patient.identifier[0].system"]
    }
  ]
}

With "system": "https://your-clinic.example.ca/mrn" added to the identifier, the same request is accepted.

A resource can also name a PS-CA profile in meta.profile, and it is checked against that one too.

Profiles a project cannot turn off​

The default profiles help, but an app can name another profile and an admin can remove them. A server operator can also require profiles for a resource type with the server setting requiredProfiles. Every write of that type, in every project, must then pass at least one of the profiles listed for it, whatever meta.profile says, and no project can change that. Writes the server makes itself are not checked. With requiredProfiles set, a resource that names in meta.profile a profile the server cannot find is also refused; without it, that profile is skipped.

What is not checked here​

Codes are a separate check: see Canadian Code Systems. The profile check makes sure a code is present and well formed where a profile requires one, not that it is a real code.