{
  "resourceType": "StructureDefinition",
  "id": "HVOAvtalLogical",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-type-characteristics",
      "valueCode": "can-be-target"
    }
  ],
  "url": "http://electronichealth.se/fhir/hvo/StructureDefinition/HVOAvtalLogical",
  "name": "HVOAvtalLogical",
  "title": "Avtal",
  "status": "draft",
  "description": "Klassen avtal håller information om överenskommelse som medför rättigheter och skyldigheter för parterna.",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "AvtalToHVOContract",
      "uri": "HVOContract"
    }
  ],
  "kind": "logical",
  "abstract": false,
  "type": "http://electronichealth.se/fhir/hvo/StructureDefinition/HVOAvtalLogical",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Base",
  "derivation": "specialization",
  "snapshot": {
    "element": [
      {
        "id": "HVOAvtalLogical",
        "path": "HVOAvtalLogical",
        "short": "Avtal",
        "definition": "Klassen avtal håller information om överenskommelse som medför rättigheter och skyldigheter för parterna.",
        "min": 0,
        "max": "*",
        "base": {
          "path": "HVOAvtalLogical",
          "min": 0,
          "max": "*"
        },
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.avtalsomrade",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "HVOAvtalLogical.avtalsomrade",
        "short": "avtalsområde",
        "definition": "Kod för inom vilket eller vilka avtalsområden de tjänster som avtalet avser upphandlats inom.",
        "comment": "Codes may be defined very casually in enumerations or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information.",
        "min": 0,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.avtalsomrade",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "Coding"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "cod-1",
            "severity": "warning",
            "human": "A Coding SHOULD NOT have a display unless a code is also present.  Computation on Coding.display alone is generally unsafe.  Consider using CodeableConcept.text",
            "expression": "code.exists().not() implies display.exists().not()",
            "source": "http://hl7.org/fhir/StructureDefinition/Coding"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "v2",
            "map": "CE/CNE/CWE subset one of the sets of component 1-3 or 4-6"
          },
          {
            "identity": "rim",
            "map": "CV"
          },
          {
            "identity": "orim",
            "map": "fhir:Coding rdfs:subClassOf dt:CDCoding"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.type"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.beskrivning",
        "path": "HVOAvtalLogical.beskrivning",
        "short": "beskrivning",
        "definition": "Textuell beskrivning av relevanta avtalsspecifika villkor och texter som inte finns representerat på annat håll, som exempelvis i uppdrag och de tjänster uppdraget innehåller.",
        "comment": "Note that FHIR strings SHALL NOT exceed 1,048,576 (1024*1024) characters in size",
        "min": 1,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.beskrivning",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "string"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.term.text"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.giltigFrom",
        "path": "HVOAvtalLogical.giltigFrom",
        "short": "giltigFrom",
        "definition": "Angivelse av den tidpunkt från och med vilken avtalet gäller och har laga kraft.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.giltigFrom",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "time"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.applies.start"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.giltigTom",
        "path": "HVOAvtalLogical.giltigTom",
        "short": "giltigTom",
        "definition": "Angivelse av den tidpunkt då avtal upphör att gälla. Ska ej anges när sluttidpunkt är okänd.",
        "min": 0,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.giltigTom",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "time"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.applies.end"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.id",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "HVOAvtalLogical.id",
        "short": "id",
        "definition": "Angivelse av identifierare för avtal.",
        "comment": "The rules of the identifier.type  determine if a check digit is part of the ID value or sent separately, such as through the checkDigit extension.",
        "min": 1,
        "max": "*",
        "base": {
          "path": "HVOAvtalLogical.id",
          "min": 1,
          "max": "*"
        },
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ident-1",
            "severity": "warning",
            "human": "Identifier with no value has limited utility.  If communicating that an identifier value has been suppressed or missing, the value element SHOULD be present with an extension indicating the missing semantic - e.g. data-absent-reason",
            "expression": "value.exists()",
            "source": "http://hl7.org/fhir/StructureDefinition/Identifier"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "v2",
            "map": "CX / EI (occasionally, more often EI maps to a resource id or a URL)"
          },
          {
            "identity": "rim",
            "map": "II - The Identifier class is a little looser than the v3 type II because it allows URIs as well as registered OIDs or GUIDs.  Also maps to Role[classCode=IDENT]"
          },
          {
            "identity": "servd",
            "map": "Identifier"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.identifier"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.lagrum",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "HVOAvtalLogical.lagrum",
        "short": "lagrum",
        "definition": "Angivelse av kod för lagrum som upphandling skett inom eller som uppdrag levereras inom.",
        "comment": "Codes may be defined very casually in enumerations or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information.",
        "min": 0,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.lagrum",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "Coding"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "cod-1",
            "severity": "warning",
            "human": "A Coding SHOULD NOT have a display unless a code is also present.  Computation on Coding.display alone is generally unsafe.  Consider using CodeableConcept.text",
            "expression": "code.exists().not() implies display.exists().not()",
            "source": "http://hl7.org/fhir/StructureDefinition/Coding"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "v2",
            "map": "CE/CNE/CWE subset one of the sets of component 1-3 or 4-6"
          },
          {
            "identity": "rim",
            "map": "CV"
          },
          {
            "identity": "orim",
            "map": "fhir:Coding rdfs:subClassOf dt:CDCoding"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.subType"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.optionForlangning",
        "path": "HVOAvtalLogical.optionForlangning",
        "short": "optionFörlängning",
        "definition": "Textuell beskrivning av eventuell option för att förlänga avtalets giltighetstid.",
        "comment": "Note that FHIR strings SHALL NOT exceed 1,048,576 (1024*1024) characters in size",
        "min": 0,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.optionForlangning",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "string"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.term.offer.text"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.url",
        "path": "HVOAvtalLogical.url",
        "short": "url",
        "definition": "Angivelse av adress till webbsida med avtalet i form av en URL.",
        "comment": "see http://en.wikipedia.org/wiki/Uniform_resource_identifier",
        "min": 0,
        "max": "1",
        "base": {
          "path": "HVOAvtalLogical.url",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "url"
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.legal"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.relationAvtal",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "HVOAvtalLogical.relationAvtal",
        "short": "relationAvtal",
        "definition": "relationAvtal",
        "comment": "References SHALL be a reference to an actual FHIR resource, and SHALL be resolvable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.",
        "min": 0,
        "max": "*",
        "base": {
          "path": "HVOAvtalLogical.relationAvtal",
          "min": 0,
          "max": "*"
        },
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/hvo/StructureDefinition/HVOAvtalLogical"
            ]
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ref-1",
            "severity": "error",
            "human": "SHALL have a contained resource if a local reference is provided",
            "expression": "reference.exists()  implies (reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids')) or (reference='#' and %rootResource!=%resource))",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          },
          {
            "key": "ref-2",
            "severity": "error",
            "human": "At least one of reference, identifier and display SHALL be present (unless an extension is provided).",
            "expression": "reference.exists() or identifier.exists() or display.exists() or extension.exists()",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "rim",
            "map": "The target of a resource reference is a RIM entry point (Act, Role, or Entity)"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.extension[additionalRelationship]"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.avser",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "HVOAvtalLogical.avser",
        "short": "avser",
        "definition": "avser",
        "comment": "References SHALL be a reference to an actual FHIR resource, and SHALL be resolvable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.",
        "min": 0,
        "max": "*",
        "base": {
          "path": "HVOAvtalLogical.avser",
          "min": 0,
          "max": "*"
        },
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/hvo/StructureDefinition/HVOUppdragLogical"
            ]
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ref-1",
            "severity": "error",
            "human": "SHALL have a contained resource if a local reference is provided",
            "expression": "reference.exists()  implies (reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids')) or (reference='#' and %rootResource!=%resource))",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          },
          {
            "key": "ref-2",
            "severity": "error",
            "human": "At least one of reference, identifier and display SHALL be present (unless an extension is provided).",
            "expression": "reference.exists() or identifier.exists() or display.exists() or extension.exists()",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "rim",
            "map": "The target of a resource reference is a RIM entry point (Act, Role, or Entity)"
          },
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.subject(HVOOrganizationAffiliation)"
          }
        ]
      }
    ]
  },
  "differential": {
    "element": [
      {
        "id": "HVOAvtalLogical",
        "path": "HVOAvtalLogical",
        "short": "Avtal",
        "definition": "Klassen avtal håller information om överenskommelse som medför rättigheter och skyldigheter för parterna."
      },
      {
        "id": "HVOAvtalLogical.avtalsomrade",
        "path": "HVOAvtalLogical.avtalsomrade",
        "short": "avtalsområde",
        "definition": "Kod för inom vilket eller vilka avtalsområden de tjänster som avtalet avser upphandlats inom.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.type"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.beskrivning",
        "path": "HVOAvtalLogical.beskrivning",
        "short": "beskrivning",
        "definition": "Textuell beskrivning av relevanta avtalsspecifika villkor och texter som inte finns representerat på annat håll, som exempelvis i uppdrag och de tjänster uppdraget innehåller.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.term.text"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.giltigFrom",
        "path": "HVOAvtalLogical.giltigFrom",
        "short": "giltigFrom",
        "definition": "Angivelse av den tidpunkt från och med vilken avtalet gäller och har laga kraft.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "time"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.applies.start"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.giltigTom",
        "path": "HVOAvtalLogical.giltigTom",
        "short": "giltigTom",
        "definition": "Angivelse av den tidpunkt då avtal upphör att gälla. Ska ej anges när sluttidpunkt är okänd.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "time"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.applies.end"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.id",
        "path": "HVOAvtalLogical.id",
        "short": "id",
        "definition": "Angivelse av identifierare för avtal.",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.identifier"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.lagrum",
        "path": "HVOAvtalLogical.lagrum",
        "short": "lagrum",
        "definition": "Angivelse av kod för lagrum som upphandling skett inom eller som uppdrag levereras inom.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.subType"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.optionForlangning",
        "path": "HVOAvtalLogical.optionForlangning",
        "short": "optionFörlängning",
        "definition": "Textuell beskrivning av eventuell option för att förlänga avtalets giltighetstid.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.term.offer.text"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.url",
        "path": "HVOAvtalLogical.url",
        "short": "url",
        "definition": "Angivelse av adress till webbsida med avtalet i form av en URL.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "url"
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.legal"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.relationAvtal",
        "path": "HVOAvtalLogical.relationAvtal",
        "short": "relationAvtal",
        "definition": "relationAvtal",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/hvo/StructureDefinition/HVOAvtalLogical"
            ]
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.extension[additionalRelationship]"
          }
        ]
      },
      {
        "id": "HVOAvtalLogical.avser",
        "path": "HVOAvtalLogical.avser",
        "short": "avser",
        "definition": "avser",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/hvo/StructureDefinition/HVOUppdragLogical"
            ]
          }
        ],
        "mapping": [
          {
            "identity": "AvtalToHVOContract",
            "map": "HVOContract.subject(HVOOrganizationAffiliation)"
          }
        ]
      }
    ]
  }
}