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 | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|
...
Validate input according to schema
Create job with type
create_medication_registry
For each line of input file create separate task of job
Each task must 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
, brand.manufacturer.name, brand.manufacturer.country, brand.certificate_expired_at:in case found extract connected program medication by medication_id and
program_medications.medical_program_id
and insert program medication with brand according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#programregistry#program_medications in case program medication not found
in case innm_dosage not found insert it according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#medicationsregistry#medications-(type-=%3D-INNM_DOSAGE) and its ingredients https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#ingredientsregistry#ingredients-(for-INNM_DOSAGE)
check existence of INNMs by
innms.name_original
in case innm not found - insert it according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#innmsregistry#innms
in case innm is found - skip innm creation.
in case more than one innm is found - return
FAILED
task status with error ('More than one INNM with such name_original exist in innms table')
in case brand not found insert brand according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#medicationsregistry#medications-(type-=%3D-BRAND) and its ingredient https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#ingredientsregistry#ingredients-(for-BRAND) .
insert program medication with brand according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/1715365479617205985289/RC_Create+full+medication+registry_EN#programregistry#program_medications
in case brand and program medication found - return
FAILED
task status with error ('Such medication already exist')
Return job identifier with result.
...
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails
Verify that token is not expired
in case of error - return 401 (“Invalid access token”)
Check user scopes in order to perform this action (scope = 'medication_registry:write')
return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_registry:write”) in case of invalid scope(s)
Headers
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
api-key:uXhEczJ56adsfh3Ri9SUkc4en
Request data validation
Validate request
Check that request using schema
Return 422 with the list of validation errors in case validation fails.
Check that registerType = 'FULL_MEDICATIONS_REGISTRY'
Return 422 with the list of validation errors in case validation fails.
Check that reasonDescription filled
Return 422 with the list of validation errors in case validation fails.
Check input file according to file structure
Return 422 with the list of validation errors in case validation fails.
Check input file size - csv file with max 30000 lines is allowed.
Return 422
The number of tasks for the job with a sequential execution strategy is limited to 30,000
in case validation fails
File example:
View file | ||
---|---|---|
|
...