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

Update Medication

Status

  • Specification SPECS
  • Apiary SPECS

Purpose

This WS is designed to update medication by ID (post).

APIary 

update-medication

Input parameters 

  • id
  • name
  • start_at
  • route
  • container_dosage info
  • package_qty
  • package_min_qty
  • code_ATX
  • manufacturer_name_country info
  • certificate
  • expired_certificate_date
  • ingredients info
    • innm_id
    • dosage info
    • is_active_substance

Authorize

  1. Verify the validity of access token
  2. Check user scope (scope = 'medication:write') in order to perform this action
    1. In case error - generate 401 response

Validate request (JSON schema)

Validate request using JSON schema (link !!! TBD)

Validate Medication

Purpose validation: Check on existing Medication record 

  1. Check exist Medication by $.id.

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

Validate Innm

Purpose validation: Check on existing Innm in ingredients 

  1. Check exist Innm by $.ingredients[].innm_id.

    1. if invalid - return 422 error (message: "Innm in ingredients is not found!")

Validate Dosage & Container dosage

Purpose validation: Denum unit from Dosage must be is equal Denum unit from Container dosage. See examples: Medications model  

  1. Check exist any Denum unit from Dosage ($.ingredients[].dosage.denumerator_unit) with Denum unit Container dosage ($.container_dosage.denumerator_unit).

    1. if invalid - return 422 error (message: "Denum unit from Dosage ingredients must be equal Denum unit from Container dosage medication!")

Validate multiplicity

Purpose validation:  Package_qty for container_dosage must have multiplicity package_min_qty.  Result (Mod or % operator) must = 0 .

  1. Vaildate multiplicity (Mod == 0) $.package_qty Mod $.package_min_qty == 0
    1. if result NOT 0 - return 409 eror (message: "Only a multiplicity package quantity for the minimum package quantity !")

Create new Medication

  1. Update (set values) new record in Medications 
  2. Fill data 
Destination
Source
name$.name
is_active TRUE
start_at $.start_at
route $.route
container_dosage $.container_dosage
package_qty$.package_qty
package_min_qty$.package_min_qty
code_ATX $.code_ATX
manufacturer_name_country$.manufacturer_name_country
certificate $.certificate
expired_certificate_date $.expired_certificate_date
inserted_at:timestamp
inserted_byuser_id
updated_at:timestamp
updated_byuser_id
  1. Delete all child records in Ingredients by $.id (it is medication id ) 
  2. Create new records in Ingredients (array)

Destination
Source
id
medication_id $.id
innm_id $.ingredients[].innm_id
is_active_substance $.ingredients[].is_active_substance
dosage $.ingredients[].dosage
inserted_at:timestamp
inserted_byuser_id
updated_at:timestamp
updated_byuser_id

Return data structure

  1. Fill response data structure (Similar input parametrs)
  2. Additional  
    • id
    • container_dosage.description
    • ingredients.dosage.description
    • ingredients.innm info

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