openapi: 3.1.0
info:
  title: EHRbase API
  description: >-
    EHRbase implements the [official openEHR REST
    API](https://specifications.openehr.org/releases/ITS-REST/latest/).
    Additionally, EHRbase provides a custom `status` heartbeat endpoint, an
    [Admin API](https://docs.ehrbase.org/docs/EHRbase/Explore/Admin-REST) (if
    activated) and a [Status and Metrics
    API](https://docs.ehrbase.org/docs/EHRbase/Explore/Status-And-Metrics) (if
    activated) for monitoring and maintenance.  Note: The openEHR REST API is
    documented in their official documentation, not here. Please refer to their
    separate documentation.
  license:
    name: Apache 2.0
    url: https://github.com/ehrbase/ehrbase/blob/develop/LICENSE.md
  version: v1
externalDocs:
  description: EHRbase Documentation
  url: https://docs.ehrbase.org/
servers:
  - url: http://localhost:8080/ehrbase
    description: Generated server url
paths:
  /rest/admin/template/{template_id}:
    put:
      tags:
        - Admin - Template
      operationId: updateTemplate
      parameters:
        - name: Accept
          in: header
          description: Client should specify expected format
          required: false
          schema:
            type: string
            default: application/xml
        - name: Content-Type
          in: header
          description: Client may request content format
          required: true
          schema:
            type: string
        - name: template_id
          in: path
          description: >-
            Target template id to update. The value comes from the 'template_id'
            property.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/xml:
            schema:
              type: string
              description: New template content to replace old one with
        required: true
      responses:
        '200':
          description: Template has been updated successfully.
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/xml:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '401':
          description: Client credentials are invalid or have expired.
          content:
            application/xml:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '403':
          description: Client has no access permission since admin role is missing.
          content:
            application/xml:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '404':
          description: Template could not be found.
          content:
            application/xml:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '422':
          description: >-
            Template could not be replaced since it is used in at least one
            Composition.
          content:
            application/xml:
              schema:
                type: string
            application/json:
              schema:
                type: string
    delete:
      tags:
        - Admin - Template
      operationId: deleteTemplate
      parameters:
        - name: template_id
          in: path
          description: >-
            Target template id to delete. The value comes from the 'template_id'
            property.
          required: true
          schema:
            type: string
      responses:
        '202':
          description: Template has been deleted successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '401':
          description: Client credentials are invalid or have expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '403':
          description: Client has no access permission since admin role is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '404':
          description: Template could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '422':
          description: The template is still used by compositions and cannot be deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
  /rest/admin/ehr/{ehr_id}:
    put:
      tags:
        - Admin - EHR
      operationId: updateEhr
      parameters:
        - name: Accept
          in: header
          description: Client requested response content type
          required: false
          schema:
            type: string
        - name: ehr_id
          in: path
          description: Target EHR id to update
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            EHR has been updated and number of updated items will be returned in
            the body.
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
        '403':
          description: >-
            Client is not permitted to access this resource since the admin role
            is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
        '404':
          description: EHR with id could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
    delete:
      tags:
        - Admin - EHR
      operationId: deleteEhr
      parameters:
        - name: ehr_id
          in: path
          description: Target EHR id to delete
          required: true
          schema:
            type: string
      responses:
        '204':
          description: EHR has been deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '403':
          description: >-
            Client is not permitted to access this resource since the admin role
            is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '404':
          description: EHR with id could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
  /rest/admin/ehr/{ehr_id}/contribution/{contribution_id}:
    put:
      tags:
        - Admin - Contribution
      operationId: updateContribution
      parameters:
        - name: ehr_id
          in: path
          description: Target EHR id to update contribution inside.
          required: true
          schema:
            type: string
        - name: contribution_id
          in: path
          description: Target Contribution id to update
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Contribution has been updated successfully.
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
        '401':
          description: Client credentials invalid or have expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
        '403':
          description: >-
            Client does not have permission to access since admin role is
            missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
        '404':
          description: EHR or Contribution could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminUpdateResponseData'
    delete:
      tags:
        - Admin - Contribution
      summary: Not supported since 2.0.0
      operationId: deleteContribution
      parameters:
        - name: ehr_id
          in: path
          description: Target EHR id to update contribution inside.
          required: true
          schema:
            type: string
        - name: contribution_id
          in: path
          description: Target Contribution id to update
          required: true
          schema:
            type: string
      responses:
        '501':
          description: Contribution delete is not supported since 2.0.0.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
  /rest/admin/ehr/merge:
    post:
      tags:
        - Admin - EHR-Merge
      summary: Merge a source EHR into an existing target EHR
      operationId: mergeEhrs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeRequestBody'
        required: true
      responses:
        '200':
          description: >-
            EHRs have been merged and merge information will be returned in the
            body.
          headers:
            Content-Type:
              description: Format of response
              style: simple
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
        '403':
          description: >-
            Client is not permitted to access this resource since the admin role
            is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
        '404':
          description: source or target EHR could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
  /rest/admin/status:
    get:
      tags:
        - Admin - Heartbeat
      operationId: getStatus
      responses:
        '200':
          description: Admin API resources available and user has permission to access.
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminStatusResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminStatusResponseData'
        '401':
          description: Client credentials are invalid or have expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminStatusResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminStatusResponseData'
        '403':
          description: Client has no access permission since the admin role is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminStatusResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminStatusResponseData'
  /rest/admin/ehr/merge_target/{id}:
    get:
      tags:
        - Admin - EHR-Merge
      summary: >-
        Request the EHR id that a given EHR was merged into, taking cascading
        into account
      operationId: getMergeTarget
      parameters:
        - name: id
          in: path
          description: EHR id to find the merge target for
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: >-
            Return the EHR id the given EHR id was merged into. Takes cascaded
            merges into account.
          headers:
            Content-Type:
              description: Format of response
              style: simple
              schema:
                type: string
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '403':
          description: >-
            Client is not permitted to access this resource since the admin role
            is missing.
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema:
                type: string
        '404':
          description: Given EHR id was not merged.
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema:
                type: string
  /rest/admin/ehr/merge_status:
    get:
      tags:
        - Admin - EHR-Merge
      summary: Request the merging status of a SOURCE_EHR and/or TARGET_EHR
      operationId: getMergeStatusList
      parameters:
        - name: source
          in: query
          description: source EHR id to find merge status for
          required: false
          schema:
            type: string
            format: uuid
        - name: target
          in: query
          description: target EHR id to find merge status for
          required: false
          schema:
            type: string
            format: uuid
        - name: cascaded
          in: query
          description: whether cascaded merges shall be taken into account
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: >-
            Return all merge details for given source and/or target EHR. Will
            take cascaded merges into account, if specified.
          headers:
            Content-Type:
              description: Format of response
              style: simple
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MergeDetailsDto'
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MergeDetailsDto'
        '403':
          description: >-
            Client is not permitted to access this resource since the admin role
            is missing.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MergeDetailsDto'
        '404':
          description: No merge details found for the given source and/or target EHR
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MergeDetailsDto'
  /rest/admin/ehr/merge_details:
    get:
      tags:
        - Admin - EHR-Merge
      summary: Request the details of a merge operation
      operationId: getMergeDetails
      parameters:
        - name: source
          in: query
          description: source EHR id to find merge details for
          required: true
          schema:
            type: string
            format: uuid
        - name: target
          in: query
          description: target EHR id to find merge details for
          required: true
          schema:
            type: string
            format: uuid
        - name: unmerge_data
          in: query
          description: if data for unmerging is to be included
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: >-
            Merge details for the specified merge operation will be returned in
            the body.
          headers:
            Content-Type:
              description: Format of response
              style: simple
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
        '403':
          description: >-
            Client is not permitted to access this resource since the admin role
            is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
        '404':
          description: Source EHR was not merged into target EHR.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeDetailsDto'
  /rest/admin/template/all:
    delete:
      tags:
        - Admin - Template
      operationId: deleteAllTemplates
      responses:
        '200':
          description: All templates have been removed successfully
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/json:
              schema:
                type: object
            application/xml:
              schema:
                type: object
        '401':
          description: Client credentials are invalid or have expired.
          content:
            application/json:
              schema:
                type: object
            application/xml:
              schema:
                type: object
        '403':
          description: Client has no access permission since admin role is missing.
          content:
            application/json:
              schema:
                type: object
            application/xml:
              schema:
                type: object
        '404':
          description: Template could not be found.
          content:
            application/json:
              schema:
                type: object
            application/xml:
              schema:
                type: object
        '422':
          description: >-
            There are templates that are used by compositions and cannot be
            removed.
          content:
            application/json:
              schema:
                type: object
            application/xml:
              schema:
                type: object
  /rest/admin/query/{qualified_query_name}/{version}:
    delete:
      tags:
        - Admin - Stored-Query
      operationId: deleteStoredQuery
      parameters:
        - name: Accept
          in: header
          required: false
          schema:
            type: string
        - name: qualified_query_name
          in: path
          required: true
          schema:
            type: string
        - name: version
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Stored-Query has been deleted successfully
        '401':
          description: Client credentials are invalid or have expired.
        '403':
          description: Client has no permission to access since admin role is missing.
        '404':
          description: Stored-Query could not be found.
  /rest/admin/ehr/{ehr_id}/directory/{directory_id}:
    delete:
      tags:
        - Admin - Directory
      operationId: deleteDirectory
      parameters:
        - name: ehr_id
          in: path
          description: Target EHR ed to remove Directory from
          required: true
          schema:
            type: string
        - name: directory_id
          in: path
          description: Target Directory id to delete
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Directory has been deleted successfully
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '401':
          description: Client credentials are invalid or have expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '403':
          description: Client has no permission to access since admin role is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '404':
          description: EHR or Directory could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
  /rest/admin/ehr/{ehr_id}/composition/{composition_id}:
    delete:
      tags:
        - Admin - Composition
      operationId: deleteComposition
      parameters:
        - name: ehr_id
          in: path
          description: Target EHR id to remove composition from
          required: true
          schema:
            type: string
        - name: composition_id
          in: path
          description: Target Composition id to remove
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Composition has been deleted successfully.
          headers:
            Content-Type:
              description: Format of response
              style: simple
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '401':
          description: Client credentials are invalid or have been expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '403':
          description: >-
            Client has not permission to access this resource since admin role
            is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
        '404':
          description: EHR or Composition with id could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
            application/xml:
              schema:
                $ref: '#/components/schemas/AdminDeleteResponseData'
components:
  schemas:
    AdminUpdateResponseData:
      type: object
      properties:
        updated:
          type: integer
          format: int32
    MergeRequestBody:
      type: object
      properties:
        source_ehr:
          type: string
          format: uuid
        target_ehr:
          type: string
          format: uuid
        detail_level:
          type: string
          enum:
            - BASIC
            - FOLDER_COPY
        reversible:
          type: boolean
        dry_run:
          type: boolean
        folder_merge:
          type: string
          enum:
            - BASIC
            - COPY
        composition_merge:
          type: string
          enum:
            - BASIC
            - PERSISTENT
      required:
        - reversible
        - source_ehr
        - target_ehr
    ArchetypeID:
      type: object
      properties:
        qualified_rm_entity:
          type: string
          writeOnly: true
        domain_concept:
          type: string
          writeOnly: true
        rm_originator:
          type: string
          writeOnly: true
        rm_name:
          type: string
          writeOnly: true
        rm_entity:
          type: string
          writeOnly: true
        specialisation:
          type: string
        versionId:
          type: string
        value:
          type: string
        namespace:
          type: string
        qualifiedRmEntity:
          type: string
        domainConcept:
          type: string
        rmOriginator:
          type: string
        rmName:
          type: string
        rmEntity:
          type: string
        semanticId:
          type: string
        fullId:
          type: string
    Archetyped:
      type: object
      properties:
        archetypeId:
          $ref: '#/components/schemas/ArchetypeID'
        templateId:
          $ref: '#/components/schemas/TemplateId'
        rmVersion:
          type: string
    CodePhrase:
      type: object
      properties:
        terminologyId:
          $ref: '#/components/schemas/TerminologyId'
        codeString:
          type: string
        preferredTerm:
          type: string
    DvCodedText:
      type: object
      properties:
        value:
          type: string
        hyperlink:
          $ref: '#/components/schemas/DvURI'
        formatting:
          type: string
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
        definingCode:
          $ref: '#/components/schemas/CodePhrase'
    DvDateTime:
      type: object
      properties:
        normalStatus:
          $ref: '#/components/schemas/CodePhrase'
        normalRange:
          $ref: '#/components/schemas/DvIntervalDvDateTime'
        otherReferenceRanges:
          type: array
          items:
            $ref: '#/components/schemas/ReferenceRangeDvDateTime'
        magnitudeStatus:
          type: string
        accuracy:
          $ref: '#/components/schemas/DvDuration'
        value:
          type: object
    DvDuration:
      type: object
      properties:
        normalStatus:
          $ref: '#/components/schemas/CodePhrase'
        normalRange:
          $ref: '#/components/schemas/DvIntervalDvDuration'
        otherReferenceRanges:
          type: array
          items:
            $ref: '#/components/schemas/ReferenceRangeDvDuration'
        magnitudeStatus:
          type: string
        accuracy:
          type: number
          format: double
        accuracyIsPercent:
          type: boolean
        value:
          type: object
          properties:
            units:
              type: array
              items:
                type: object
                properties:
                  durationEstimated:
                    type: boolean
                  duration:
                    type: object
                    properties:
                      seconds:
                        type: integer
                        format: int64
                      zero:
                        type: boolean
                      nano:
                        type: integer
                        format: int32
                      negative:
                        type: boolean
                      positive:
                        type: boolean
                  timeBased:
                    type: boolean
                  dateBased:
                    type: boolean
    DvEHRURI:
      type: object
      properties:
        value:
          type: string
          format: uri
    DvEncapsulated:
      type: object
      properties:
        charset:
          $ref: '#/components/schemas/CodePhrase'
        language:
          $ref: '#/components/schemas/CodePhrase'
    DvIdentifier:
      type: object
      properties:
        issuer:
          type: string
        assigner:
          type: string
        id:
          type: string
        type:
          type: string
    DvIntervalDvDateTime:
      type: object
      properties:
        lower:
          $ref: '#/components/schemas/DvDateTime'
        upper:
          $ref: '#/components/schemas/DvDateTime'
        upperUnbounded:
          type: boolean
        lowerIncluded:
          type: boolean
        lowerUnbounded:
          type: boolean
        upperIncluded:
          type: boolean
    DvIntervalDvDuration:
      type: object
      properties:
        lower:
          $ref: '#/components/schemas/DvDuration'
        upper:
          $ref: '#/components/schemas/DvDuration'
        upperUnbounded:
          type: boolean
        lowerIncluded:
          type: boolean
        lowerUnbounded:
          type: boolean
        upperIncluded:
          type: boolean
    DvText:
      type: object
      properties:
        value:
          type: string
        hyperlink:
          $ref: '#/components/schemas/DvURI'
        formatting:
          type: string
        mappings:
          type: array
          items:
            $ref: '#/components/schemas/TermMapping'
        language:
          $ref: '#/components/schemas/CodePhrase'
        encoding:
          $ref: '#/components/schemas/CodePhrase'
    DvURI:
      type: object
      properties:
        value:
          type: string
          format: uri
    EhrUnmergeData:
      type: object
      properties:
        ehr_creation:
          type: string
          format: date-time
        ehr_status:
          $ref: '#/components/schemas/EhrUnmergeVersionedObjectData'
        contributions:
          type: array
          items:
            type: string
            format: uuid
          uniqueItems: true
        compositions:
          type: array
          items:
            type: string
            format: uuid
          uniqueItems: true
        deletedCompositions:
          type: array
          items:
            $ref: '#/components/schemas/EhrUnmergeVersionedObjectData'
        folders:
          type: array
          items:
            $ref: '#/components/schemas/EhrUnmergeVersionedObjectData'
        moved_item_tags:
          type: array
          items:
            type: string
            format: uuid
          uniqueItems: true
        deleted_item_tags:
          type: array
          items:
            $ref: '#/components/schemas/ItemTagDto'
    EhrUnmergeVersionData:
      type: object
      properties:
        uid:
          type: string
          format: uuid
        version:
          type: integer
          format: int32
        sys_period_lower:
          type: string
          format: date-time
        sys_period_upper:
          type: string
          format: date-time
        contribution:
          type: string
          format: uuid
        audit_details:
          type: string
          format: uuid
        data:
          $ref: '#/components/schemas/Locatable'
    EhrUnmergeVersionedObjectData:
      type: object
      properties:
        versions:
          type: array
          items:
            $ref: '#/components/schemas/EhrUnmergeVersionData'
        additionalDetails:
          type: object
          additionalProperties:
            type: object
          writeOnly: true
    FeederAudit:
      type: object
      properties:
        originatingSystemItemIds:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
        feederSystemItemIds:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
        originalContent:
          $ref: '#/components/schemas/DvEncapsulated'
        originatingSystemAudit:
          $ref: '#/components/schemas/FeederAuditDetails'
        feederSystemAudit:
          $ref: '#/components/schemas/FeederAuditDetails'
    FeederAuditDetails:
      type: object
      properties:
        systemId:
          type: string
        location:
          $ref: '#/components/schemas/PartyIdentified'
        provider:
          $ref: '#/components/schemas/PartyIdentified'
        subject:
          $ref: '#/components/schemas/PartyProxy'
        time:
          $ref: '#/components/schemas/DvDateTime'
        versionId:
          type: string
        otherDetails:
          $ref: '#/components/schemas/ItemStructure'
    Item:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/DvText'
        archetypeNodeId:
          type: string
        uid:
          $ref: '#/components/schemas/UIDBasedId'
        archetypeDetails:
          $ref: '#/components/schemas/Archetyped'
        feederAudit:
          $ref: '#/components/schemas/FeederAudit'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        path:
          type: string
    ItemStructure:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/DvText'
        archetypeNodeId:
          type: string
        uid:
          $ref: '#/components/schemas/UIDBasedId'
        archetypeDetails:
          $ref: '#/components/schemas/Archetyped'
        feederAudit:
          $ref: '#/components/schemas/FeederAudit'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
        path:
          type: string
    ItemTagDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        target:
          type: string
          format: uuid
        key:
          type: string
        value:
          type: string
        owner_id:
          type: string
          format: uuid
        target_type:
          type: string
          enum:
            - EHR_STATUS
            - COMPOSITION
        target_path:
          type: string
    Link:
      type: object
      properties:
        meaning:
          $ref: '#/components/schemas/DvText'
        type:
          $ref: '#/components/schemas/DvText'
        target:
          $ref: '#/components/schemas/DvEHRURI'
    Locatable:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/DvText'
        archetypeNodeId:
          type: string
        uid:
          $ref: '#/components/schemas/UIDBasedId'
        archetypeDetails:
          $ref: '#/components/schemas/Archetyped'
        feederAudit:
          $ref: '#/components/schemas/FeederAudit'
        links:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        path:
          type: string
    MergeDetailsDto:
      type: object
      properties:
        outcome:
          $ref: '#/components/schemas/MergeOutcomeDto'
        source_ehr:
          type: string
          format: uuid
        target_ehr:
          type: string
          format: uuid
        merge_date:
          type: string
          format: date-time
        unmerge_data:
          $ref: '#/components/schemas/EhrUnmergeData'
    MergeOutcomeDto:
      type: object
      properties:
        level:
          type: string
          enum:
            - BASIC
            - FOLDER_COPY
        summary:
          type: string
    ObjectId:
      type: object
      properties:
        value:
          type: string
    PartyIdentified:
      type: object
      properties:
        externalRef:
          $ref: '#/components/schemas/PartyRef'
        name:
          type: string
        identifiers:
          type: array
          items:
            $ref: '#/components/schemas/DvIdentifier'
    PartyProxy:
      type: object
      properties:
        externalRef:
          $ref: '#/components/schemas/PartyRef'
    PartyRef:
      type: object
      properties:
        namespace:
          type: string
        type:
          type: string
        id:
          $ref: '#/components/schemas/ObjectId'
    ReferenceRangeDvDateTime:
      type: object
      properties:
        range:
          $ref: '#/components/schemas/DvIntervalDvDateTime'
        meaning:
          $ref: '#/components/schemas/DvText'
    ReferenceRangeDvDuration:
      type: object
      properties:
        range:
          $ref: '#/components/schemas/DvIntervalDvDuration'
        meaning:
          $ref: '#/components/schemas/DvText'
    TemplateId:
      type: object
      properties:
        value:
          type: string
    TermMapping:
      type: object
      properties:
        match:
          type: string
        purpose:
          $ref: '#/components/schemas/DvCodedText'
        target:
          $ref: '#/components/schemas/CodePhrase'
    TerminologyId:
      type: object
      properties:
        value:
          type: string
    UIDBasedId:
      type: object
      properties:
        value:
          type: string
    AdminStatusResponseData:
      type: object
      properties:
        message:
          type: string
    AdminDeleteResponseData:
      type: object
      properties:
        deleted:
          type: integer
          format: int32
