Purpose
The service is designed to upload a new medication registry. The process uses the Jabba service. Upon execution of the request, a job is created, on the basis of which tasks are created. Each task is one request to create an entity from the registry.
...
Page Properties | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic
Decode base64 file.
Validate input according to schema.
Validate existing and create new entities of medications registry:
Extract medications with
type = INNM_DOSAGE
,is_active = TRUE
,innm_dosage.name
,innm_dosage.form
andinnm_dosage.ingredients.dosage
,innm_dosage.ingredients.is_primary
):in case found extract connected medications with
type = BRAND
,is_active = TRUE
,brand.name
,brand.form
,brand.package_qty
,brand.package_min_qty
,brand.certificate
,brand.container
andbrand.ingredients.dosage
,brand.ingredients.is_primary
):in case found extract connected program medication by medication_id and
program_medications.medical_program_id
and insert program medication with brand according to RC_Rx_ Create medication registry | program_medications in case program medication not found.
in case innm_dosage not found insert it according to RC_Rx_ Create medication registry | medications (type = INNM_DOSAGE) and its ingredients RC_Rx_ Create medication registry | ingredients (for INNM_DOSAGE), RC_Rx_ Create medication registry | innms (skip innms creation in case it exist).
in case brand not found insert brand according to RC_Rx_ Create medication registry | medications (type = BRAND) and its ingredient RC_Rx_ Create medication registry | ingredients (for BRAND).
insert program medication with brand according to RC_Rx_ Create medication registry | program_medications.
in case brand and program medication found return 422 error with msg ('Such medication already exist').
Return job identifier with result.
...
Attribute | Source and Logic | Type and Constraints | O/M |
---|---|---|---|
id | uuid_generate_v4(), auto | uuid | M |
sctid | innms.sctid (x), from request | varchar(255) | O |
name | innms.name (x), from request | varchar(255) | M |
name_original | innms.name_original (x), from request | varchar(255) | M |
is_active | true, auto | bool | M |
inserted_by | user_id, from token | uuid | M |
updated_by | user_id, from token | uuid | M |
inserted_at | now(), auto | timestamp | M |
updated_at | now(), auto | timestamp | M |
...
Attribute | Source and Logic | Type and Constraints | O/M | ||
---|---|---|---|---|---|
id | uuid_generate_v4(), auto | uuid | M | ||
name | brand.name | varchar(255) | M | ||
type | auto (BRAND) | varchar(255) | M | ||
manufacturer | name | brand.manufacturer.name | jsonb | varchar(255) | M |
country | brand.manufacturer.country | varchar(255) Dictionary COUNTRY | M | ||
code_atc | brand.code_atc | jsonb | varchar(255) | M | |
is_active | true, auto | bool | M | ||
form | brand.form | varchar(255) Dictionary MEDICATION_FORM | M | ||
container | numerator_value | brand.container.numerator_value | jsonb | float8 | M |
numerator_unit | brand.container.numerator_unit | varchar(255) Dictionary MEDICATION_UNIT | M | ||
denumerator_value | brand.container.denumerator_value | float8 | M | ||
denumerator_unit | brand.container.denumerator_unit | varchar(255) Dictionary MEDICATION_UNIT | M | ||
package_qty | brand.package_qty | float | O | ||
package_min_qty | brand.package_min_qty | float | O | ||
certificate | brand.certificate | varchar(255) | O | ||
certificate_expired_at | brand.certificate_expired_at | date | O | ||
inserted_by | user_id, from token | uuid | M | ||
updated_by | user_id, from token | uuid | M | ||
inserted_at | now(), auto | timestamp | M | ||
updated_at | now(), auto | timestamp | M | ||
form_pharm | brand.form_pharm | varchar(255) | O | ||
max_request_dosage | brand.max_request_dosage | int | O |
...