ЕСОЗ - публічна документація

RC_Update Program Medication (CSI-2140)

Status

Apiary

Apiary

JSON Schema request

SPECS

JSON Schema response

specs

Purpose

This WS  is design to update reimbursement and/or flags "is_active", "medication_request_allowed", "care_plan_activity_allowed" for Medication brand within Medical program. 

WS logic

Authorize

  1. Verify the validity of access token

    1. In case of error - generate 401 response

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

    1. In case of error - generate 403 response

Verify the validity of access token

  1. Check user scope (scope = 'program_medication:write') in order to perform this action

    1. In case of error - generate 401 response

Validate request (JSON schema)

  1. Validate request using JSON schemas:

    1. Return 422 with list of validation errors in case validation fails (422 EView)

Validate PK Program Brands

  1. Check participant (Program_medication) ($.id) exists in

PRM.program_medications

In case of error - return 422 error (message: "ID for Medication brand within the Medical program is not found")

{:error, [{%{ description: "ID for Medication brand within the Medical program is not found", params: [], rule: :invalid }, "$.id"}]}

Validate status

  1. Validate `is_active` == TRUE

  1.  

    1. if invalid  - return 409 eror (message: "Medication brand within the program is inactive")

Validate medical_request_allowed status and care_plan_activity_allowed

To deactivate Participant (to update is_active == FALSE for medication brand within the program with id={id}) medication_request_allowed and care_plan_activity_allowed must be inactive (medication_request_allowed == FALSE & care_plan_activity_allowed == FALSE) 

  1. Validate medication_request_allowed == FALSE & care_plan_activity_allowed == FALSE

    1. if invalid  - return 409 eror (message: "To deactivate medication brand within the program firstly disable medication_request_allowed and care_plan_activity_allowed")

Update Program medication

 

Update program_medication record by $.id  set values:

Destination

Source

Description

Destination

Source

Description

reimbursement

$.reimbursement

 

wholesale_price

$wholesale_price

 

consumer_price

$consumer_price

 

daily_dosage

$daily_dosage

 

reimbursement_daily_dosage

$reimbursement_daily_dosage

 

estimated_payment_amount

$estimated_payment_amount

 

is_active

$.is_active

 

medication_request_allowed

$.medical_request_allowed

 

care_plan_activity_allowed

$.care_plan_activity_allowed

 

max_daily_dosage

$.max_daily_dosage

float. Max Daily dose of medication, limited by WHO. Can be NULL

package_qty_divisible

$.package_qty_divisible

bool. Possible/Impossible to dispense part of packaging (multiple of package_min_qty/package_qty)

inserted_at

:timestamp

Get current date-time

inserted_by

user_id

Extract user from token

updated_at

:timestamp

Get current date-time

updated_by

user_id

Extract user from token

 



ЕСОЗ - публічна документація