openapi: 3.0.3
info:
  title: Resources
  version: latest
  x-status: STABLE
  x-spec: resources
  contact:
    name: Specifications Editorial Committee openEHR
    url: https://specifications.openehr.org/
    email: info@openehr.org
  license:
    name: Creative Commons Attribution-NoDerivs 3.0 Unported
    url: https://creativecommons.org/licenses/by-nd/3.0/
  description: |
    ## Description

    ### Purpose

    This specification describes openEHR API resources.

    ### Related Documents

    Prerequisite documents for reading this document include:

    - The [openEHR REST API Specifications Overview](overview.html)

    Related documents include:

    - The [EHR Information Model](https://specifications.openehr.org/releases/RM/latest/ehr.html#_the_ehr_information_model)
    - The [openEHR Architecture Overview](https://specifications.openehr.org/releases/BASE/latest/architecture_overview.html)
    - The [openEHR Global Class Index](https://specifications.openehr.org/classes)
    - The [XML-Schemas (XSD)](https://specifications.openehr.org/releases/ITS-XML/latest)
    - The [JSON-Schemas](https://specifications.openehr.org/releases/ITS-JSON/latest) and [Simplified Data Template (SDT)](simplified_data_template.html)
    - The [openEHR Platform Abstract Service Model](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html)

    ### Status

    This specification is in the `STABLE` state, and can be downloaded as [OpenAPI specification](https://spec.openapis.org/oas/v3.0.3) file (in YAML format) [for validation](computable/OAS/resources-validation.openapi.yaml), or [for code generators](computable/OAS/resources-codegen.openapi.yaml).
    Users are encouraged to comment on and/or advise on these paragraphs as well as the main content.

    The development version of this document can be found at <https://specifications.openehr.org/releases/ITS-REST/latest/resources.html>.
servers: []
security: []
tags:
  - name: EHR_schema
    x-displayName: EHR
    description: |
      This resource is formally specified in Reference Model as the [EHR](https://specifications.openehr.org/releases/RM/latest/ehr.html#_ehr_class) class.

      <SchemaDefinition schemaRef="#/components/schemas/Ehr" />
  - name: EHR_STATUS_schema
    x-displayName: EHR_STATUS
    description: |
      The following resources are formally specified in the Reference Model as [EHR_STATUS](https://specifications.openehr.org/releases/RM/latest/ehr.html#_ehr_status_class) and [VERSIONED_EHR_STATUS](https://specifications.openehr.org/releases/RM/latest/ehr.html#_versioned_ehr_status_class) classes.
      <div class="mb-5"></div>

      The `EHR_STATUS` resource:
      <SchemaDefinition schemaRef="#/components/schemas/EhrStatus" />

      The `VERSIONED_EHR_STATUS` resource:
      <SchemaDefinition schemaRef="#/components/schemas/VersionedEhrStatus" />
  - name: COMPOSITION_schema
    x-displayName: COMPOSITION
    description: |
      The following resources are formally specified in the Reference Model as [COMPOSITION](https://specifications.openehr.org/releases/RM/latest/ehr.html#_composition_class) and [VERSIONED_COMPOSITION](https://specifications.openehr.org/releases/RM/latest/ehr.html#_versioned_composition_class) classes.
      <div class="mb-5"></div>

      The `COMPOSITION` resource:
      <SchemaDefinition schemaRef="#/components/schemas/Composition" />

      The abstract `CONTENT_ITEM` class, used in `COMPOSITION`:
      <SchemaDefinition schemaRef="#/components/schemas/UContentItem" />

      The abstract `ITEM_STRUCTURE` class, used in `CONTENT_ITEM`:
      <SchemaDefinition schemaRef="#/components/schemas/UItemStructure" />

      The `VERSIONED_COMPOSITION` resource:
      <SchemaDefinition schemaRef="#/components/schemas/VersionedComposition" />
  - name: DIRECTORY_schema
    x-displayName: DIRECTORY
    description: |
      This resource is formally specified in Reference Model in the [directory](https://specifications.openehr.org/releases/RM/latest/ehr.html#_directory) section, using [FOLDER](https://specifications.openehr.org/releases/RM/latest/common.html#_folder_class) class.

      <SchemaDefinition schemaRef="#/components/schemas/Folder" />
  - name: CONTRIBUTION_schema
    x-displayName: CONTRIBUTION
    description: |
      The following resources are formally specified in the Reference Model as the [CONTRIBUTION](https://specifications.openehr.org/releases/RM/latest/common.html#_contribution_class) class.
      <div class="mb-5"></div>

      A new `CONTRIBUTION` to be committed:
      <SchemaDefinition schemaRef="#/components/schemas/NewContribution" />

      A retrieved `CONTRIBUTION`:
      <SchemaDefinition schemaRef="#/components/schemas/Contribution" />
  - name: Query_schema
    x-displayName: Query Execute
    description: |
      The following resources are formally specified in the [Archetype Query Language (AQL)](https://specifications.openehr.org/releases/QUERY/latest/AQL.html) and in the [Query Service](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_query_service).
      <div class="mb-5"></div>

      The `AdhocQueryExecute` resource:
      <SchemaDefinition schemaRef="#/components/schemas/AdhocQueryExecute" />

      The stored-query execute, known as the `Query` resource:
      <SchemaDefinition schemaRef="#/components/schemas/Query" />
  - name: RESULT_SET_schema
    x-displayName: RESULT_SET
    description: |
      This resource is formally specified in the Service Model as [Query Result](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_result_set_class).

      <SchemaDefinition schemaRef="#/components/schemas/ResultSet" />
  - name: TemplateList_schema
    x-displayName: Template list
    description: |
      This resource represents the list of `Template` meta-information associated with uploaded templates - see also [Service Model - Definition Package](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_definition_package).

      <SchemaDefinition schemaRef="#/components/schemas/TemplateList" />
  - name: Template_schema
    x-displayName: Template
    description: |
      The following resources are formally specified in the [Archetype Model](https://specifications.openehr.org/releases/AM/latest) as AOM/ADL 1.4 Operational Templates (OPTs) and as [AOM2 templates](https://specifications.openehr.org/releases/AM/latest/AOM2.html#_templates).
      <div class="mb-5"></div>

      The AOM/ADL 1.4 `OPERATIONAL_TEMPLATE` resource:
      <SchemaDefinition schemaRef="#/components/schemas/OperationalTemplate" />

      The AOM/ADL 2 `OPERATIONAL_TEMPLATE` resource:
      <SchemaDefinition schemaRef="#/components/schemas/OperationalTemplateV2" />

      The `WebTemplate` alternative resource:
      <SchemaDefinition schemaRef="#/components/schemas/WebTemplate" />
  - name: StoredQuery_schema
    x-displayName: Stored Query
    description: |
      This resource represents the definition of a stored Query and is formally specified in the Service Model as [Registered Queries](https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_registered_queries).

      <SchemaDefinition schemaRef="#/components/schemas/StoredQuery" />
paths: {}
components:
  schemas:
    UAbstractItemStructure:
      title: ITEM_STRUCTURE
      type: object
    UAbstractContentItem:
      title: CONTENT_ITEM
      type: object
    Ehr:
      title: EHR
      type: object
      properties:
        system_id:
          $ref: '#/components/schemas/HierObjectId'
        ehr_id:
          $ref: '#/components/schemas/HierObjectId'
        ehr_status:
          $ref: '#/components/schemas/ObjectRef'
        ehr_access:
          $ref: '#/components/schemas/ObjectRef'
        time_created:
          $ref: '#/components/schemas/DvDateTime'
      description: An EHR resource
      example:
        system_id:
          value: 9624982A-9F42-41A5-9318-AE13D5F5031F
        ehr_id:
          value: 7d44b88c-4199-4bad-97dc-d78268e01398
        ehr_status:
          id:
            _type: OBJECT_VERSION_ID
            value: 8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1
          namespace: local
          type: EHR_STATUS
        ehr_access:
          id:
            _type: OBJECT_VERSION_ID
            value: 59a8d0ac-140e-4feb-b2d6-af99f8e68af8::openEHRSys.example.com::1
          namespace: local
          type: EHR_ACCESS
        time_created:
          value: '2015-01-20T19:30:22.765+01:00'
    EhrStatus:
      title: EHR_STATUS
      required:
        - name
        - archetype_node_id
        - subject
        - is_queryable
        - is_modifiable
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: EHR_STATUS
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        is_queryable:
          type: boolean
          default: true
        is_modifiable:
          type: boolean
          default: true
        other_details:
          $ref: '#/components/schemas/UItemStructure'
      description: An EHR_STATUS resource
      example:
        archetype_node_id: openEHR-EHR-EHR_STATUS.generic.v1
        name:
          value: EHR status
        uid:
          _type: OBJECT_VERSION_ID
          value: 8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1
        subject:
          _type: PARTY_SELF
        is_queryable: true
        is_modifiable: true
      x-discriminator-value: EHR_STATUS
    VersionedEhrStatus:
      title: VERSIONED_EHR_STATUS
      type: object
      properties:
        _type:
          type: string
          default: VERSIONED_EHR_STATUS
        uid:
          $ref: '#/components/schemas/HierObjectId'
        owner_id:
          $ref: '#/components/schemas/ObjectRef'
        time_created:
          $ref: '#/components/schemas/DvDateTime'
      description: A VERSIONED_EHR_STATUS resource
      example:
        uid:
          value: 6cb19121-4307-4648-9da0-d62e4d51f19b
        owner_id:
          id:
            _type: HIER_OBJECT_ID
            value: 7d44b88c-4199-4bad-97dc-d78268e01398
          namespace: local
          type: EHR
        time_created:
          value: '2015-01-20T19:30:22.765+01:00'
      x-discriminator-value: VERSIONED_EHR_STATUS
      required:
        - uid
        - owner_id
        - time_created
    Composition:
      title: COMPOSITION
      required:
        - name
        - archetype_node_id
        - language
        - territory
        - category
        - context
        - composer
        - content
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: COMPOSITION
        language:
          $ref: '#/components/schemas/CodePhrase'
        territory:
          $ref: '#/components/schemas/CodePhrase'
        category:
          $ref: '#/components/schemas/DvCodedText'
        context:
          $ref: '#/components/schemas/EventContext'
        composer:
          $ref: '#/components/schemas/UPartyProxy'
        content:
          type: array
          items:
            $ref: '#/components/schemas/UContentItem'
      description: A COMPOSITION resource
      example:
        archetype_node_id: openEHR-EHR-COMPOSITION.encounter.v1
        name:
          value: Vital Signs
        uid:
          _type: OBJECT_VERSION_ID
          value: 8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1
        archetype_details:
          archetype_id:
            value: openEHR-EHR-COMPOSITION.encounter.v1
          template_id:
            value: Example.v1::c7ec861c-c413-39ff-9965-a198ebf44747
          rm_version: 1.0.2
        language:
          terminology_id:
            value: ISO_639-1
          code_string: en
        territory:
          terminology_id:
            value: ISO_3166-1
          code_string: NL
        category:
          value: event
          defining_code:
            terminology_id:
              value: openehr
            code_string: '433'
        composer:
          _type: PARTY_IDENTIFIED
          external_ref:
            id:
              _type: GENERIC_ID
              value: 16b74749-e6aa-4945-b760-b42bdc07098a
              scheme: pid
            namespace: openEHRSys.example.com
            type: PERSON
          name: A name
        context:
          start_time:
            value: '2014-11-18T09:50:35.000+01:00'
          setting:
            value: other care
            defining_code:
              terminology_id:
                value: openehr
              code_string: '238'
        content: []
      x-discriminator-value: COMPOSITION
    VersionedComposition:
      title: VERSIONED_COMPOSITION
      type: object
      properties:
        _type:
          type: string
          default: VERSIONED_COMPOSITION
        uid:
          $ref: '#/components/schemas/HierObjectId'
        owner_id:
          $ref: '#/components/schemas/ObjectRef'
        time_created:
          $ref: '#/components/schemas/DvDateTime'
      description: A VERSIONED_COMPOSITION resource
      example:
        uid:
          value: 8849182c-82ad-4088-a07f-48ead4180515
        owner_id:
          id:
            _type: HIER_OBJECT_ID
            value: 7d44b88c-4199-4bad-97dc-d78268e01398
          namespace: local
          type: EHR
        time_created:
          value: '2015-01-20T19:30:22.765+01:00'
      x-discriminator-value: VERSIONED_COMPOSITION
      required:
        - uid
        - owner_id
        - time_created
    Folder:
      title: FOLDER
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: FOLDER
        items:
          type: array
          items:
            $ref: '#/components/schemas/ObjectRef'
        folders:
          type: array
          items:
            $ref: '#/components/schemas/Folder'
        details:
          $ref: '#/components/schemas/UItemStructure'
      description: A FOLDER resource
      example:
        archetype_node_id: openEHR-EHR-FOLDER.directory.v1
        name:
          value: Directory
        uid:
          _type: OBJECT_VERSION_ID
          value: 8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1
        items: []
        folders: []
      x-discriminator-value: FOLDER
      required:
        - name
        - archetype_node_id
    Contribution:
      title: CONTRIBUTION
      required:
        - uid
        - versions
        - audit
      type: object
      properties:
        uid:
          $ref: '#/components/schemas/HierObjectId'
        versions:
          type: array
          items:
            $ref: '#/components/schemas/ObjectRef'
        audit:
          $ref: '#/components/schemas/AuditDetails'
      description: A CONTRIBUTION resource
      example:
        uid:
          value: 0826851c-c4c2-4d61-92b9-410fb8275ff0
        versions:
          - _type: OBJECT_REF
            id:
              _type: OBJECT_VERSION_ID
              value: fb458d9c-1323-42bc-b7f8-787f3660a0b5::openEHRSys.example.com::1
            namespace: local
            type: COMPOSITION
          - _type: OBJECT_REF
            id:
              _type: OBJECT_VERSION_ID
              value: abcdefgh-1323-42bc-b7f8-787f3660a0ba::openEHRSys.example.com::1
            namespace: local
            type: FOLDER
        audit:
          system_id: 9624982A-9F42-41A5-9318-AE13D5F5031F
          committer:
            _type: PARTY_IDENTIFIED
            name: A user name
          time_committed:
            value: '2017-08-15T10:37:15.422+02:00'
          change_type:
            value: creation
            defining_code:
              terminology_id:
                value: openehr
              code_string: '249'
          description:
            value: Description text
    NewContribution:
      title: NewContribution
      required:
        - versions
        - audit
      type: object
      properties:
        uid:
          $ref: '#/components/schemas/HierObjectId'
        versions:
          type: array
          items:
            $ref: '#/components/schemas/UpdateVersion'
        audit:
          $ref: '#/components/schemas/UpdateAudit'
      description: A new (un-committed) CONTRIBUTION resource
    AdhocQueryExecute:
      title: AdhocQueryExecute
      required:
        - q
      type: object
      properties:
        q:
          $ref: '#/components/schemas/AQL'
        offset:
          $ref: '#/components/schemas/Offset'
        fetch:
          $ref: '#/components/schemas/Fetch'
        query_parameters:
          $ref: '#/components/schemas/QueryParameters'
    Query:
      title: Query
      required:
        - offset
        - fetch
        - query_parameters
      type: object
      properties:
        offset:
          $ref: '#/components/schemas/Offset'
        fetch:
          $ref: '#/components/schemas/Fetch'
        query_parameters:
          $ref: '#/components/schemas/QueryParameters'
    ResultSet:
      title: RESULT_SET
      required:
        - rows
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/ResultSetMetadata'
        name:
          $ref: '#/components/schemas/QueryName'
        q:
          $ref: '#/components/schemas/AQL'
        columns:
          type: array
          items:
            $ref: '#/components/schemas/ResultSetColumn'
          description: |
            A set of AQL column specifications, defined in the given AQL.
          example:
            - name: '#0'
              path: /ehr_id/value
            - name: startTime
              path: /context/start_time/value
            - name: systolic
              path: /data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude
            - name: cid
              path: /uid/value
            - name: '#4'
              path: /name
        rows:
          type: array
          items:
            $ref: '#/components/schemas/ResultSetRow'
          description: |
            An ordered set of RESULT_SET rows.
    TemplateList:
      title: TemplateList
      type: array
      items:
        $ref: '#/components/schemas/TemplateMetadata'
      description: |
        List of uploaded TEMPLATE resources.
    TemplateMetadata:
      title: TemplateMetadata
      required:
        - template_id
        - concept
        - archetype_id
        - created_timestamp
      type: object
      properties:
        template_id:
          type: string
        version:
          type: string
        concept:
          type: string
        archetype_id:
          type: string
        created_timestamp:
          type: string
      description: Uploaded TEMPLATE meta information.
      example:
        template_id: openEHR-EHR-COMPOSITION.t_vital_signs.v1.0.0
        version: 1.0.1
        concept: Vital Signs
        archetype_id: openEHR-EHR-COMPOSITION.encounter.v1
        created_timestamp: '2017-08-14T19:24:56.639Z'
    QueryList:
      title: QueryList
      type: array
      items:
        $ref: '#/components/schemas/StoredQuery'
      description: |
        List of Stored Query resources.
      example:
        - name: org.openehr::compositions
          type: aql
          version: 1.0.1
          saved: '2017-07-16T19:20:30.450+01:00'
          q: |-
            SELECT c  FROM EHR e[ehr_id/value=$ehr_id] 
              CONTAINS COMPOSITION c[$compositionid] 
            WHERE c/name/value = 'Vitals'
        - name: org.openehr::compositions
          type: aql
          version: 1.1.7
          saved: '2018-06-13T09:37:20.530+01:00'
          q: |-
            SELECT c  FROM EHR e[ehr_id/value=$ehr_id] 
              CONTAINS COMPOSITION c[$uid] 
            WHERE c/name/value = 'Vitals'
    OperationalTemplate:
      title: OPERATIONAL_TEMPLATE
      type: object
      xml:
        name: response200
    OperationalTemplateV2:
      title: OPERATIONAL_TEMPLATE_V2
      type: object
    WebTemplate:
      title: WebTemplate
      required:
        - templateId
        - version
        - defaultLanguage
        - languages
        - tree
      type: object
      properties:
        templateId:
          type: string
        version:
          type: string
        defaultLanguage:
          type: string
        languages:
          type: array
          items:
            type: string
        tree:
          $ref: '#/components/schemas/Tree'
    HierObjectId:
      title: HIER_OBJECT_ID
      required:
        - value
      type: object
      properties:
        _type:
          type: string
          default: UID_BASED_ID
        value:
          type: string
          format: uuid
          example: 6cb19121-4307-4648-9da0-d62e4d51f19b
      x-discriminator-value: HIER_OBJECT_ID
    ArchetypeId:
      title: ARCHETYPE_ID
      type: object
      properties:
        _type:
          type: string
          default: ARCHETYPE_ID
        value:
          type: string
      x-discriminator-value: ARCHETYPE_ID
      required:
        - value
    UMArchetypeId:
      title: ARCHETYPE_ID
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - ARCHETYPE_ID
          type: string
        value:
          type: string
      x-discriminator-value: ARCHETYPE_ID
    TemplateId:
      title: TEMPLATE_ID
      type: object
      properties:
        _type:
          type: string
          default: TEMPLATE_ID
        value:
          type: string
      x-discriminator-value: TEMPLATE_ID
      required:
        - value
    UMTemplateId:
      title: TEMPLATE_ID
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - TEMPLATE_ID
          type: string
        value:
          type: string
      x-discriminator-value: TEMPLATE_ID
    TerminologyId:
      title: TERMINOLOGY_ID
      type: object
      properties:
        _type:
          type: string
          default: TERMINOLOGY_ID
        value:
          type: string
      x-discriminator-value: TERMINOLOGY_ID
      required:
        - value
    UMTerminologyId:
      title: TERMINOLOGY_ID
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - TERMINOLOGY_ID
          type: string
        value:
          type: string
      x-discriminator-value: TERMINOLOGY_ID
    UMGenericId:
      title: GENERIC_ID
      required:
        - value
        - scheme
        - _type
      type: object
      properties:
        _type:
          enum:
            - GENERIC_ID
          type: string
        value:
          type: string
        scheme:
          type: string
      example:
        _type: GENERIC_ID
        value: c7ec861c-c413-39ff-9965-a198ebf44747
        scheme: pid
      x-discriminator-value: GENERIC_ID
    UMHierObjectId:
      title: HIER_OBJECT_ID
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - HIER_OBJECT_ID
          type: string
        value:
          type: string
          format: uuid
          example: 6cb19121-4307-4648-9da0-d62e4d51f19b
      example:
        _type: HIER_OBJECT_ID
        value: 6cb19121-4307-4648-9da0-d62e4d51f19b
      x-discriminator-value: HIER_OBJECT_ID
    ObjectVersionId:
      title: OBJECT_VERSION_ID
      required:
        - value
      type: object
      properties:
        _type:
          type: string
          default: UID_BASED_ID
        value:
          type: string
          example: 6cb19121-4307-4648-9da0-d62e4d51f19b::openEHRSys.example.com::2
      x-discriminator-value: OBJECT_VERSION_ID
    UMObjectVersionId:
      title: OBJECT_VERSION_ID
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - OBJECT_VERSION_ID
          type: string
        value:
          type: string
          example: 6cb19121-4307-4648-9da0-d62e4d51f19b::openEHRSys.example.com::2
      example:
        _type: OBJECT_VERSION_ID
        value: 6cb19121-4307-4648-9da0-d62e4d51f19b::openEHRSys.example.com::2
      x-discriminator-value: OBJECT_VERSION_ID
    UObjectId:
      title: OBJECT_ID
      oneOf:
        - $ref: '#/components/schemas/UMArchetypeId'
        - $ref: '#/components/schemas/UMTemplateId'
        - $ref: '#/components/schemas/UMTerminologyId'
        - $ref: '#/components/schemas/UMGenericId'
        - $ref: '#/components/schemas/UMHierObjectId'
        - $ref: '#/components/schemas/UMObjectVersionId'
      discriminator:
        propertyName: _type
        mapping:
          ARCHETYPE_ID: '#/components/schemas/UMArchetypeId'
          TEMPLATE_ID: '#/components/schemas/UMTemplateId'
          TERMINOLOGY_ID: '#/components/schemas/UMTerminologyId'
          GENERIC_ID: '#/components/schemas/UMGenericId'
          HIER_OBJECT_ID: '#/components/schemas/UMHierObjectId'
          OBJECT_VERSION_ID: '#/components/schemas/UMObjectVersionId'
    ObjectRef:
      title: OBJECT_REF
      required:
        - namespace
        - type
        - id
      type: object
      properties:
        namespace:
          type: string
        type:
          type: string
        id:
          $ref: '#/components/schemas/UObjectId'
      example:
        id:
          _type: OBJECT_VERSION_ID
          value: fb458d9c-1323-42bc-b7f8-787f3660a0b5::openEHRSys.example.com::1
        namespace: local
        type: COMPOSITION
    CodePhrase:
      title: CODE_PHRASE
      required:
        - terminology_id
        - code_string
      type: object
      properties:
        terminology_id:
          $ref: '#/components/schemas/TerminologyId'
        code_string:
          type: string
        preferred_term:
          type: string
      example:
        terminology_id:
          value: local
        code_string: at0001
    DvInterval:
      title: DV_INTERVAL
      required:
        - lower_unbounded
        - upper_unbounded
        - lower_included
        - upper_included
      type: object
      properties:
        _type:
          type: string
          default: DV_INTERVAL
        lower_unbounded:
          type: boolean
        upper_unbounded:
          type: boolean
        lower_included:
          type: boolean
        upper_included:
          type: boolean
      x-discriminator-value: DV_INTERVAL
    UMDvUri:
      title: DV_URI
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_URI
          type: string
        value:
          type: string
      x-discriminator-value: DV_URI
    DvEhrUri:
      title: DV_EHR_URI
      type: object
      properties:
        _type:
          type: string
          default: DV_EHR_URI
        value:
          type: string
      example:
        _type: DV_EHR_URI
        value: ehr://system_id/ehr_id/top_level_structure_locator/path_inside_top_level_structure
      x-discriminator-value: DV_EHR_URI
      required:
        - value
    UMDvEhrUri:
      title: DV_EHR_URI
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_EHR_URI
          type: string
        value:
          type: string
      x-discriminator-value: DV_EHR_URI
      example:
        _type: DV_EHR_URI
        value: ehr://system_id/ehr_id/top_level_structure_locator/path_inside_top_level_structure
    UDvUri:
      title: DV_URI
      oneOf:
        - $ref: '#/components/schemas/UMDvUri'
        - $ref: '#/components/schemas/UMDvEhrUri'
      discriminator:
        propertyName: _type
        mapping:
          DV_URI: '#/components/schemas/UMDvUri'
          DV_EHR_URI: '#/components/schemas/UMDvEhrUri'
      example:
        _type: DV_URI
        value: https://www.example.com
    DvCodedText:
      title: DV_CODED_TEXT
      required:
        - value
        - defining_code
      type: object
      properties:
        _type:
          type: string
          default: DV_CODED_TEXT
        value:
          type: string
        hyperlink:
          $ref: '#/components/schemas/UDvUri'
        formatting:
          type: string
        mappings:
          type: array
          items:
            $ref: '#/components/schemas/TermMapping'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        defining_code:
          $ref: '#/components/schemas/CodePhrase'
      example:
        value: Coded text value
        defining_code:
          terminology_id:
            value: local
          code_string: at0001
      x-discriminator-value: DV_CODED_TEXT
    TermMapping:
      title: TERM_MAPPING
      required:
        - match
        - target
      type: object
      properties:
        match:
          pattern: /^[><=?]$/
          type: string
        purpose:
          $ref: '#/components/schemas/DvCodedText'
        target:
          $ref: '#/components/schemas/CodePhrase'
    UMDvText:
      title: DV_TEXT
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_TEXT
          type: string
        value:
          type: string
        hyperlink:
          $ref: '#/components/schemas/UDvUri'
        formatting:
          type: string
        mappings:
          type: array
          items:
            $ref: '#/components/schemas/TermMapping'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
      x-discriminator-value: DV_TEXT
    UMDvCodedText:
      title: DV_CODED_TEXT
      required:
        - value
        - defining_code
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_CODED_TEXT
          type: string
        value:
          type: string
        hyperlink:
          $ref: '#/components/schemas/UDvUri'
        formatting:
          type: string
        mappings:
          type: array
          items:
            $ref: '#/components/schemas/TermMapping'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        defining_code:
          $ref: '#/components/schemas/CodePhrase'
      x-discriminator-value: DV_CODED_TEXT
      example:
        value: Coded text value
        defining_code:
          terminology_id:
            value: local
          code_string: at0001
    UDvText:
      title: DV_TEXT
      oneOf:
        - $ref: '#/components/schemas/UMDvText'
        - $ref: '#/components/schemas/UMDvCodedText'
      discriminator:
        propertyName: _type
        mapping:
          DV_TEXT: '#/components/schemas/UMDvText'
          DV_CODED_TEXT: '#/components/schemas/UMDvCodedText'
      example:
        _type: DV_TEXT
        value: Text value
    ReferenceRange:
      title: REFERENCE_RANGE
      required:
        - meaning
        - range
      type: object
      properties:
        meaning:
          $ref: '#/components/schemas/UDvText'
        range:
          $ref: '#/components/schemas/DvInterval'
    DvDuration:
      title: DV_DURATION
      type: object
      properties:
        _type:
          type: string
          default: DV_DURATION
      x-discriminator-value: DV_DURATION
    DvDateTime:
      title: DV_DATE_TIME
      required:
        - value
      type: object
      properties:
        _type:
          type: string
          default: DV_DATE_TIME
        value:
          type: string
          format: date-time
      example:
        _type: DV_DATE_TIME
        value: '2017-08-15T10:37:15.422+02:00'
      x-discriminator-value: DV_DATE_TIME
    UUidBasedId:
      title: UID_BASED_ID
      oneOf:
        - $ref: '#/components/schemas/UMHierObjectId'
        - $ref: '#/components/schemas/UMObjectVersionId'
      discriminator:
        propertyName: _type
        mapping:
          HIER_OBJECT_ID: '#/components/schemas/UMHierObjectId'
          OBJECT_VERSION_ID: '#/components/schemas/UMObjectVersionId'
    Link:
      title: LINK
      required:
        - meaning
        - type
        - target
      type: object
      properties:
        meaning:
          $ref: '#/components/schemas/UDvText'
        type:
          $ref: '#/components/schemas/UDvText'
        target:
          $ref: '#/components/schemas/DvEhrUri'
    Archetyped:
      title: ARCHETYPED
      required:
        - archetype_id
        - rm_version
      type: object
      properties:
        archetype_id:
          $ref: '#/components/schemas/ArchetypeId'
        template_id:
          $ref: '#/components/schemas/TemplateId'
        rm_version:
          type: string
      example:
        archetype_id:
          value: openEHR-EHR-COMPOSITION.encounter.v1
        template_id:
          value: Example.v1::c7ec861c-c413-39ff-9965-a198ebf44747
        rm_version: 1.0.2
      additionalProperties: false
    DvIdentifier:
      title: DV_IDENTIFIER
      required:
        - id
      type: object
      properties:
        issuer:
          type: string
        assigner:
          type: string
        id:
          type: string
        type:
          type: string
      description: |
        Type for representing identifiers of real-world entities. Typical identifiers include drivers licence number, social security number, veterans affairs number, prescription id, order id, and so on.

        DV_IDENTIFIER is used to represent any identifier of a real thing, issued by some authority or agency.
      example:
        id: 16b74749-e6aa-4945-b760-b42bdc07098a
        type: Patient
      x-discriminator-value: DV_IDENTIFIER
    DvMultimedia:
      title: DV_MULTIMEDIA
      required:
        - _type
        - media_type
        - size
      type: object
      properties:
        _type:
          type: string
          default: DV_MULTIMEDIA
        charset:
          $ref: '#/components/schemas/CodePhrase'
        language:
          $ref: '#/components/schemas/CodePhrase'
        alternate_text:
          type: string
        uri:
          $ref: '#/components/schemas/UDvUri'
        data:
          type: string
        media_type:
          $ref: '#/components/schemas/CodePhrase'
        compression_algorithm:
          $ref: '#/components/schemas/CodePhrase'
        integrity_check:
          type: string
        integrity_check_algorithm:
          $ref: '#/components/schemas/CodePhrase'
        thumbnail:
          $ref: '#/components/schemas/DvMultimedia'
        size:
          type: integer
      x-discriminator-value: DV_MULTIMEDIA
    UMDvMultimedia:
      title: DV_MULTIMEDIA
      required:
        - _type
        - media_type
        - size
      type: object
      properties:
        _type:
          enum:
            - DV_MULTIMEDIA
          type: string
        charset:
          $ref: '#/components/schemas/CodePhrase'
        language:
          $ref: '#/components/schemas/CodePhrase'
        alternate_text:
          type: string
        uri:
          $ref: '#/components/schemas/UDvUri'
        data:
          type: string
        media_type:
          $ref: '#/components/schemas/CodePhrase'
        compression_algorithm:
          $ref: '#/components/schemas/CodePhrase'
        integrity_check:
          type: string
        integrity_check_algorithm:
          $ref: '#/components/schemas/CodePhrase'
        thumbnail:
          $ref: '#/components/schemas/DvMultimedia'
        size:
          type: integer
      x-discriminator-value: DV_MULTIMEDIA
    DvParsable:
      title: DV_PARSABLE
      required:
        - _type
        - value
        - formalism
      type: object
      properties:
        _type:
          type: string
          default: DV_PARSABLE
        charset:
          $ref: '#/components/schemas/CodePhrase'
        language:
          $ref: '#/components/schemas/CodePhrase'
        value:
          type: string
        formalism:
          type: string
      x-discriminator-value: DV_PARSABLE
    UMDvParsable:
      title: DV_PARSABLE
      required:
        - _type
        - value
        - formalism
      type: object
      properties:
        _type:
          enum:
            - DV_PARSABLE
          type: string
        charset:
          $ref: '#/components/schemas/CodePhrase'
        language:
          $ref: '#/components/schemas/CodePhrase'
        value:
          type: string
        formalism:
          type: string
      x-discriminator-value: DV_PARSABLE
    UDvEncapsulated:
      title: DV_ENCAPSULATED
      oneOf:
        - $ref: '#/components/schemas/UMDvMultimedia'
        - $ref: '#/components/schemas/UMDvParsable'
      discriminator:
        propertyName: _type
        mapping:
          DV_MULTIMEDIA: '#/components/schemas/UMDvMultimedia'
          DV_PARSABLE: '#/components/schemas/UMDvParsable'
    PartyRef:
      title: PARTY_REF
      required:
        - namespace
        - type
        - id
      type: object
      properties:
        namespace:
          type: string
        type:
          pattern: ^PERSON|ORGANISATION|GROUP|AGENT|ROLE|PARTY|ACTOR$
          type: string
        id:
          $ref: '#/components/schemas/UObjectId'
      description: Identifier for parties in a demographic or identity service.
      example:
        id:
          _type: OBJECT_VERSION_ID
          value: b52b9408-7048-4ec8-94bd-831fb0727e67::openEHRSys.example.com::1
        namespace: local
        type: PERSON
    UMPartyIdentified:
      title: PARTY_IDENTIFIED
      required:
        - _type
      type: object
      properties:
        _type:
          enum:
            - PARTY_IDENTIFIED
          type: string
        external_ref:
          $ref: '#/components/schemas/PartyRef'
        name:
          type: string
        identifiers:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
      x-discriminator-value: PARTY_IDENTIFIED
      example:
        _type: PARTY_IDENTIFIED
        external_ref:
          id:
            _type: GENERIC_ID
            value: 16b74749-e6aa-4945-b760-b42bdc07098a
            scheme: pid
          namespace: openEHRSys.example.com
          type: PERSON
        name: A name
    UMPartyRelated:
      title: PARTY_RELATED
      required:
        - _type
        - relationship
      type: object
      properties:
        _type:
          enum:
            - PARTY_RELATED
          type: string
        external_ref:
          $ref: '#/components/schemas/PartyRef'
        name:
          type: string
        identifiers:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
        relationship:
          $ref: '#/components/schemas/DvCodedText'
      x-discriminator-value: PARTY_RELATED
      example:
        _type: PARTY_IDENTIFIED
        external_ref:
          id:
            _type: GENERIC_ID
            value: 16b74749-e6aa-4945-b760-b42bdc07098a
            scheme: pid
          namespace: openEHRSys.example.com
          type: PERSON
        name: A name
    UPartyIdentified:
      title: PARTY_IDENTIFIED
      oneOf:
        - $ref: '#/components/schemas/UMPartyIdentified'
        - $ref: '#/components/schemas/UMPartyRelated'
      discriminator:
        propertyName: _type
        mapping:
          PARTY_IDENTIFIED: '#/components/schemas/UMPartyIdentified'
          PARTY_RELATED: '#/components/schemas/UMPartyRelated'
    UMPartySelf:
      title: PARTY_SELF
      required:
        - _type
      type: object
      properties:
        _type:
          enum:
            - PARTY_SELF
          type: string
        external_ref:
          $ref: '#/components/schemas/PartyRef'
      x-discriminator-value: PARTY_SELF
    UPartyProxy:
      title: PARTY_PROXY
      oneOf:
        - $ref: '#/components/schemas/UMPartySelf'
        - $ref: '#/components/schemas/UMPartyIdentified'
        - $ref: '#/components/schemas/UMPartyRelated'
      discriminator:
        propertyName: _type
        mapping:
          PARTY_SELF: '#/components/schemas/UMPartySelf'
          PARTY_IDENTIFIED: '#/components/schemas/UMPartyIdentified'
          PARTY_RELATED: '#/components/schemas/UMPartyRelated'
    UMDvBoolean:
      title: DV_BOOLEAN
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_BOOLEAN
          type: string
        value:
          type: boolean
      x-discriminator-value: DV_BOOLEAN
    UMDvCount:
      title: DV_COUNT
      required:
        - magnitude
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_COUNT
          type: string
        magnitude:
          type: integer
      x-discriminator-value: DV_COUNT
    DvDate:
      title: DV_DATE
      required:
        - value
      type: object
      properties:
        _type:
          type: string
          default: DV_DATE
        value:
          type: string
          format: date
      example:
        _type: DV_DATE
        value: '2017-08-15'
      x-discriminator-value: DV_DATE
    UMDvDate:
      title: DV_DATE
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_DATE
          type: string
        value:
          type: string
          format: date
      x-discriminator-value: DV_DATE
      example:
        _type: DV_DATE
        value: '2017-08-15'
    UMDvDateTime:
      title: DV_DATE_TIME
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_DATE_TIME
          type: string
        value:
          type: string
          format: date-time
      x-discriminator-value: DV_DATE_TIME
      example:
        _type: DV_DATE_TIME
        value: '2017-08-15T10:37:15.422+02:00'
    UMDvDuration:
      title: DV_DURATION
      required:
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_DURATION
          type: string
      x-discriminator-value: DV_DURATION
    UMDvIdentifier:
      title: DV_IDENTIFIER
      required:
        - id
        - _type
      type: object
      properties:
        issuer:
          type: string
        assigner:
          type: string
        id:
          type: string
        type:
          type: string
        _type:
          enum:
            - DV_IDENTIFIER
          type: string
      x-discriminator-value: DV_IDENTIFIER
      example:
        id: 16b74749-e6aa-4945-b760-b42bdc07098a
        type: Patient
    UMDvOrdinal:
      title: DV_ORDINAL
      required:
        - symbol
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_ORDINAL
          type: string
        symbol:
          $ref: '#/components/schemas/DvCodedText'
        value:
          type: integer
      x-discriminator-value: DV_ORDINAL
    UMDvProportion:
      title: DV_PROPORTION
      required:
        - numerator
        - denominator
        - semantic_type
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_PROPORTION
          type: string
        numerator:
          type: number
        denominator:
          type: number
        semantic_type:
          type: integer
        precision:
          type: integer
      x-discriminator-value: DV_PROPORTION
    UMDvQuantity:
      title: DV_QUANTITY
      required:
        - magnitude
        - units
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_QUANTITY
          type: string
        magnitude:
          type: number
        precision:
          type: integer
        units:
          type: string
        units_system:
          type: string
        units_display_name:
          type: string
      x-discriminator-value: DV_QUANTITY
    UMDvScale:
      title: DV_SCALE
      required:
        - symbol
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_SCALE
          type: string
        symbol:
          $ref: '#/components/schemas/DvCodedText'
        value:
          type: number
      x-discriminator-value: DV_SCALE
    UMDvState:
      title: DV_STATE
      required:
        - value
        - is_terminal
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_STATE
          type: string
        value:
          $ref: '#/components/schemas/DvCodedText'
        is_terminal:
          type: boolean
      x-discriminator-value: DV_STATE
    UMDvTime:
      title: DV_TIME
      required:
        - value
        - _type
      type: object
      properties:
        _type:
          enum:
            - DV_TIME
          type: string
        value:
          type: string
          format: time
      x-discriminator-value: DV_TIME
      example:
        _type: DV_DATE
        value: '2017-08-15'
    UDataValue:
      title: DATA_VALUE
      oneOf:
        - $ref: '#/components/schemas/UMDvBoolean'
        - $ref: '#/components/schemas/UMDvCodedText'
        - $ref: '#/components/schemas/UMDvCount'
        - $ref: '#/components/schemas/UMDvDate'
        - $ref: '#/components/schemas/UMDvDateTime'
        - $ref: '#/components/schemas/UMDvDuration'
        - $ref: '#/components/schemas/UMDvEhrUri'
        - $ref: '#/components/schemas/UMDvIdentifier'
        - $ref: '#/components/schemas/UMDvMultimedia'
        - $ref: '#/components/schemas/UMDvOrdinal'
        - $ref: '#/components/schemas/UMDvParsable'
        - $ref: '#/components/schemas/UMDvProportion'
        - $ref: '#/components/schemas/UMDvQuantity'
        - $ref: '#/components/schemas/UMDvScale'
        - $ref: '#/components/schemas/UMDvState'
        - $ref: '#/components/schemas/UMDvText'
        - $ref: '#/components/schemas/UMDvUri'
      discriminator:
        propertyName: _type
        mapping:
          DV_BOOLEAN: '#/components/schemas/UMDvBoolean'
          DV_CODED_TEXT: '#/components/schemas/UMDvCodedText'
          DV_COUNT: '#/components/schemas/UMDvCount'
          DV_DATE: '#/components/schemas/UMDvDate'
          DV_DATE_TIME: '#/components/schemas/UMDvDateTime'
          DV_DURATION: '#/components/schemas/UMDvDuration'
          DV_EHR_URI: '#/components/schemas/UMDvEhrUri'
          DV_IDENTIFIER: '#/components/schemas/UMDvIdentifier'
          DV_MULTIMEDIA: '#/components/schemas/UMDvMultimedia'
          DV_ORDINAL: '#/components/schemas/UMDvOrdinal'
          DV_PARSABLE: '#/components/schemas/UMDvParsable'
          DV_PROPORTION: '#/components/schemas/UMDvProportion'
          DV_QUANTITY: '#/components/schemas/UMDvQuantity'
          DV_SCALE: '#/components/schemas/UMDvScale'
          DV_STATE: '#/components/schemas/UMDvState'
          DV_TEXT: '#/components/schemas/UMDvText'
          DV_TIME: '#/components/schemas/UMDvTime'
          DV_URI: '#/components/schemas/UMDvUri'
    Element:
      title: ELEMENT
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: ELEMENT
        null_flavour:
          $ref: '#/components/schemas/DvCodedText'
        value:
          $ref: '#/components/schemas/UDataValue'
        null_reason:
          $ref: '#/components/schemas/UDvText'
      x-discriminator-value: ELEMENT
      required:
        - name
        - archetype_node_id
    ItemSingle:
      title: ITEM_SINGLE
      required:
        - name
        - archetype_node_id
        - item
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: ITEM_SINGLE
        item:
          $ref: '#/components/schemas/Element'
      x-discriminator-value: ITEM_SINGLE
    ItemList:
      title: ITEM_LIST
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: ITEM_LIST
        items:
          type: array
          items:
            $ref: '#/components/schemas/Element'
      x-discriminator-value: ITEM_LIST
      required:
        - name
        - archetype_node_id
    Clstr:
      title: CLUSTER
      required:
        - name
        - archetype_node_id
        - items
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: CLUSTER
        items:
          type: array
          items:
            $ref: '#/components/schemas/UItem'
      x-discriminator-value: CLUSTER
    UItem:
      title: ITEM
      oneOf:
        - $ref: '#/components/schemas/Element'
        - $ref: '#/components/schemas/Clstr'
      discriminator:
        propertyName: _type
        mapping:
          ELEMENT: '#/components/schemas/Element'
          CLUSTER: '#/components/schemas/Clstr'
    ItemTable:
      title: ITEM_TABLE
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: ITEM_TABLE
        items:
          type: array
          items:
            $ref: '#/components/schemas/Clstr'
      x-discriminator-value: ITEM_TABLE
      required:
        - name
        - archetype_node_id
    ItemTree:
      title: ITEM_TREE
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: ITEM_TREE
        items:
          type: array
          items:
            $ref: '#/components/schemas/UItem'
      x-discriminator-value: ITEM_TREE
      required:
        - name
        - archetype_node_id
    UItemStructure:
      title: ITEM_STRUCTURE
      oneOf:
        - $ref: '#/components/schemas/ItemSingle'
        - $ref: '#/components/schemas/ItemList'
        - $ref: '#/components/schemas/ItemTable'
        - $ref: '#/components/schemas/ItemTree'
      discriminator:
        propertyName: _type
        mapping:
          ITEM_SINGLE: '#/components/schemas/ItemSingle'
          ITEM_LIST: '#/components/schemas/ItemList'
          ITEM_TABLE: '#/components/schemas/ItemTable'
          ITEM_TREE: '#/components/schemas/ItemTree'
    FeederAuditDetails:
      title: FEEDER_AUDIT_DETAILS
      required:
        - system_id
      type: object
      properties:
        system_id:
          type: string
        location:
          $ref: '#/components/schemas/UPartyIdentified'
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        provider:
          $ref: '#/components/schemas/UPartyIdentified'
        time:
          $ref: '#/components/schemas/DvDateTime'
        version_id:
          type: string
        other_details:
          $ref: '#/components/schemas/UItemStructure'
    FeederAudit:
      title: FEEDER_AUDIT
      required:
        - originating_system_audit
      type: object
      properties:
        originating_system_item_ids:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
        feeder_system_item_ids:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
        original_content:
          $ref: '#/components/schemas/UDvEncapsulated'
        originating_system_audit:
          $ref: '#/components/schemas/FeederAuditDetails'
        feeder_system_audit:
          $ref: '#/components/schemas/FeederAuditDetails'
    DvIntervalOfDateTime:
      title: DV_INTERVAL_of_DATE_TIME
      type: object
      properties:
        _type:
          type: string
          default: DV_INTERVAL
        lower_unbounded:
          type: boolean
        upper_unbounded:
          type: boolean
        lower_included:
          type: boolean
        upper_included:
          type: boolean
        lower:
          $ref: '#/components/schemas/UMDvDateTime'
        upper:
          $ref: '#/components/schemas/UMDvDateTime'
      x-discriminator-value: DV_INTERVAL_of_DATE_TIME
      required:
        - lower_unbounded
        - upper_unbounded
        - lower_included
        - upper_included
    Participation:
      title: PARTICIPATION
      required:
        - function
        - performer
      type: object
      properties:
        function:
          $ref: '#/components/schemas/UDvText'
        mode:
          $ref: '#/components/schemas/DvCodedText'
        performer:
          $ref: '#/components/schemas/UPartyProxy'
        time:
          $ref: '#/components/schemas/DvIntervalOfDateTime'
    EventContext:
      title: EVENT_CONTEXT
      required:
        - start_time
        - setting
      type: object
      properties:
        start_time:
          $ref: '#/components/schemas/DvDateTime'
        end_time:
          $ref: '#/components/schemas/DvDateTime'
        location:
          type: string
        setting:
          $ref: '#/components/schemas/DvCodedText'
        other_context:
          $ref: '#/components/schemas/UItemStructure'
        health_care_facility:
          $ref: '#/components/schemas/UPartyIdentified'
        participations:
          type: array
          items:
            $ref: '#/components/schemas/Participation'
      x-discriminator-value: EVENT_CONTEXT
    UMAdminEntry:
      title: ADMIN_ENTRY
      required:
        - name
        - archetype_node_id
        - language
        - encoding
        - subject
        - data
        - _type
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        other_participations:
          type: array
          items:
            $ref: '#/components/schemas/Participation'
        workflow_id:
          $ref: '#/components/schemas/ObjectRef'
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        provider:
          $ref: '#/components/schemas/UPartyProxy'
        _type:
          enum:
            - ADMIN_ENTRY
          type: string
        data:
          $ref: '#/components/schemas/UItemStructure'
      x-discriminator-value: ADMIN_ENTRY
    Event:
      title: EVENT
      required:
        - name
        - archetype_node_id
        - time
        - data
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: EVENT
        time:
          $ref: '#/components/schemas/DvDateTime'
        state:
          $ref: '#/components/schemas/UItemStructure'
        data:
          $ref: '#/components/schemas/UItemStructure'
      x-discriminator-value: EVENT
    History:
      title: HISTORY
      required:
        - name
        - archetype_node_id
        - origin
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: HISTORY
        origin:
          $ref: '#/components/schemas/DvDateTime'
        period:
          $ref: '#/components/schemas/DvDuration'
        duration:
          $ref: '#/components/schemas/DvDuration'
        summary:
          $ref: '#/components/schemas/UItemStructure'
        events:
          type: array
          items:
            $ref: '#/components/schemas/Event'
      x-discriminator-value: HISTORY
    UMObservation:
      title: OBSERVATION
      required:
        - name
        - archetype_node_id
        - language
        - encoding
        - subject
        - data
        - _type
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        other_participations:
          type: array
          items:
            $ref: '#/components/schemas/Participation'
        workflow_id:
          $ref: '#/components/schemas/ObjectRef'
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        provider:
          $ref: '#/components/schemas/UPartyProxy'
        protocol:
          $ref: '#/components/schemas/UItemStructure'
        guideline_id:
          $ref: '#/components/schemas/ObjectRef'
        _type:
          enum:
            - OBSERVATION
          type: string
        data:
          $ref: '#/components/schemas/History'
        state:
          $ref: '#/components/schemas/History'
      x-discriminator-value: OBSERVATION
    UMEvaluation:
      title: EVALUATION
      required:
        - name
        - archetype_node_id
        - language
        - encoding
        - subject
        - data
        - _type
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        other_participations:
          type: array
          items:
            $ref: '#/components/schemas/Participation'
        workflow_id:
          $ref: '#/components/schemas/ObjectRef'
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        provider:
          $ref: '#/components/schemas/UPartyProxy'
        protocol:
          $ref: '#/components/schemas/UItemStructure'
        guideline_id:
          $ref: '#/components/schemas/ObjectRef'
        _type:
          enum:
            - EVALUATION
          type: string
        data:
          $ref: '#/components/schemas/UItemStructure'
      x-discriminator-value: EVALUATION
    Activity:
      title: ACTIVITY
      required:
        - name
        - archetype_node_id
        - action_archetype_id
        - description
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        _type:
          type: string
          default: ACTIVITY
        timing:
          $ref: '#/components/schemas/DvParsable'
        action_archetype_id:
          type: string
        description:
          $ref: '#/components/schemas/UItemStructure'
      x-discriminator-value: ACTIVITY
    UMInstruction:
      title: INSTRUCTION
      required:
        - name
        - archetype_node_id
        - language
        - encoding
        - subject
        - narrative
        - _type
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        other_participations:
          type: array
          items:
            $ref: '#/components/schemas/Participation'
        workflow_id:
          $ref: '#/components/schemas/ObjectRef'
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        provider:
          $ref: '#/components/schemas/UPartyProxy'
        protocol:
          $ref: '#/components/schemas/UItemStructure'
        guideline_id:
          $ref: '#/components/schemas/ObjectRef'
        _type:
          enum:
            - INSTRUCTION
          type: string
        narrative:
          $ref: '#/components/schemas/UDvText'
        expiry_time:
          $ref: '#/components/schemas/DvDateTime'
        wf_definition:
          $ref: '#/components/schemas/DvParsable'
        activities:
          type: array
          items:
            $ref: '#/components/schemas/Activity'
      x-discriminator-value: INSTRUCTION
    IsmTransition:
      title: ISM_TRANSITION
      required:
        - current_state
      type: object
      properties:
        _type:
          type: string
          default: ISM_TRANSITION
        current_state:
          $ref: '#/components/schemas/DvCodedText'
        transition:
          $ref: '#/components/schemas/DvCodedText'
        careflow_step:
          $ref: '#/components/schemas/DvCodedText'
        reason:
          type: array
          items:
            $ref: '#/components/schemas/UDvText'
      x-discriminator-value: ISM_TRANSITION
    LocatableRef:
      title: LOCATABLE_REF
      required:
        - namespace
        - type
        - id
      type: object
      properties:
        namespace:
          type: string
        type:
          type: string
        id:
          $ref: '#/components/schemas/UUidBasedId'
        path:
          type: string
    InstructionDetails:
      title: INSTRUCTION_DETAILS
      required:
        - instruction_id
        - activity_id
      type: object
      properties:
        _type:
          type: string
          default: INSTRUCTION_DETAILS
        instruction_id:
          $ref: '#/components/schemas/LocatableRef'
        activity_id:
          type: string
        wf_details:
          $ref: '#/components/schemas/UItemStructure'
      x-discriminator-value: INSTRUCTION_DETAILS
    UMAction:
      title: ACTION
      required:
        - name
        - archetype_node_id
        - language
        - encoding
        - subject
        - time
        - ism_transition
        - description
        - _type
      type: object
      properties:
        name:
          $ref: '#/components/schemas/UDvText'
        archetype_node_id:
          type: string
          xml:
            attribute: true
        uid:
          $ref: '#/components/schemas/UUidBasedId'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        archetype_details:
          $ref: '#/components/schemas/Archetyped'
        feeder_audit:
          $ref: '#/components/schemas/FeederAudit'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        other_participations:
          type: array
          items:
            $ref: '#/components/schemas/Participation'
        workflow_id:
          $ref: '#/components/schemas/ObjectRef'
        subject:
          $ref: '#/components/schemas/UPartyProxy'
        provider:
          $ref: '#/components/schemas/UPartyProxy'
        protocol:
          $ref: '#/components/schemas/UItemStructure'
        guideline_id:
          $ref: '#/components/schemas/ObjectRef'
        _type:
          enum:
            - ACTION
          type: string
        time:
          $ref: '#/components/schemas/DvDateTime'
        ism_transition:
          $ref: '#/components/schemas/IsmTransition'
        instruction_details:
          $ref: '#/components/schemas/InstructionDetails'
        description:
          $ref: '#/components/schemas/UItemStructure'
      x-discriminator-value: ACTION
    UContentItem:
      title: CONTENT_ITEM
      oneOf:
        - $ref: '#/components/schemas/UMAdminEntry'
        - $ref: '#/components/schemas/UMObservation'
        - $ref: '#/components/schemas/UMEvaluation'
        - $ref: '#/components/schemas/UMInstruction'
        - $ref: '#/components/schemas/UMAction'
      discriminator:
        propertyName: _type
        mapping:
          ADMIN_ENTRY: '#/components/schemas/UMAdminEntry'
          OBSERVATION: '#/components/schemas/UMObservation'
          EVALUATION: '#/components/schemas/UMEvaluation'
          INSTRUCTION: '#/components/schemas/UMInstruction'
          ACTION: '#/components/schemas/UMAction'
    AuditDetails:
      title: AUDIT_DETAILS
      required:
        - system_id
        - time_committed
        - change_type
        - committer
      type: object
      properties:
        _type:
          type: string
          default: AUDIT_DETAILS
        system_id:
          type: string
        time_committed:
          $ref: '#/components/schemas/DvDateTime'
        change_type:
          $ref: '#/components/schemas/DvCodedText'
        description:
          $ref: '#/components/schemas/UDvText'
        committer:
          $ref: '#/components/schemas/UPartyProxy'
      description: The set of attributes required to document the committal of an information item to a repository.
      example:
        system_id: 9624982A-9F42-41A5-9318-AE13D5F5031F
        committer:
          _type: PARTY_IDENTIFIED
          name: A user name
        time_committed:
          value: '2017-08-15T10:37:15.422+02:00'
        change_type:
          value: creation
          defining_code:
            terminology_id:
              value: openehr
            code_string: '249'
        description:
          value: Description text
      x-discriminator-value: AUDIT_DETAILS
    TerminologyCode:
      title: TERMINOLOGY_CODE
      required:
        - terminology_id
        - code_string
      type: object
      properties:
        terminology_id:
          type: string
        terminology_version:
          type: string
        code_string:
          type: string
        uri:
          type: string
          format: uri
      example:
        terminology_id: snomed_ct
        code_string: '308335008'
    UpdateAudit:
      title: UPDATE_AUDIT
      required:
        - change_type
        - committer
      type: object
      properties:
        _type:
          type: string
          default: UPDATE_AUDIT
        change_type:
          $ref: '#/components/schemas/TerminologyCode'
        description:
          $ref: '#/components/schemas/UDvText'
        committer:
          $ref: '#/components/schemas/UPartyProxy'
      description: The set of attributes required to document the committal of an information item to a repository. Used by the server to create an AUDIT_DETAILS object.
      example:
        change_type:
          value: creation
          defining_code:
            terminology_id: openehr
            code_string: '249'
        description: Description text
        committer:
          _type: PARTY_IDENTIFIED
          name: A user name
      x-discriminator-value: UPDATE_AUDIT
    UpdateAttestation:
      title: UPDATE_ATTESTATION
      required:
        - change_type
        - committer
        - reason
        - is_pending
      type: object
      properties:
        _type:
          type: string
          default: UPDATE_ATTESTATION
        change_type:
          $ref: '#/components/schemas/TerminologyCode'
        description:
          $ref: '#/components/schemas/UDvText'
        committer:
          $ref: '#/components/schemas/UPartyProxy'
        attested_view:
          $ref: '#/components/schemas/DvMultimedia'
        proof:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/DvEhrUri'
        reason:
          $ref: '#/components/schemas/UDvText'
        is_pending:
          type: boolean
      x-discriminator-value: UPDATE_ATTESTATION
      example:
        change_type:
          value: creation
          defining_code:
            terminology_id: openehr
            code_string: '249'
        description: Description text
        committer:
          _type: PARTY_IDENTIFIED
          name: A user name
    UVersionable:
      title: Versionable
      oneOf:
        - $ref: '#/components/schemas/Composition'
        - $ref: '#/components/schemas/EhrStatus'
      discriminator:
        propertyName: _type
        mapping:
          COMPOSITION: '#/components/schemas/Composition'
          EHR_STATUS: '#/components/schemas/EhrStatus'
    UpdateVersion:
      title: UPDATE_VERSION
      required:
        - lifecycle_state
        - data
        - commit_audit
      type: object
      properties:
        preceding_version_uid:
          $ref: '#/components/schemas/ObjectVersionId'
        signature:
          type: string
        lifecycle_state:
          $ref: '#/components/schemas/TerminologyCode'
        attestations:
          type: array
          items:
            $ref: '#/components/schemas/UpdateAttestation'
        data:
          $ref: '#/components/schemas/UVersionable'
        commit_audit:
          $ref: '#/components/schemas/UpdateAudit'
    AQL:
      title: AQL
      type: string
      description: |
        The given AQL query.
      example: SELECT e/ehr_id/value, c/context/start_time/value as startTime, obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic, c/uid/value AS cid, c/name FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION obs[openEHR-EHR-OBSERVATION.blood_pressure.v1] WHERE obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude >= $systolic_bp
    Offset:
      title: Offset
      type: integer
      description: |
        The row number in result-set to start result-set from (`0`-based), default is `0`.
      format: int32
      default: 0
      example: 10
    Fetch:
      title: Fetch
      type: integer
      description: |
        Number of rows to fetch (the default depends on the implementation).
      format: int32
      example: 10
    QueryParameters:
      title: QueryParameters
      type: object
      description: |
        A set of query parameters.
      example:
        ehr_id: 7d44b88c-4199-4bad-97dc-d78268e01398
        systolic_bp: 140
      additionalProperties: true
    ResultSetMetadata:
      title: ResultSetMetadata
      type: object
      properties:
        _href:
          type: string
          description: URL of the executed query (only for GET endpoint).
          format: uri
        _type:
          type: string
          description: The type of the serialized result object.
        _schema_version:
          type: string
          description: The version of the specification defining the serialized object.
        _created:
          type: string
          description: Result creation time (in the extended ISO 8601 format).
          format: date-time
        _generator:
          type: string
          description: Some identifier of the application that generated the result, useful for debugging.
        _executed_aql:
          type: string
          description: |
            The actual AQL query that was executed by the server, after replacing the query parameters. 
            This attribute is not mandatory, but is useful for debugging.
      description: |
        RESULT_SET metadata.
      example:
        _href: https://openEHRSys.example.com/v1/query/org.openehr::compositions
        _type: RESULTSET
        _schema_version: 1.0.0
        _created: '2017-08-19T00:25:47.568+02:00'
        _generator: openEHRSys.ResultSets.Serialization.Json.ResultSetJsonWriter (5.0.0.0)
        _executed_aql: SELECT e/ehr_id/value, c/context/start_time/value as startTime, obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic, c/uid/value AS cid, c/name FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION obs[openEHR-EHR-OBSERVATION.blood_pressure.v1] WHERE obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude >= 50
      additionalProperties: true
    QueryName:
      title: QueryName
      type: string
      description: |
        The (fully qualified) name of the query (when is registered as a stored query), in a format of `[{namespace}::]{query-name}`. 
        The `namespace` prefix is optional, and when used it should be in a form of a reverse domain name.
      example: org.openehr::compositions
    ResultSetColumn:
      title: RESULT_SET_COLUMN
      required:
        - name
      type: object
      properties:
        name:
          type: string
          description: |
            Name of the column. 
            When column alias is not present in the AQL, a `0`-based column index is used prefixed by a hash sign (i.e. `#0`, `#1`...)
        path:
          type: string
          description: |
            Path from the given AQL of the specified column.
      description: |
        An AQL column specification (e.g. a pair of column `name` and associated AQL `path`).
      example:
        name: '#0'
        path: /ehr_id/value
    ResultSetRow:
      title: RESULT_SET_ROW
      type: array
      items: {}
      description: |
        A set of cells representing a RESULT_SET row, one cell for each column. 
        Content of a cell is `ANY` (i.e. a `OBJECT` in most programming languages).
      example:
        - 81433066-c417-4813-9b29-79783e7bed23
        - '2017-02-16T13:50:11.308+01:00'
        - 140
        - 90910cf0-66a0-4382-b1f8-c0f27e81b42d::openEHRSys.example.com::1
        - _type: DV_TEXT
          value: Labs
    QueryType:
      title: QueryType
      type: string
      description: |
        Query formalism type.
      default: AQL
      example: AQL
    QueryVersion:
      title: QueryVersion
      type: string
      description: |
        The SEMVER version number of the Stored Query.
      example: 1.0.1
    StoredQuery:
      title: StoredQuery
      required:
        - name
        - type
        - version
        - saved
        - q
      type: object
      properties:
        name:
          $ref: '#/components/schemas/QueryName'
        type:
          $ref: '#/components/schemas/QueryType'
        version:
          $ref: '#/components/schemas/QueryVersion'
        saved:
          type: string
          format: date-time
        q:
          $ref: '#/components/schemas/AQL'
      description: |
        Stored Query content meta information.
      example:
        name: org.openehr::compositions
        type: aql
        version: 1.0.1
        saved: '2017-07-16T19:20:30.450+01:00'
        q: SELECT c FROM EHR e[ehr_id/value=$ehr_id] CONTAINS COMPOSITION c[$compositionid] WHERE c/name/value = 'Vitals'
    LocalizedNames:
      title: LocalizedNames
      required:
        - en
      type: object
      properties:
        en:
          type: string
      example:
        en: Vital Signs
    LocalizedDescriptions:
      title: LocalizedDescriptions
      required:
        - sl
      type: object
      properties:
        sl:
          type: string
      example:
        sl: Generic encounter or progress note composition
    LocalizedNames1:
      title: LocalizedNames1
      required:
        - sl
      type: object
      properties:
        sl:
          type: string
      example:
        sl: Podrobnosti
    LocalizedNames2:
      title: LocalizedNames2
      required:
        - sl
      type: object
      properties:
        sl:
          type: string
        en:
          type: string
      example:
        sl: Tagi
    Annotations:
      title: Annotations
      type: object
      properties:
        comment:
          type: string
        default:
          type: string
      example:
        comment: Tags applied to the composition. They can contain various ids, such as episode id, central case id or other types of information forming composition meta-data.
    Precision:
      title: Precision
      required:
        - minOp
        - min
        - maxOp
        - max
      type: object
      properties:
        minOp:
          type: string
        min:
          type: integer
          format: int32
        maxOp:
          type: string
        max:
          type: integer
          format: int32
      example:
        minOp: '>='
        min: 1
        maxOp: <=
        max: 1
    Range:
      title: Range
      required:
        - minOp
        - min
      type: object
      properties:
        minOp:
          type: string
        min:
          type: integer
          format: int32
        maxOp:
          type: string
        max:
          type: integer
          format: int32
      example:
        minOp: '>='
        min: 0
        maxOp: <
        max: 1000
    Validation:
      title: Validation
      type: object
      properties:
        precision:
          $ref: '#/components/schemas/Precision'
        range:
          $ref: '#/components/schemas/Range'
      example:
        precision:
          minOp: '>='
          min: 1
          maxOp: <=
          max: 1
    LocalizedLabels:
      title: LocalizedLabels
      required:
        - sl
      type: object
      properties:
        sl:
          type: string
      example:
        sl: Gol
    List:
      title: List
      required:
        - value
        - label
      type: object
      properties:
        value:
          type: string
        label:
          type: string
        validation:
          $ref: '#/components/schemas/Validation'
        localizedLabels:
          $ref: '#/components/schemas/LocalizedLabels'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
      example:
        value: °C
        label: °C
        validation:
          precision:
            minOp: '>='
            min: 1
            maxOp: <=
            max: 1
    Validation1:
      title: Validation1
      required:
        - range
      type: object
      properties:
        range:
          $ref: '#/components/schemas/Range'
        precision:
          $ref: '#/components/schemas/Precision'
      example:
        range:
          minOp: '>='
          min: 0
          maxOp: <
          max: 1000
        precision:
          minOp: '>='
          min: 0
          maxOp: <=
          max: 0
    Input:
      title: Input
      required:
        - type
      type: object
      properties:
        type:
          type: string
        suffix:
          type: string
        list:
          type: array
          items:
            $ref: '#/components/schemas/List'
          description: ''
        defaultValue:
          type: string
        validation:
          $ref: '#/components/schemas/Validation1'
      example:
        type: TEXT
    SNOMEDCT:
      title: SNOMEDCT
      required:
        - value
        - terminologyId
      type: object
      properties:
        value:
          type: string
        terminologyId:
          type: string
      example:
        value: '163030003'
        terminologyId: SNOMED-CT(2003)
    TermBindings:
      title: TermBindings
      required:
        - SNOMED-CT
      type: object
      properties:
        SNOMED-CT:
          $ref: '#/components/schemas/SNOMEDCT'
      example:
        SNOMED-CT:
          value: '163030003'
          terminologyId: SNOMED-CT(2003)
    Input1:
      title: Input1
      required:
        - type
      type: object
      properties:
        type:
          type: string
        suffix:
          type: string
      example:
        type: INTEGER
    Child3:
      title: Child3
      required:
        - id
        - localizedName
        - rmType
        - nodeId
        - min
        - max
        - localizedNames
        - localizedDescriptions
        - aqlPath
        - inputs
      type: object
      properties:
        id:
          type: string
        localizedName:
          type: string
        rmType:
          type: string
        nodeId:
          type: string
        min:
          type: integer
          format: int32
        max:
          type: integer
          format: int32
        localizedNames:
          $ref: '#/components/schemas/LocalizedNames1'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
        aqlPath:
          type: string
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/Input1'
          description: ''
        name:
          type: string
      example:
        id: count_value
        localizedName: Size
        rmType: DV_COUNT
        nodeId: ''
        min: 0
        max: 1
        localizedNames:
          sl: Velikost
        localizedDescriptions:
          sl: Velikost naprave
        aqlPath: /content[openEHR-EHR-OBSERVATION.blood_pressure.v1]/protocol[at0011]/items[openEHR-EHR-CLUSTER.device.v1]/items[at0016]/value
        inputs:
          - type: INTEGER
    Child2:
      title: Child2
      required:
        - id
        - name
        - localizedName
        - rmType
        - nodeId
        - min
        - max
        - localizedNames
        - localizedDescriptions
        - aqlPath
        - inputs
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        localizedName:
          type: string
        rmType:
          type: string
        nodeId:
          type: string
        min:
          type: integer
          format: int32
        max:
          type: integer
          format: int32
        localizedNames:
          $ref: '#/components/schemas/LocalizedNames2'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
        annotations:
          $ref: '#/components/schemas/Annotations'
        aqlPath:
          type: string
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/Input'
          description: ''
        dependsOn:
          type: array
          items:
            type: string
          description: ''
        inContext:
          type: boolean
        termBindings:
          $ref: '#/components/schemas/TermBindings'
        children:
          type: array
          items:
            $ref: '#/components/schemas/Child3'
          description: ''
      example:
        id: tags
        name: Tags
        localizedName: Tags
        rmType: DV_TEXT
        nodeId: at0008
        min: 1
        max: -1
        localizedNames:
          sl: Tagi
        localizedDescriptions:
          sl: '*'
        annotations:
          comment: Tags applied to the composition. They can contain various ids, such as episode id, central case id or other types of information forming composition meta-data.
        aqlPath: /context/other_context[at0001]/items[openEHR-EHR-CLUSTER.context_detail.v1]/items[at0008]/value
        inputs:
          - type: TEXT
    List1:
      title: List1
      required:
        - value
        - label
        - localizedLabels
        - localizedDescriptions
      type: object
      properties:
        value:
          type: string
        label:
          type: string
        localizedLabels:
          $ref: '#/components/schemas/LocalizedLabels'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
      example:
        value: at0022
        label: Mouth
        localizedLabels:
          sl: Usta
        localizedDescriptions:
          sl: '*Temperature is measured within the mouth(en)'
    Input2:
      title: Input2
      required:
        - type
      type: object
      properties:
        type:
          type: string
        suffix:
          type: string
        list:
          type: array
          items:
            $ref: '#/components/schemas/List1'
          description: ''
      example:
        type: DATETIME
    Annotations1:
      title: Annotations1
      type: object
      properties:
        comment:
          type: string
        view:pass_through:
          type: string
      example:
        comment: 'Perloff D, Grim C, Flack J, Frohlich ED, Hill M, McDonald M, Morgenstern BZ. Human blood pressure determination by sphygmomanometry. Circulation 1993;88;2460-2470. '
    Child1:
      title: Child1
      required:
        - id
        - name
        - rmType
        - min
        - max
        - aqlPath
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        localizedName:
          type: string
        rmType:
          type: string
        nodeId:
          type: string
        min:
          type: integer
          format: int32
        max:
          type: integer
          format: int32
        localizedNames:
          $ref: '#/components/schemas/LocalizedNames1'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
        aqlPath:
          type: string
        children:
          type: array
          items:
            $ref: '#/components/schemas/Child2'
          description: ''
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/Input2'
          description: ''
        inContext:
          type: boolean
        dependsOn:
          type: array
          items:
            type: string
          description: ''
        annotations:
          $ref: '#/components/schemas/Annotations1'
        termBindings:
          $ref: '#/components/schemas/TermBindings'
        proportionTypes:
          type: array
          items:
            type: string
          description: ''
      example:
        id: context_detail
        name: Context detail
        localizedName: Context detail
        rmType: CLUSTER
        nodeId: openEHR-EHR-CLUSTER.context_detail.v1
        min: 0
        max: -1
        localizedNames:
          sl: Podrobnosti
        localizedDescriptions:
          sl: Dodatni podatki o kontekstu
        aqlPath: /context/other_context[at0001]/items[openEHR-EHR-CLUSTER.context_detail.v1]
        children:
          - id: tags
            name: Tags
            localizedName: Tags
            rmType: DV_TEXT
            nodeId: at0008
            min: 1
            max: -1
            localizedNames:
              sl: Tagi
            localizedDescriptions:
              sl: '*'
            annotations:
              comment: Tags applied to the composition. They can contain various ids, such as episode id, central case id or other types of information forming composition meta-data.
            aqlPath: /context/other_context[at0001]/items[openEHR-EHR-CLUSTER.context_detail.v1]/items[at0008]/value
            inputs:
              - type: TEXT
    List2:
      title: List2
      required:
        - value
        - label
        - localizedLabels
      type: object
      properties:
        value:
          type: string
        label:
          type: string
        localizedLabels:
          $ref: '#/components/schemas/LocalizedLabels'
      example:
        value: '433'
        label: event
        localizedLabels:
          sl: ''
    Input3:
      title: Input3
      required:
        - suffix
        - type
      type: object
      properties:
        suffix:
          type: string
        type:
          type: string
        list:
          type: array
          items:
            $ref: '#/components/schemas/List2'
          description: ''
        terminology:
          type: string
      example:
        suffix: code
        type: CODED_TEXT
        list:
          - value: '433'
            label: event
            localizedLabels:
              sl: ''
        terminology: openehr
    Child:
      title: Child
      required:
        - id
        - rmType
        - min
        - max
        - aqlPath
      type: object
      properties:
        id:
          type: string
        rmType:
          type: string
        nodeId:
          type: string
        min:
          type: integer
          format: int32
        max:
          type: integer
          format: int32
        aqlPath:
          type: string
        children:
          type: array
          items:
            $ref: '#/components/schemas/Child1'
          description: ''
        name:
          type: string
        localizedName:
          type: string
        localizedNames:
          $ref: '#/components/schemas/LocalizedNames1'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
        termBindings:
          $ref: '#/components/schemas/TermBindings'
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/Input3'
          description: ''
        inContext:
          type: boolean
      example:
        id: context
        rmType: EVENT_CONTEXT
        nodeId: ''
        min: 1
        max: 1
        aqlPath: /context
        children:
          - id: context_detail
            name: Context detail
            localizedName: Context detail
            rmType: CLUSTER
            nodeId: openEHR-EHR-CLUSTER.context_detail.v1
            min: 0
            max: -1
            localizedNames:
              sl: Podrobnosti
            localizedDescriptions:
              sl: Dodatni podatki o kontekstu
            aqlPath: /context/other_context[at0001]/items[openEHR-EHR-CLUSTER.context_detail.v1]
            children:
              - id: tags
                name: Tags
                localizedName: Tags
                rmType: DV_TEXT
                nodeId: at0008
                min: 1
                max: -1
                localizedNames:
                  sl: Tagi
                localizedDescriptions:
                  sl: '*'
                annotations:
                  comment: Tags applied to the composition. They can contain various ids, such as episode id, central case id or other types of information forming composition meta-data.
                aqlPath: /context/other_context[at0001]/items[openEHR-EHR-CLUSTER.context_detail.v1]/items[at0008]/value
                inputs:
                  - type: TEXT
          - id: start_time
            name: Start_time
            rmType: DV_DATE_TIME
            min: 0
            max: 1
            aqlPath: /context/start_time
            inputs:
              - type: DATETIME
            inContext: true
          - id: setting
            name: Setting
            rmType: DV_CODED_TEXT
            min: 0
            max: 1
            aqlPath: /context/setting
            inputs:
              - suffix: code
                type: TEXT
              - suffix: value
                type: TEXT
            inContext: true
    Tree:
      title: Tree
      required:
        - id
        - name
        - localizedName
        - rmType
        - nodeId
        - min
        - max
        - localizedNames
        - localizedDescriptions
        - aqlPath
        - children
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        localizedName:
          type: string
        rmType:
          type: string
        nodeId:
          type: string
        min:
          type: integer
          format: int32
        max:
          type: integer
          format: int32
        localizedNames:
          $ref: '#/components/schemas/LocalizedNames'
        localizedDescriptions:
          $ref: '#/components/schemas/LocalizedDescriptions'
        aqlPath:
          type: string
        children:
          type: array
          items:
            $ref: '#/components/schemas/Child'
x-tagGroups:
  - name: EHR Resources
    tags:
      - EHR_schema
      - EHR_STATUS_schema
      - COMPOSITION_schema
      - DIRECTORY_schema
      - CONTRIBUTION_schema
  - name: Query Resources
    tags:
      - Query_schema
      - RESULT_SET_schema
  - name: Definition Resources
    tags:
      - TemplateList_schema
      - Template_schema
      - StoredQuery_schema
