Versions Compared

Key

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

Required parameters are marked with "*"

...

Purpose

...

This WS is designed to deactivate brand by ID (post)

Specification

...

Page Properties

Link

https://uaehealthapi.docs.apiary.io/#reference/internal.-nhs-admin/innm-dosages/deactivate-innm-dosage API paragraph not found

Resource

/innm_dosages/{{id}}/actions/deactivate

Scope

innm_dosage:deactivate

Components

API paragraph not foundDrugs and Program medications

Microservices

API paragraph not found

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

...

Public/Private/Internal

Internal. NHS Admin

Logic

This method is used to deactivate INNM Dosage. Fields descriptions are listed in request Example view.

...

Input parameter

Values

Type

Description

Example

id

String

d290f1ee-6c54-4b01-90e6-d701748f0851

Request structure

...

API paragraph not found

Authorize

...

  1. Verify the validity of access token

  2. Check user scope (scope = 'innm_dosage:deactivate') in order to perform this action

    1. In case error - generate 401 response

Request to process the request using a token in the headers

Headers

...

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer c2778f3064753ea70de870a53795f5c9

Request data validation

...

Validate PK Medication

Purpose validation: Check on existing Medication record 

  1. Check exist Medication by $.id.

    1. if invalid - return 404 error (message: "Innm_dosage is not found!")

Validate status

Purpose validation:  Medication should be active (is_active == TRUE)

  1. Validate `is_primary` == TRUE

  1. if invalid  - return 409 error (message: "Innm_dosage should be active !")

Validate type

Purpose validation:  Medication should be type = INNM_DOSAGE

  1. Validate `type` == INNM_DOSAGE

  1. if invalid  - return 409 eror (message: "Medication must be type = INNM_DOSAGE !")

Validate status linked Medications

Purpose validation:  For INNM Dosage - all linked (child) Medications should be inactive (is_primary == FALSE)

  1. Get linked medications, check exist active medications

  1. if invalid  - return 409 eror (message: "All linked medication should be inactive !")

IF EXIST (

    SELECT * FROM medications M

        WHERE M.is_primary == TRUE

            AND M.type == BRAND

            AND (M.ingridients.id = $.id AND M.ingridients.is_primary)

)

Processing

...

Update medication

Update medication record by $.id  set values:

Destination

Source

is_active

FALSE

updated_at

:timestamp

updated_by

user_id

Response structure

...

See on Apiary

Example:

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": {
    "id": "09b2bffb-699a-43c0-bc9a-5066d9b9b5a8",
    "name": "Амідарон",
    "form": "PILL",
    "ingredients": [
      {
        "id": "1349a693-4db1-4a3f-9ac6-8c2f9e541982",
        "name": "Амідарон",
        "dosage": {
          "numerator_unit": "MG",
          "numerator_value": 200,
          "denumerator_unit": "PILL",
          "denumerator_value": 1
        },
        "is_primary": true
      }
    ],
    "is_active": true,
    "inserted_at": "2017-04-20T19:14:13Z",
    "inserted_by": "e1453f4c-1077-4e85-8c98-c13ffca0063e",
    "updated_at": "2017-04-20T19:14:13Z",
    "updated_by": "2922a240-63db-404e-b730-09222bfeb2dd"
  }
}

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": "422",
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "error": {
    "type": "unverified",
    "message": "Can't deactivate innm dosage. Exist active linked brand!"
  }
}

Post-processing processes

...

API paragraph not found

HTTP status codes

...

Page Properties

HTTP status code

Message

What caused the error

 200

 

 

 422

 

 

...