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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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.

Key points

  1. NHS admin user downloads file with fields according to its structure.

  2. The file should be in .csv format and is converted to base64.

Specification

Link

API paragraph not found

Посилання на Apiary або Swagger

Resource

API paragraph not found

Посилання на ресурс, наприклад: /api/persons/create

Scope

medication_registry:write

Scope для доступу

Components

ePrescription

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

API paragraph not found

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

API paragraph not found

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

API paragraph not found

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

API paragraph not found

Метод є синхронним чи асинхронним?

Logic

  1. Decode base64 file.

  2. Validate input according to schema.

  3. Validate existing and create new entities of medications registry:

    1. Extract medications with type = INNM_DOSAGE, is_active = TRUE, innm_dosage.name, innm_dosage.form and innm_dosage.ingredients.dosage, innm_dosage.ingredients.is_primary):

      1. 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 and brand.ingredients.dosage, brand.ingredients.is_primary):

        1. in case found extract connected program medication by medication_id and program_medications.medical_program_id and insert program medication with brand according to Create medication registry | program_medications in case program medication not found.

      2. in case innm_dosage not found insert it according to Create medication registry | medications (type = INNM_DOSAGE) and its ingredients Create medication registry | ingredients (for INNM_DOSAGE), Create medication registry | innms (skip innms creation in case it exist).

      3. in case brand not found insert brand according to Create medication registry | medications (type = BRAND) and its ingredient Create medication registry | ingredients (for BRAND).

        1. insert program medication with brand according to Create medication registry | program_medications.

      4. in case brand and program medication found return 422 error with msg ('Such medication already exist').

  4. Return job identifier with result.

innms

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

medications (type = INNM_DOSAGE)

Attribute

Source and Logic

Type and Constraints

O/M

id

uuid_generate_v4(), auto

uuid

M

name

innm_dosage.name

varchar(255)

M

type

auto (INNM_DOSAGE)

varchar(255)

M

is_active

true, auto

bool

M

form

innm_dosage.form

varchar(255)

Dictionary MEDICATION_FORM

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

daily_dosage

innm_dosage.daily_dosage

float

O

max_daily_dosage

innm_dosage.max_daily_dosage

float

O

mr_blank_type

innm_dosage.mr_blank_type

varchar(64)

Dictionary MR_BLANK_TYPES

O

dosage_form_is_dosed

innm_dosage.dosage_is_dosed

bool

O

ingredients (for INNM_DOSAGE)

Attribute

Source and Logic

Type and Constraints

O/M

id

uuid_generate_v4(), auto

uuid

M

dosage

numerator_value

innm_dosage_ingredients.dosage.numerator_value (x), from request

jsonb

float8

M

numerator_unit

innm_dosage_ingredients.dosage.numerator_unit (x), from request

varchar(255)

Dictionary MEDICATION_UNIT

M

denumerator_value

innm_dosage_ingredients.dosage.denumerator_value (x), from request

float8

M

denumerator_unit

innm_dosage_ingredients.dosage.denumerator_unit (x), from request

varchar(255)

Dictionary MEDICATION_UNIT

M

is_primary

innm_dosage_ingredients.is_primary (x), from request

bool

At least one of the ingredients must be is_primary = true
Two or more ingredients can be is_primary = true

M

innm_child_id

uuid_generate_v4(), auto

uuid

innm_id

O

parent_id

uuid_generate_v4(), auto

uuid

M

inserted_at

now(), auto

timestamp

M

updated_at

now(), auto

timestamp

M

medications (type = BRAND)

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

ingredients (for BRAND)

Attribute

Source and Logic

Type and Constraints

O/M

id

uuid_generate_v4(), auto

uuid

M

is_primary

brand_ingredients.is_primary (x), from request

bool

Only one ingredient should be is_primary = true

M

dosage

numerator_value

brand_ingredients.dosage.numerator_value (x), from request

jsonb

float8

M

numerator_unit

brand_ingredients.dosage.numerator_unit (x), from request

varchar(255)

Dictionary MEDICATION_UNIT

M

denumerator_value

brand_ingredients.dosage.denumerator_value (x), from request

float8

M

denumerator_unit

brand_ingredients.dosage.denumerator_unit (x), from request

varchar(255)

Dictionary MEDICATION_UNIT

M

medication_child_id

uuid_generate_v4(), auto

uuid

medication (type = INNM_DOSAGE)

O

parent_id

uuid_generate_v4(), auto

uuid

M

inserted_at

now(), auto

timestamp

M

updated_at

now(), auto

timestamp

M

program_medications

Attribute

Source and Logic

Type and Constraints

O/M

id

uuid_generate_v4(), auto

uuid

M

reimbursement

type

program_medications.reimbursement.type

varchar(64)

Dictionary REIMBURSEMENT_TYPE

M

reimbursement_amount

program_medications.reimbursement.reimbursement_amount

float

M

percentage_discount

program_medications.reimbursement.percentage_discount

float

M

is_active

true, auto

bool

M

medication_request_allowed

true, auto

bool

M

care_plan_activity_allowed

true, auto

bool

M

inserted_by

user_id, from token

uuid

M

updated_by

user_id, from token

uuid

M

medication_id

medication_id (type = BRAND), auto

uuid

M

medical_program_id

program_medications.medical_program_id

uuid

M

inserted_at

now(), auto

timestamp

M

updated_at

now(), auto

timestamp

M

wholesale_price

program_medications.wholesale_price

float8

O

consumer_price

program_medications.consumer_price

float8

O

reimbursement_daily_dosage

program_medications.reimbursement_daily_dosage

float8

O

estimated_payment_amount

program_medications.estimated_payment_amount

float8

O

start_date

program_medications.start_date

date

O

end_date

program_medications.end_date

date

O

registry_number

program_medications.registry_number

varchar(255)

O

Example with values:

Preconditions

API paragraph not found

Global and configurable parameters

No

Input parameters

API paragraph not found

Filters

API paragraph not found

Dictionaries

API paragraph not found

Request structure

 Click here to expand...

mutation description - WIP

Authorize

  • 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

API paragraph not found

Request data validation

  1. Check that request using schema

    1. Return 422 with the list of validation errors in case validation fails.

  2. Check that registerType = 'FULL_MEDICATIONS_REGISTRY'

    1. Return 422 with the list of validation errors in case validation fails.

  3. Check that reasonDescription filled

    1. Return 422 with the list of validation errors in case validation fails.

  4. Check decoded and encoded input file according to file structure

    1. Return 422 with the list of validation errors in case validation fails.

File example:

*Note. Fields innms.sctid, innms.name, innms.name_original, innm_dosage_ingredients.is_primary, innm_dosage_ingredients.dosage.numerator_value, innm_dosage_ingredients.dosage.numerator_unit, innm_dosage_ingredients.dosage.denumerator_value, innm_dosage_ingredients.dosage.denumerator_unit, brand.code_atc can exist as an array. Values should be separated as | (respectively).

Processing

See Logic

Response structure

API paragraph not found

Post-processing processes

API paragraph not found

HTTP status codes

HTTP status code

Message

What caused the error

401

Invalid access token

 

403

Your scope does not allow to access this resource. Missing allowances: medication_registry:write

422

  • Such medication already exist.

  • Validadion errors.

Backward compatibility

API paragraph not found

  • No labels