{
  "resourceType": "StructureDefinition",
  "id": "ISPMResource",
  "meta": {
    "lastUpdated": "2023-02-05T14:41:51.6934648+00:00"
  },
  "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"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 5
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "fhir"
    }
  ],
  "url": "http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResource",
  "version": "1.0.1",
  "name": "IspmResource",
  "title": "ISPM Basic Resource",
  "status": "draft",
  "date": "2023-02-09T00:02:53.8161514+00:00",
  "publisher": "Philips ISPM",
  "contact": [
    {
      "name": "alexey.novikov@philips.com",
      "telecom": [
        {
          "system": "email",
          "value": "alexey.novikov@philips.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "Base StructureDefinition for every ISPM resource type.",
  "purpose": "Being a basic abstract definition for every ISPM resource type.",
  "fhirVersion": "4.0.1",
  "kind": "logical",
  "abstract": true,
  "type": "http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResource",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Resource",
  "derivation": "specialization",
  "differential": {
    "element": [
      {
        "id": "IspmResource",
        "path": "IspmResource",
        "short": "A resource with narrative, extensions, and contained resources",
        "definition": "A resource that includes narrative, extensions, and contained resources.",
        "constraint": [
          {
            "key": "dom-2",
            "severity": "error",
            "human": "If the resource is contained in another resource, it SHALL NOT contain nested Resources",
            "expression": "contained.contained.empty()",
            "xpath": "not(parent::f:contained and f:contained)"
          },
          {
            "key": "dom-4",
            "severity": "error",
            "human": "If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated",
            "expression": "contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()",
            "xpath": "not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))"
          },
          {
            "key": "dom-3",
            "severity": "error",
            "human": "If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource",
            "expression": "contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()",
            "xpath": "not(exists(for $id in f:contained/*/f:id/@value return $contained[not(parent::*/descendant::f:reference/@value=concat('#', $contained/*/id/@value) or descendant::f:reference[@value='#'])]))"
          },
          {
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice",
                "valueBoolean": true
              },
              {
                "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation",
                "valueMarkdown": "When a resource has no narrative, only systems that fully understand the data can display the resource to a human safely. Including a human readable representation in the resource makes for a much more robust eco-system and cheaper handling of resources by intermediary systems. Some ecosystems restrict distribution of resources to only those systems that do fully understand the resources, and as a consequence implementers may believe that the narrative is superfluous. However experience shows that such eco-systems often open up to new participants over time."
              }
            ],
            "key": "dom-6",
            "severity": "warning",
            "human": "A resource should have narrative for robust management",
            "expression": "text.`div`.exists()",
            "xpath": "exists(f:text/h:div)"
          },
          {
            "key": "dom-5",
            "severity": "error",
            "human": "If a resource is contained in another resource, it SHALL NOT have a security label",
            "expression": "contained.meta.security.empty()",
            "xpath": "not(exists(f:contained/*/f:meta/f:security))"
          },
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ]
      },
      {
        "id": "IspmResource.text",
        "path": "IspmResource.text",
        "short": "Text summary of the resource, for human interpretation",
        "definition": "A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.",
        "comment": "Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a \"text blob\" or where text is additionally entered raw or narrated and encoded information is added later.",
        "alias": [
          "narrative",
          "html",
          "xhtml",
          "display"
        ],
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Narrative"
          }
        ],
        "condition": [
          "ele-1"
        ]
      },
      {
        "id": "IspmResource.context",
        "path": "IspmResource.context",
        "short": "A reference from to other relative resources",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResourceContextReference"
          }
        ]
      },
      {
        "id": "IspmResource.authorization",
        "path": "IspmResource.authorization",
        "short": "A reference to the owner of resource",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResourceAuthorizationReference"
          }
        ]
      },
      {
        "id": "IspmResource.deleted",
        "path": "IspmResource.deleted",
        "short": "Indicates if the resource was deleted",
        "definition": "Indicates if the resource was deleted",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "boolean",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/boolean"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ]
      },
      {
        "id": "IspmResource.modified",
        "path": "IspmResource.modified",
        "short": "Indicates if the resource was manualy moified",
        "definition": "Indicates if the resource was manualy moified",
        "alias": [
          "edited",
          "changed",
          "modified"
        ],
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "boolean",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/boolean"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ]
      },
      {
        "id": "IspmResource.resourceType",
        "path": "IspmResource.resourceType",
        "short": "Type of the resource",
        "definition": "Type of the resource",
        "comment": "Type of the resource",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/string"
            ]
          }
        ]
      },
      {
        "id": "IspmResource.subResourceType",
        "path": "IspmResource.subResourceType",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Coding"
            ]
          }
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div"
          }
        ]
      },
      {
        "id": "IspmResource.affiliateOrganizations",
        "path": "IspmResource.affiliateOrganizations",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "BackboneElement",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/BackboneElement"
            ]
          }
        ]
      },
      {
        "id": "IspmResource.client_defined_identifier",
        "path": "IspmResource.client_defined_identifier",
        "alias": [
          "clientDefinedIdentifier"
        ],
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Identifier"
            ]
          }
        ]
      },
      {
        "id": "IspmResource.client_defined_identifier_unique",
        "path": "IspmResource.client_defined_identifier_unique",
        "alias": [
          "clientDefinedIdentifierUnique"
        ],
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Identifier"
            ]
          }
        ]
      },
      {
        "id": "IspmResource.sourceResource",
        "path": "IspmResource.sourceResource",
        "short": "Additional data on the source that relevant for copy from event",
        "definition": "Additional data on the source that relevant for copy from event.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "BackboneElement"
          }
        ],
        "condition": [
          "ele-1"
        ]
      },
      {
        "id": "IspmResource.sourceResource.date",
        "path": "IspmResource.sourceResource.date",
        "max": "1",
        "type": [
          {
            "code": "date",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/date"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ]
      },
      {
        "id": "IspmResource.sourceResource.eventType",
        "path": "IspmResource.sourceResource.eventType",
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Coding"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ]
      }
    ]
  }
}