{
  "resourceType": "StructureDefinition",
  "id": "e200-bundle",
  "url": "http://esveikata.lt/Profile/Bundle/E200",
  "version": "1.0.0",
  "name": "E200Bundle",
  "status": "active",
  "date": "2023-02-09",
  "description": "Lithuanian national fhir profile for E200 form bundle.",
  "fhirVersion": "5.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "Bundle",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Bundle",
        "path": "Bundle",
        "constraint": [
          {
            "key": "e200-bundle-9",
            "severity": "error",
            "human": "Can't find DiagnosticReport results in bundle.",
            "expression": "Bundle.entry.resource.ofType(DiagnosticReport).select(result.resolve().count() = result.count()).allTrue()"
          },
          {
            "key": "e200-bundle-10",
            "severity": "error",
            "human": "Can't find ServiceRequest condition in bundle.",
            "expression": "Bundle.entry.resource.ofType(ServiceRequest).select(supportingInfo.reference.resolve().count() = supportingInfo.reference.count()).allTrue()"
          },
          {
            "key": "e200-bundle-12",
            "severity": "error",
            "human": "Transaction must not contain SearchParameter resources.",
            "expression": "Bundle.entry.resource.ofType(SearchParameter).exists().not() and Bundle.entry.resource.ofType(CodeSystem).exists().not()"
          }
        ]
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "min": 1,
        "constraint": [
          {
            "key": "e200-bundle-1",
            "severity": "error",
            "human": "Bundle must be a document or a transaction.",
            "expression": "$this in ('document' | 'transaction')"
          }
        ]
      },
      {
        "id": "Bundle.entry.resource",
        "path": "Bundle.entry.resource",
        "constraint": [
          {
            "key": "e200-bundle-2",
            "severity": "error",
            "human": "ServiceRequest must conform to the 'http://esveikata.lt/Profile/ServiceRequest' profile.",
            "expression": "$this is ServiceRequest implies $this.meta.profile.contains('http://esveikata.lt/Profile/ServiceRequest')"
          },
          {
            "key": "e200-bundle-3",
            "severity": "error",
            "human": "Specimen must conform to the 'http://esveikata.lt/Profile/Specimen' profile.",
            "expression": "$this is Specimen implies $this.meta.profile.contains('http://esveikata.lt/Profile/Specimen')"
          },
          {
            "key": "e200-bundle-4",
            "severity": "error",
            "human": "DiagnosticReport must conform to the 'http://esveikata.lt/Profile/DiagnosticReport' profile.",
            "expression": "$this is DiagnosticReport implies $this.meta.profile.contains('http://esveikata.lt/Profile/DiagnosticReport')"
          },
          {
            "key": "e200-bundle-5",
            "severity": "error",
            "human": "Observation must conform to the 'http://esveikata.lt/Profile/Observation' profile.",
            "expression": "$this is Observation implies $this.meta.profile.contains('http://esveikata.lt/Profile/Observation')"
          },
          {
            "key": "e200-bundle-6",
            "severity": "error",
            "human": "Practitioner must conform to the 'http://esveikata.lt/Profile/Practitioner' profile.",
            "expression": "$this is Practitioner implies $this.meta.profile.contains('http://esveikata.lt/Profile/Practitioner')"
          },
          {
            "key": "e200-bundle-7",
            "severity": "error",
            "human": "Organization must conform to the 'http://esveikata.lt/Profile/Organization' profile.",
            "expression": "$this is Organization implies $this.meta.profile.contains('http://esveikata.lt/Profile/Organization')"
          },
          {
            "key": "e200-bundle-8",
            "severity": "error",
            "human": "Composition must conform to the 'http://esveikata.lt/Profile/Composition/E200' profile.",
            "expression": "$this is Composition implies $this.meta.profile.contains('http://esveikata.lt/Profile/Composition/E200')"
          },
          {
            "key": "e200-bundle-11",
            "severity": "error",
            "human": "Condition must conform to the 'http://esveikata.lt/Profile/Condition' profile.",
            "expression": "$this is Condition implies $this.meta.profile.contains('http://esveikata.lt/Profile/Condition')"
          }
        ]
      }
    ]
  }
}