{
  "resourceType": "StructureDefinition",
  "id": "sgp-referral-audit-events",
  "url": "http://fhir.cezih.hr/specifikacije/StructureDefinition/sgp-referral-audit-events",
  "version": "0.1",
  "name": "SGPReferralAuditEvent",
  "title": "SGP Referral Audit Event",
  "status": "active",
  "experimental": false,
  "description": "Specifikacija strukture revizijskog zapisa usluge uupućivanja pacijenata na specijalno gensko profiliranje.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "AuditEvent",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/AuditEvent",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "AuditEvent",
        "path": "AuditEvent",
        "constraint": [
          {
            "key": "SGP-1",
            "severity": "error",
            "human": "Vrsta revizijskog zapisa mora odgovarati podvrsti",
            "expression": "iif(subtype.code='3.2' or subtype.code='3.3' or subtype.code='3.4' or subtype.code='3.5' or subtype.code='3.6' or subtype.code='3.12', type.code='amend', true) and iif(subtype.code='3.1', type.code='originate', true) and iif(subtype.code='3.7' or subtype.code='3.8' or subtype.code='3.9' or subtype.code='3.10' or subtype.code='3.13', type.code='destroy', true) and iif(subtype.code='3.11', type.code='access', true)"
          }
        ]
      },
      {
        "id": "AuditEvent.type",
        "path": "AuditEvent.type",
        "short": "Vrsta revizijskog zapisa",
        "binding": {
          "strength": "required"
        }
      },
      {
        "id": "AuditEvent.subtype",
        "path": "AuditEvent.subtype",
        "short": "Podvrsta revizijskog zapisa",
        "definition": "Podvrsta revizijskog zapisa je jednaka vrsti poruke koja je poslana usluzi upravljanja SGP uputnicom",
        "min": 1,
        "max": "1",
        "mustSupport": false,
        "binding": {
          "strength": "required",
          "valueSet": "http://fhir.cezih.hr/specifikacije/ValueSet/specialist-referral-message-types"
        }
      },
      {
        "id": "AuditEvent.action",
        "path": "AuditEvent.action",
        "min": 1,
        "mustSupport": false,
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/ValueSet/audit-event-action"
        }
      },
      {
        "id": "AuditEvent.recorded",
        "path": "AuditEvent.recorded",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.outcome",
        "path": "AuditEvent.outcome",
        "short": "Informacija da li je zahtjev za koji se sprema revizijski zapis uspješno odrađen ili ne",
        "min": 1,
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent",
        "path": "AuditEvent.agent",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "AuditEvent.agent:source",
        "path": "AuditEvent.agent",
        "sliceName": "source",
        "short": "SGP Referral Client information",
        "max": "1",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:source.type",
        "path": "AuditEvent.agent.type",
        "min": 1,
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://dicom.nema.org/resources/ontology/DCM",
              "code": "110153",
              "display": "Source Role ID"
            }
          ]
        },
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:source.who",
        "path": "AuditEvent.agent.who",
        "short": "Identifikator autenticiranog korisnika (JWT token). Može biti krajnji korisnik (Zdravstveni djelatnik) ili Informacijski sustav",
        "min": 1,
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:source.who.reference",
        "path": "AuditEvent.agent.who.reference",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:source.who.type",
        "path": "AuditEvent.agent.who.type",
        "short": "Upisuje se samo u slučaju krajnjeg korisnika (zdravstveni djelatnik ili pacijent) u slučaju informacijskog sustava se ne upisuje",
        "constraint": [
          {
            "key": "ENC-2",
            "severity": "error",
            "human": "Tip može biti samo zdravstveni djelatnik (Practitioner) ili pacijent (Patient)",
            "expression": "iif($this='Patient' or $this='Practitioner', true, false)"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:source.who.identifier",
        "path": "AuditEvent.agent.who.identifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:source.requestor",
        "path": "AuditEvent.agent.requestor",
        "fixedBoolean": true,
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:source.network",
        "path": "AuditEvent.agent.network",
        "min": 1,
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:source.network.address",
        "path": "AuditEvent.agent.network.address",
        "short": "Identifikator aplikacije/servisa ili IP adresa vanjskog sustava",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:source.network.type",
        "path": "AuditEvent.agent.network.type",
        "short": "“5\" (URI) or \"2\" (IP address)",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:destination",
        "path": "AuditEvent.agent",
        "sliceName": "destination",
        "short": "SGP Referral Service information",
        "max": "1",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:destination.type",
        "path": "AuditEvent.agent.type",
        "min": 1,
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://dicom.nema.org/resources/ontology/DCM",
              "code": "110152",
              "display": "Destination Role ID"
            }
          ]
        },
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:destination.who",
        "path": "AuditEvent.agent.who",
        "short": "ID usluge SGP uputnice",
        "min": 1,
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:destination.who.reference",
        "path": "AuditEvent.agent.who.reference",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:destination.who.identifier",
        "path": "AuditEvent.agent.who.identifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:destination.requestor",
        "path": "AuditEvent.agent.requestor",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:destination.network",
        "path": "AuditEvent.agent.network",
        "min": 1,
        "mustSupport": false
      },
      {
        "id": "AuditEvent.agent:destination.network.address",
        "path": "AuditEvent.agent.network.address",
        "short": "ID usluge SGP uputnice",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:destination.network.type",
        "path": "AuditEvent.agent.network.type",
        "min": 1,
        "fixedCode": "5",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.source",
        "path": "AuditEvent.source",
        "short": "Aplikacija koja je izradila revizijski zapis"
      },
      {
        "id": "AuditEvent.source.observer",
        "path": "AuditEvent.source.observer",
        "short": "Identifikator aplikacije SGP uputnice",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.source.observer.reference",
        "path": "AuditEvent.source.observer.reference",
        "max": "0"
      },
      {
        "id": "AuditEvent.source.observer.identifier",
        "path": "AuditEvent.source.observer.identifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity",
        "path": "AuditEvent.entity",
        "short": "Informacije o SGP uputnici na koju se odnosi revizijski zapis",
        "min": 1,
        "max": "1",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.entity.what",
        "path": "AuditEvent.entity.what",
        "short": "Jedinstveni identifikator SGP uputnice",
        "definition": "Jedinstveni identifikator SGP uputnice. Ne koristi se u slučaju tranzicije '3.11' (Pretraga uputnice).",
        "mustSupport": false
      },
      {
        "id": "AuditEvent.entity.what.reference",
        "path": "AuditEvent.entity.what.reference",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.what.type",
        "path": "AuditEvent.entity.what.type",
        "min": 1,
        "fixedUri": "ServiceRequest",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.what.identifier",
        "path": "AuditEvent.entity.what.identifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.type",
        "path": "AuditEvent.entity.type",
        "min": 1,
        "fixedCoding": {
          "system": "http://hl7.org/fhir/resource-types",
          "code": "ServiceRequest",
          "display": "ServiceRequest"
        },
        "mustSupport": false
      },
      {
        "id": "AuditEvent.entity.role",
        "path": "AuditEvent.entity.role",
        "min": 1,
        "fixedCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/object-role",
          "code": "4",
          "display": "Domain Resource"
        },
        "mustSupport": false
      },
      {
        "id": "AuditEvent.entity.query",
        "path": "AuditEvent.entity.query",
        "short": "Query parametri",
        "definition": "Sadrži b64 enkodireni Parameters resource koji ide u requestu kod tranzicije '3.11' (Pretraga uputnice)."
      }
    ]
  }
}