{
  "resourceType": "StructureDefinition",
  "id": "sgrdv-base-book-source-device",
  "url": "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-source-device",
  "name": "SGRDVBaseBookSourceDevice",
  "title": "Système source SGRDV pour $book (Base)",
  "status": "draft",
  "experimental": true,
  "description": "Spécialisation du Device source pour les demandes de réservation. Embarque la tuile du portail REO via Device.property[tuilePortail] et le lieu Clinique d'origine via Device.owner (logical reference vers Organization).",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Device",
  "baseDefinition": "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-source-system-device",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Device",
        "path": "Device",
        "constraint": [
          {
            "key": "sgrdv-book-device-portail-identifier",
            "severity": "error",
            "human": "Le Device source d'une demande $book doit porter au moins un identifiant émis par le portail RVSQ Réo ou par Votre santé.",
            "expression": "identifier.where(system = 'http://sante.quebec/fhir/NamingSystem/RVSQREO' or system = 'http://sante.quebec/fhir/NamingSystem/VOTRESANTE').exists()",
            "source": "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-source-device"
          }
        ]
      },
      {
        "id": "Device.identifier",
        "path": "Device.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Device.identifier:reo",
        "path": "Device.identifier",
        "sliceName": "reo",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Device.identifier:reo.system",
        "path": "Device.identifier.system",
        "min": 1,
        "fixedUri": "http://sante.quebec/fhir/NamingSystem/RVSQREO"
      },
      {
        "id": "Device.identifier:votresante",
        "path": "Device.identifier",
        "sliceName": "votresante",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Device.identifier:votresante.system",
        "path": "Device.identifier.system",
        "min": 1,
        "fixedUri": "http://sante.quebec/fhir/NamingSystem/VOTRESANTE"
      },
      {
        "id": "Device.property",
        "path": "Device.property",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "type"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Device.property:tuilePortail",
        "path": "Device.property",
        "sliceName": "tuilePortail",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Device.property:tuilePortail.type",
        "path": "Device.property.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "tuilePortail",
              "system": "http://sante.quebec/fhir/CodeSystem/sgrdv-device-property-type"
            }
          ]
        }
      },
      {
        "id": "Device.property:tuilePortail.valueCode",
        "path": "Device.property.valueCode",
        "min": 1,
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://sante.quebec/fhir/ValueSet/sgrdv-tuile-portail-reo-vs"
        }
      },
      {
        "id": "Device.property:tuilePortail.valueCode.coding",
        "path": "Device.property.valueCode.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Device.property:tuilePortail.valueCode.coding.system",
        "path": "Device.property.valueCode.coding.system",
        "fixedUri": "http://sante.quebec/fhir/CodeSystem/sgrdv-tuile-portail-reo"
      },
      {
        "id": "Device.property:tuilePortail.valueCode.coding.code",
        "path": "Device.property.valueCode.coding.code",
        "mustSupport": true
      },
      {
        "id": "Device.owner",
        "path": "Device.owner",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-find-organization"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Device.owner.reference",
        "path": "Device.owner.reference",
        "max": "0"
      },
      {
        "id": "Device.owner.type",
        "path": "Device.owner.type",
        "fixedUri": "Organization"
      },
      {
        "id": "Device.owner.identifier",
        "path": "Device.owner.identifier",
        "min": 1
      },
      {
        "id": "Device.owner.identifier.type",
        "path": "Device.owner.identifier.type",
        "min": 1
      },
      {
        "id": "Device.owner.identifier.type.coding",
        "path": "Device.owner.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Device.owner.identifier.type.coding.system",
        "path": "Device.owner.identifier.type.coding.system",
        "fixedUri": "http://sante.quebec/fhir/CodeSystem/sgrdv-identifier-type"
      },
      {
        "id": "Device.owner.identifier.type.coding.code",
        "path": "Device.owner.identifier.type.coding.code",
        "fixedCode": "CodeEtablissement"
      },
      {
        "id": "Device.owner.identifier.system",
        "path": "Device.owner.identifier.system",
        "min": 1
      },
      {
        "id": "Device.owner.identifier.value",
        "path": "Device.owner.identifier.value",
        "min": 1
      }
    ]
  }
}