{
  "resourceType": "StructureDefinition",
  "id": "ee2a543e-a134-4c01-8821-e4469a25e981",
  "meta": {
    "lastUpdated": "2019-12-10T14:38:31.282+00:00"
  },
  "url": "http://electronichealth.se/fhir-testing/StructureDefinition/NLLProvenance",
  "name": "NLLProvenance",
  "status": "draft",
  "date": "2019-12-10T14:38:31.1800218+00:00",
  "fhirVersion": "4.0.0",
  "mapping": [
    {
      "identity": "EHM",
      "name": "E-hälsomyndigheten internal model"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Provenance",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Provenance",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Provenance",
        "path": "Provenance",
        "short": "Who, What, When describing a change on the patient medications list",
        "definition": "NLLProvenance describes a change made on a resource affecting a patient medications list, e.g. a MedicationRequest, MedicationDispense or resource related to multi dose dispensing (sv: dosunderlag, dossamtycke). The change is describes What - in the form of which resource is the target in combination with a reason and activity. It describes by Who - in the form of agent and it describes When it occurred.",
        "mapping": [
          {
            "identity": "EHM",
            "map": "Händelse avseende patients läkemedelslista"
          }
        ]
      },
      {
        "id": "Provenance.target",
        "path": "Provenance.target",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/StructureDefinition/NLLMedicationRequest",
              "http://electronichealth.se/fhir/StructureDefinition/NLLMultiDoseDispMedList",
              "http://electronichealth.se/fhir/StructureDefinition/NLLMedicationDispense",
              "http://electronichealth.se/fhir/StructureDefinition/NLLMultiDoseDispConsent"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Provenance.occurred[x]",
        "path": "Provenance.occurred[x]",
        "type": [
          {
            "code": "dateTime"
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "EHM",
            "map": "Händelse.Tidpunkt"
          }
        ]
      },
      {
        "id": "Provenance.reason",
        "path": "Provenance.reason",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "coding.system"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Provenance.reason:reasonForRevision",
        "path": "Provenance.reason",
        "sliceName": "reasonForRevision",
        "definition": "The reason that the activity was taking place, in NLL used to describe the reqason for change e.g. wrong patient (sv: FEL_PATIENT), medication interaction (sv: INTERAKTION), side effects noticed.",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://electronichealth.se/fhir/ValueSet/ml-reason-for-revision"
        },
        "mapping": [
          {
            "identity": "EHM",
            "map": "Händelseorsak"
          }
        ]
      },
      {
        "id": "Provenance.reason:reasonForRevision.coding",
        "path": "Provenance.reason.coding",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://electronichealth.se/fhir/ValueSet/ml-reason-for-revision"
        }
      },
      {
        "id": "Provenance.reason:reasonForRevision.coding.system",
        "path": "Provenance.reason.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Provenance.reason:reasonForRevision.coding.code",
        "path": "Provenance.reason.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Provenance.activity",
        "path": "Provenance.activity",
        "definition": "This type describes the activity that occurred, e.g. change on a MedicationRequest (sv: UPPDATERA_FORSKRVNING), cancelling a MedicationRequest (sv: MAKULERA_FORSKRIVNING)",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://electronichealth.se/fhir/ValueSet/ml-activity-types"
        },
        "mapping": [
          {
            "identity": "EHM",
            "map": "Händelsetyp"
          }
        ]
      },
      {
        "id": "Provenance.agent",
        "path": "Provenance.agent",
        "definition": "Allowed actors in NLL are: performer (sv: utförare) and author (sv: uppdragsgivare). Author MUST always be present, performer CAN be present in case a practitioner is performing a change on behalf of someone",
        "mapping": [
          {
            "identity": "EHM",
            "map": "Uppdragsgivare / Utförare"
          }
        ]
      },
      {
        "id": "Provenance.agent.type",
        "path": "Provenance.agent.type",
        "mustSupport": true
      },
      {
        "id": "Provenance.agent.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/StructureDefinition/NLLPractitioner"
            ],
            "aggregation": [
              "contained",
              "referenced"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "EHM",
            "map": "Utförare / Uppdragsgivare",
            "comment": "Depending on type, could be the performer (sv: utförare) or author (sv: uppdragsgivare)"
          }
        ]
      }
    ]
  }
}