Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.

Info

/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

Table of Contents

Properties of a REST API method document

Page Properties
idpage_properties_method_REST API

Document type

Метод REST API

Document title

[DRAFT] cancelComposition [API-006-001-001-0213]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-006-001-001-0213

Microservices (namespace)

MC

Component

Compositions

Component ID

COM-006-001

Link на API-специфікацію

https://app.swaggerhub.com/apis/ehealthua/compositions/Prod#/main/cancelComposition

Resource

{{host}}/patients/composition/{{compositionId}}/cancel

Scope

composition:cancel

Protocol type

REST

Request type

PATCH

Sync/Async

Async

Public/Private

Public

Purpose

This method is designed to cancel an existing composition with status FINAL.

Used in processes:

In text:

MCTD - medical conclusion of temporary disability (MVTN)

MCN - medical conclusion of newborn (MVN)

MC - medical conclusion (MV)

QES - qualified electronic signature (KEP)

Logic

cfea7215-fa1d-4c4b-8aef-f779e5c7e9a6.pngImage Added

Configuration parameters

N/A

Dictionaries

Expand
titleCOMPOSITION_CANCELLATION_REASONS_TEMP_DISABILITY

Code

Translate (UA)

INCORRECT_CATEGORY

Помилкове зазначення категорії

INCORRECT_DISABILITY_PERIOD

Помилкове зазначення строків непрацездатності

INCORRECT_INOXICATION

Помилкове зазначення відміток щодо алкогольного та/або наркотичного сп’яніння

INCORRECT_OTHER

Помилкове зазначення інших відомостей

INCORRECT_PATIENT

Помилка ідентифікації

INCORRECT_TRITMENT_VIOLATION

Помилкове зазначення інформації щодо порушення режиму

Expand
titleCOMPOSITION_CANCELLATION_REASONS_NEWBORN

INCORRECT_PATIENT

Невірно ідентифікований пацієнт

TYPO

Механічна помилка введення даних

Input parameters

See on SwaggerHub

Input parameter

Mandatory

Type

Description

Example

1

compositionId

 

String ($uuid)

(path)

Composition object ID

89edcfb2-3479-4565-885b-d0ce7f9d081e

2

Request body

 

String($uuid)
(path)

Request body with signed composition.

{
"data": "string"
}

Request structure

See on API-specification

Expand
titleExample
Code Block

Headers

Headers

Request data validation

Authorize

Check user scopes in order to perform this action (scope = 'composition:cancel')

  • return 401 (Unauthorized) in case of invalid scope(s)

  1. At the beginning of the task, an incoming request is received, which is content signed with a qualified electronic signature of the doctor.

  2. Rechecking is similar progress to what has already been implemented in the SIGN_COMPOSITION task (list item 3).

  3. Searching for a Composition object in FINAL status for which cancellation is being attempted

    1. if the conclusion is not found — the task completes its execution with code (1000)

    2. if found, the procedure continues execution

  4. Checking the content of the request (CancelContentFilter)

    1. if in the body of the request the identifier of the MCTD is different from the identifier in the API request - the task completes its execution with the code INVALID_IDENTIFIER_IN_PAYLOAD(1026)

    2. if the status of the MC for which the request is made is not FINAL, the task completes its execution with the code CANT_CANCEL_NONFINAL_COMPOSITION (1003)

    3. for the MCTD (except for the MC for an undefined preperson) additional checks is performed:

      1. If the ERLN status of the request is not available (the ERLN request has not been sent) - the task ends its execution with the code CANCELLATION_NOT_ALLOWED_ERLN_CALL_PENDING (1130)

      2. If the ERLN status of the response is not available (the ERLN request was sent, but the answer has not yet received) - the task ends its execution with the code CANCELLATION_NOT_ALLOWED_ERLN_CALL_IN_PROGRESS(1131)

      3. in other cases the procedure continues execution.

    4. If no cancellation explanation text is provided, the task terminates with CANCELLATION_TEXT_NOT_PROVIDED.

    5. If the element of the cancellation object coding system is not provided - the task ends its execution with the code CANCELLATION_NO_CODING (1028)

    6. If several (>1) elements of the cancellation object coding system are provided - the task ends its execution with the code CANCELLATION_MULTIPLE_CODINGS (1029)

    7. Checking reason.code for an entry in one of the dictionaries:

      1. COMPOSITION_CANCELLATION_REASONS_NEWBORN

      2. COMPOSITION_CANCELLATION_REASONS_TEMP_DISABILITY

        1. (depending on the type of MC)
          If the check is not passed, the error 1004 Invalid cancellation coding (Invalid cancellation reason coding) occurs.

        2. We also check that reason.system == eHealth/composition_cancellation_reasons
          If the check is not passed, the error 1004 Invalid cancellation coding (Invalid cancellation reason coding) occurs.

  5. The verification of the owner of the QES to compliance with the author of the MC is carried out, completely similar to SIGN_COMPOSITION task (list item 5).

  6. For MCN, the status of integration with DRACS is being checked.

    1. If the request from DRACS to check the MC has already received (getComposition), then the task ends its execution with the code CANCELLATION_FOR_RUNNING_TASK (1006)

    2. in other cases, the procedure continues its execution

  7. The allowed delay is checked — the delay between the opening time of the MC (composition.date) and the current date.

    1. If EMAL_COMPOSITION_FLOW_REPLACE_ENABLED=false, then ignored value of EMAL_REPLACEMENT_FLOW_DISABILITY_ALLOWED_CANCELLATION_REASONS and EMAL_REPLACEMENT_FLOW_NEWBORN_ALLOWED_CANCELLATION_REASONS and the allowable delay of cancellation is checked by configurations EMAL_FILTER_CANCEL_TIMEOUT_DISABILITY and EMAL_FILTER_CANCEL_TIMEOUT_NEWBORN. If the configuration parameter values fail to pass the check, then error 1005 occurs.

    2. If EMAL_COMPOSITION_FLOW_REPLACE_ENABLED=true, then validate the reasons for cancellation by EMAL_REPLACEMENT_FLOW_DISABILITY_ALLOWED_CANCELLATION_REASONS and EMAL_REPLACEMENT_FLOW_NEWBORN_ALLOWED_CANCELLATION_REASONS. If reason.code is in list EMAL_REPLACEMENT_FLOW_DISABILITY_ALLOWED_CANCELLATION_REASONS and EMAL_REPLACEMENT_FLOW_NEWBORN_ALLOWED_CANCELLATION_REASONS, then filter cancel-timeout does not start, new configuration parameters are started instead: EMAL_FILTER_REPLACEMENT_CANCEL_TIMEOUT_DISABILITY and EMAL_FILTER_REPLACEMENT_CANCEL_TIMEOUT_NEWBORN.

      In the case of failure to pass the filter check, error "1005 Can't cancel composition: too old" occurs (Cancellation of the conclusion is not allowed - the time allowed for cancellation has expired).

    3. The configuration of the replacement-cancel-timeout filter is the same as for cancel-timeout:

      EMAL_FILTER_REPLACEMENT_CANCEL_TIMEOUT_NEWBORN

      EMAL_FILTER_REPLACEMENT_CANCEL_TIMEOUT_DISABILITY

Processing

After all validations:

  1. For conclusions that have the relatesTo.code=REPLACES attribute set, a verification of the MC record to which the relatesTo link is reffered

    1. if the MC referred to by the current MC is not found — the task completes its execution with the code CANT_CANCEL_NOT_FOUND (1137)

    2. if the MC referred to by the current MC does not have the AMENDED status - the task completes its execution with the code CANT_CANCEL_NONAMENDED_COMPOSITION (1136). In an ideal situation, this code should never occur

    3. if the checks are passed, the MC to which the link is set changes its status from AMENDED to FINAL.

  2. The body of the cancellation request signed by QES is stored in the Ceph object storage.

  3. The MС status is set to ENTERED_IN_ERROR.

  4. If the authorization method is specified, an SMS is sent.

  5. The task of canceling the MC in the ERLN is planned.

Response structure examples

See on API-specification

Expand
titleExample
Code Block
languagejson
{
  "data": {
    "eta": "2022-10-24T13:14:01.656Z",
    "id": "89edcfb2-3479-4565-885b-d0ce7f9d081e",
    "links": [
      {
        "entity": "eHealth/resources",
        "href": "composition/1aecb5c4-60c8-4773-900a-64d01b382ce9"
      }
    ],
    "status": "PENDING"
  }
}

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

200

In case of successful cancellation of the Composition

Successful cancellation

3

400

Invalid request format

Error during formation or incorrect use of parameters in the request

4

401

The user role does not allow the operation to be performed

The role or scopes assigned to the user who generated the request do not allow such an operation to be done.

5

(1003)

CANT_CANCEL_NONFINAL_COMPOSITION

6

1004

Invalid cancellation reason coding

7

1005

Can't cancel composition: too old

8

1006

CANCELLATION_FOR_RUNNING_TASK

9

1026

INVALID_IDENTIFIER_IN_PAYLOAD

10

1028

CANCELLATION_NO_CODING

11

1130

CANCELLATION_NOT_ALLOWED_ERLN_CALL_PENDING

12

1131

CANCELLATION_NOT_ALLOWED_ERLN_CALL_IN_PROGRESS

13

1136

CANT_CANCEL_NONAMENDED_COMPOSITION

14

1137

CANT_CANCEL_NOT_FOUND

15

404

The object of the Composition was not found

The object of the Composition was not found or incorrect ID

16

500

Subordinate service error

Subordinate service error

17

18

Специфічні

19

Post-processing processes

N/A

Technical modules where the method is used

Page Properties Report
headingsID ТМ, Статус
cqllabel = "tr-mis"