{
  "resourceType": "StructureDefinition",
  "id": "profile-device",
  "url": "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-device",
  "version": "0.2.1",
  "name": "DeviceProfile",
  "title": "Device Profile (Implantable)",
  "status": "draft",
  "date": "2026-01-09",
  "publisher": "HL7 Canada - FHIR Implementation Work Group",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "https://infocentral.infoway-inforoute.ca/en/collaboration/wg/fhir-implementations"
        }
      ]
    }
  ],
  "description": "Proposed constraints on the Device resource for the minimal set of data to query and retrieve a patient's implantable device.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "urn:iso:std:iso:3166",
          "code": "CA"
        }
      ]
    }
  ],
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    },
    {
      "identity": "udi",
      "uri": "http://fda.gov/UDI",
      "name": "UDI Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Device",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Device",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Device",
        "path": "Device",
        "short": "Device Profile",
        "definition": "The Device Profile is based upon the core FHIR Device Resource",
        "constraint": [
          {
            "key": "ca-device-1",
            "severity": "warning",
            "human": "Implantable medical devices that have UDI information MAY represent this information in either carrierAIDC or carrierHRF.",
            "expression": "udiCarrier.empty() or (udiCarrier.carrierAIDC.exists() or udiCarrier.carrierHRF.exists())",
            "xpath": "not(f:udiCarrier) or (f:carrierHRF or f:carrierAIDC)"
          },
          {
            "key": "ca-device-2",
            "severity": "warning",
            "human": "For implantable medical devices that have UDI information, at least one of the Production Identifiers (UDI-PI) MAY be present.",
            "expression": "udiCarrier.empty() or (manufactureDate.exists() or expirationDate.exists() or lotNumber.exists() or serialNumber.exists() or distinctIdentifier.exists())",
            "xpath": "not(f:udiCarrier) or (f:manufactureDate or f:expirationDate or f:lotNumber or f:serialNumber or f:distinctIdentifier)"
          }
        ]
      },
      {
        "id": "Device.udiCarrier",
        "path": "Device.udiCarrier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Device.udiCarrier.deviceIdentifier",
        "path": "Device.udiCarrier.deviceIdentifier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Device.distinctIdentifier",
        "path": "Device.distinctIdentifier",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Device.expirationDate",
        "path": "Device.expirationDate",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Device.lotNumber",
        "path": "Device.lotNumber",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Device.serialNumber",
        "path": "Device.serialNumber",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Device.type",
        "path": "Device.type",
        "comment": "The device-kind and device-type valueSets used in HL7 are identical. This profile currently mainatins the binding on device-kind because it is currently hosted in THO and is therefor expected to be updated more frequently",
        "min": 1,
        "binding": {
          "strength": "extensible",
          "description": "Codes to identify medical devices",
          "valueSet": "http://terminology.hl7.org/ValueSet/device-kind"
        }
      },
      {
        "id": "Device.patient",
        "path": "Device.patient",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient"
            ]
          }
        ]
      },
      {
        "id": "Device.parent",
        "path": "Device.parent",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-device"
            ]
          }
        ]
      }
    ]
  }
}