Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

Page Properties
idAPI_Specification

Link

https://ehealthmedicaleventsapi.docs.apiary.io/#reference/device-dispenses/complete-device-dispense/complete-device-dispense

Посилання на Apiary або Swagger

Resource

/api/patients/{{patient_id}}/device_dispenses/{{device_dispense_id}}/actions/complete

Посилання на ресурс, наприклад: /api/persons/create

Scope

device_dispense:complete

Scope для доступу

Components

Devices

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

REST

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

POST

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

Async

Метод є синхронним чи асинхронним?

Public/Private/Internal

Public

Потрібно зазначити тип методу за ступенем доступності

Logic

  • Save signed content to media storage, in bucket pointed in MEDIA_STORAGE_DEVICE_DISPENSE_BUCKET chart parameter

  • Fill in the following fields:

    • signed_content_links. Add string item in the array with a link(s) to saved content in media storage

    • status = COMPLETED

    • updated_at. Set current date and time

    • updated_by. Set current user from token

  • If Device request has quantity:

    • Save (update) data to device_requests collection in MongoDB according to /wiki/spaces/CSI/pages/17467375685 : set device_requests.status = COMPLETED (as all its quantity has been provided by Device dispense)

    • If related Device request has a reference on an Activity as device_request.based_on, then

      • add the reference on the Device dispense resource to the outcome_reference attribute of the related Activity

      • if Activity.status is scheduled change it to in_progress

  • Send StatusChangeEvent to Event Manager for Device Dispense and related Device Request

...

  • Сheck that Device request is_active = true and status == 'ACTIVE'

    • in case of error - return 409 error ('Device request is not active')

Validate related Care plan

Verify Care Plan and Activity as described in https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17573085459/Qualify+Device+Request+by+ID#Validate-related-Care-plan

Validate User

  • Extract user_id from token

  • Check that device dispense is completed by the same user who created it

    • User from token must match with device_dispense.inserted_by

      • in case of error - Return 409 ('Employee is not an author of device dispense')

...

For more information look at Device dispense status model /wiki/spaces/CSI/pages/17467572347

Response structure

See on Apiary

...