{
  "resourceType": "StructureDefinition",
  "id": "sgrdv-base-book-request-provenance",
  "url": "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-request-provenance",
  "name": "SGRDVBaseBookRequestProvenance",
  "title": "Provenance de la demande de réservation (Base)",
  "status": "draft",
  "experimental": true,
  "description": "Provenance de la demande $book. Multi-agents : le portail source (toujours présent, porte la tuile REO et le lieu Clinique d'origine via Device.owner) et l'agent de réorientation REO (cas de réorientation : l'organisation d'origine — clinique, installation hospitalière ou établissement (CIUSSS/CISSS) — est portée par agent[professionnelREO].onBehalfOf, en logical reference vers une ressource Organization — jamais matérialisée dans le payload). La région administrative du Québec (codes 01 à 17) est portée par Provenance.location en logical reference vers une Location identifiée par son code de région. Règle métier : la région administrative DOIT être fournie lorsque la tuile du portail (Device.property[tuilePortail].valueCode) est `811`, `911` ou `MAGROSSESSE` ; pour les autres tuiles, elle reste optionnelle.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Provenance",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Provenance",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Provenance.contained",
        "path": "Provenance.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Provenance.contained:portail",
        "path": "Provenance.contained",
        "sliceName": "portail",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Device",
            "profile": [
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-source-device"
            ]
          }
        ]
      },
      {
        "id": "Provenance.contained:orienteur",
        "path": "Provenance.contained",
        "sliceName": "orienteur",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "RelatedPerson",
            "profile": [
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-orienteur-related-person"
            ]
          }
        ]
      },
      {
        "id": "Provenance.target",
        "path": "Provenance.target",
        "mustSupport": true
      },
      {
        "id": "Provenance.recorded",
        "path": "Provenance.recorded",
        "mustSupport": true
      },
      {
        "id": "Provenance.location",
        "path": "Provenance.location",
        "mustSupport": true
      },
      {
        "id": "Provenance.location.reference",
        "path": "Provenance.location.reference",
        "max": "0"
      },
      {
        "id": "Provenance.location.type",
        "path": "Provenance.location.type",
        "fixedUri": "Location"
      },
      {
        "id": "Provenance.location.identifier",
        "path": "Provenance.location.identifier",
        "min": 1
      },
      {
        "id": "Provenance.location.identifier.type",
        "path": "Provenance.location.identifier.type",
        "min": 1
      },
      {
        "id": "Provenance.location.identifier.type.coding",
        "path": "Provenance.location.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.location.identifier.type.coding.system",
        "path": "Provenance.location.identifier.type.coding.system",
        "fixedUri": "http://sante.quebec/fhir/CodeSystem/sgrdv-identifier-type"
      },
      {
        "id": "Provenance.location.identifier.type.coding.code",
        "path": "Provenance.location.identifier.type.coding.code",
        "fixedCode": "regionAdmin"
      },
      {
        "id": "Provenance.location.identifier.system",
        "path": "Provenance.location.identifier.system",
        "fixedUri": "http://sante.quebec/fhir/NamingSystem/REGIONADMIN"
      },
      {
        "id": "Provenance.location.identifier.value",
        "path": "Provenance.location.identifier.value",
        "min": 1
      },
      {
        "id": "Provenance.agent",
        "path": "Provenance.agent",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "who.type"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Provenance.agent:portail",
        "path": "Provenance.agent",
        "sliceName": "portail",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Provenance.agent:portail.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-source-device"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Provenance.agent:portail.who.reference",
        "path": "Provenance.agent.who.reference",
        "fixedString": "#portail"
      },
      {
        "id": "Provenance.agent:portail.who.type",
        "path": "Provenance.agent.who.type",
        "min": 1,
        "fixedUri": "Device"
      },
      {
        "id": "Provenance.agent:professionnelREO",
        "path": "Provenance.agent",
        "sliceName": "professionnelREO",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Provenance.agent:professionnelREO.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-orienteur-related-person"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Provenance.agent:professionnelREO.who.reference",
        "path": "Provenance.agent.who.reference",
        "fixedString": "#orienteur"
      },
      {
        "id": "Provenance.agent:professionnelREO.who.type",
        "path": "Provenance.agent.who.type",
        "min": 1,
        "fixedUri": "RelatedPerson"
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf",
        "path": "Provenance.agent.onBehalfOf",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-find-organization",
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-organization-installation",
              "http://sante.quebec/fhir/StructureDefinition/sgrdv-base-book-organization-etablissement"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.reference",
        "path": "Provenance.agent.onBehalfOf.reference",
        "max": "0"
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.type",
        "path": "Provenance.agent.onBehalfOf.type",
        "fixedUri": "Organization"
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier",
        "path": "Provenance.agent.onBehalfOf.identifier",
        "min": 1
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier.type",
        "path": "Provenance.agent.onBehalfOf.identifier.type",
        "min": 1
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier.type.coding",
        "path": "Provenance.agent.onBehalfOf.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier.type.coding.system",
        "path": "Provenance.agent.onBehalfOf.identifier.type.coding.system",
        "fixedUri": "http://sante.quebec/fhir/CodeSystem/sgrdv-identifier-type"
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier.type.coding.code",
        "path": "Provenance.agent.onBehalfOf.identifier.type.coding.code",
        "min": 1
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier.system",
        "path": "Provenance.agent.onBehalfOf.identifier.system",
        "min": 1
      },
      {
        "id": "Provenance.agent:professionnelREO.onBehalfOf.identifier.value",
        "path": "Provenance.agent.onBehalfOf.identifier.value",
        "min": 1
      }
    ]
  }
}