{
  "resourceType": "StructureDefinition",
  "id": "hso-lib-Composition",
  "url": "https://hso.no/fhir/StructureDefinition/HsoLibComposition",
  "name": "HsoLibComposition",
  "status": "draft",
  "description": "HSØ implementation profile for Active Medications - Legemidler i Bruk (LiB).",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "workflow",
      "uri": "http://hl7.org/fhir/workflow",
      "name": "Workflow Pattern"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "cda",
      "uri": "http://hl7.org/v3/cda",
      "name": "CDA (R2)"
    },
    {
      "identity": "fhirdocumentreference",
      "uri": "http://hl7.org/fhir/documentreference",
      "name": "FHIR DocumentReference"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Composition",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Composition",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Composition.extension",
        "path": "Composition.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Composition.extension:reconsiliationInfo",
        "path": "Composition.extension",
        "sliceName": "reconsiliationInfo",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://hso.no/fhir/StructureDefinition/HsoLibReconsiliationInfo"
            ]
          }
        ]
      },
      {
        "id": "Composition.subject",
        "path": "Composition.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient"
            ]
          }
        ]
      },
      {
        "id": "Composition.author",
        "path": "Composition.author",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole",
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient",
              "http://hl7.no/fhir/StructureDefinition/no-basis-RelatedPerson",
              "http://hl7.no/fhir/StructureDefinition/no-basis-Organization"
            ]
          }
        ]
      },
      {
        "id": "Composition.attester.party",
        "path": "Composition.attester.party",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole",
              "http://hl7.no/fhir/StructureDefinition/no-basis-Organization"
            ]
          }
        ]
      },
      {
        "id": "Composition.custodian",
        "path": "Composition.custodian",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Organization"
            ]
          }
        ]
      },
      {
        "id": "Composition.section",
        "path": "Composition.section",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "code.coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Composition.section:sectionMedication",
        "path": "Composition.section",
        "sliceName": "sectionMedication",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Composition.section:sectionMedication.code.coding.system",
        "path": "Composition.section.code.coding.system",
        "fixedUri": "http://hso.no/fhir/CodeSystem/HsoLibSectionTypes"
      },
      {
        "id": "Composition.section:sectionMedication.code.coding.code",
        "path": "Composition.section.code.coding.code",
        "min": 1,
        "fixedCode": "sectionMedication"
      },
      {
        "id": "Composition.section:sectionMedication.entry",
        "path": "Composition.section.entry",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://hso.no/fhir/StructureDefinition/HsoLibMedicationStatement",
              "https://hso.no/fhir/StructureDefinition/HsoLibMedicationRequest"
            ],
            "aggregation": [
              "referenced",
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "Composition.section:sectionMedicationNotReconsiled",
        "path": "Composition.section",
        "sliceName": "sectionMedicationNotReconsiled",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Composition.section:sectionMedicationNotReconsiled.code.coding.system",
        "path": "Composition.section.code.coding.system",
        "fixedUri": "http://hso.no/fhir/CodeSystem/HsoLibSectionTypes"
      },
      {
        "id": "Composition.section:sectionMedicationNotReconsiled.code.coding.code",
        "path": "Composition.section.code.coding.code",
        "min": 1,
        "fixedCode": "sectionMedicationNotReconsiled"
      },
      {
        "id": "Composition.section:sectionMedicationNotReconsiled.entry",
        "path": "Composition.section.entry",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://hso.no/fhir/StructureDefinition/HsoLibMedicationStatement",
              "https://hso.no/fhir/StructureDefinition/HsoLibMedicationRequest"
            ],
            "aggregation": [
              "referenced",
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "Composition.section:sectionMedicationNotTaking",
        "path": "Composition.section",
        "sliceName": "sectionMedicationNotTaking",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Composition.section:sectionMedicationNotTaking.code.coding.system",
        "path": "Composition.section.code.coding.system",
        "fixedUri": "http://hso.no/fhir/CodeSystem/HsoLibSectionTypes"
      },
      {
        "id": "Composition.section:sectionMedicationNotTaking.code.coding.code",
        "path": "Composition.section.code.coding.code",
        "min": 1,
        "fixedCode": "sectionMedicationNotTaking"
      },
      {
        "id": "Composition.section:sectionMedicationNotTaking.entry",
        "path": "Composition.section.entry",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://hso.no/fhir/StructureDefinition/HsoLibMedicationStatement",
              "https://hso.no/fhir/StructureDefinition/HsoLibMedicationRequest"
            ],
            "aggregation": [
              "referenced",
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "Composition.section:sectionIssues",
        "path": "Composition.section",
        "sliceName": "sectionIssues",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Composition.section:sectionIssues.code.coding.system",
        "path": "Composition.section.code.coding.system",
        "fixedUri": "http://hso.no/fhir/CodeSystem/HsoLibSectionTypes"
      },
      {
        "id": "Composition.section:sectionIssues.code.coding.code",
        "path": "Composition.section.code.coding.code",
        "min": 1,
        "fixedCode": "sectionIssues"
      },
      {
        "id": "Composition.section:sectionIssues.entry",
        "path": "Composition.section.entry",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://hso.no/fhir/StructureDefinition/HsoLibDetectedIssue"
            ],
            "aggregation": [
              "referenced",
              "bundled"
            ]
          }
        ]
      }
    ]
  }
}