ЕСОЗ - публічна документація
Deactivate innm dosage registry
Purpose
The service is designed to upload deactivation innm_dosage and connected medication and program_medication records. 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.
Specification
Link | GraphQL method | Посилання на Apiary або Swagger |
Resource | GraphQL method | Посилання на ресурс, наприклад: /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 | Async | Метод є синхронним чи асинхронним? |
Public/Private/Internal | Internal | Потрібно зазначити тип методу за ступенем доступності |
Logic
Validate input according to schema
Validate existing and deactivate entities of innm_dosage registry:
Extract medications (type = INNM_DOSAGE) by innm_dosage.id from file and define last dispense_valid_to between IL.medication_request_requests.data (status = NEW) and OPS.medication_requests (status = ACTIVE):
In case any medication_request_requests and medication_requests set for active records (is_active = true)
PRM.medications (type = INNM_DOSAGE)
is_active = false
end_date = current_date ()
updated_at = now()
updated_by = user_id, from token
PRM.medications (type = BRAND)
is_active = false
end_date = current_date ()
updated_at = now()
updated_by = user_id, from token
PRM.program_medications
medication_request_allowed = false
care_plan_activity_allowed = false
is_active = false
end_date = current_date ()
updated_at = now()
updated_by = user_id, from token
In case found medication_request_requests and medication_requests set for active records (is_active = true):
PRM.medications (type = INNM_DOSAGE)
end_date = $.dispense_valid_to
updated_at = now()
updated_by = user_id, from token
PRM.medications (type = BRAND)
end_date = $.dispense_valid_to
updated_at = now()
updated_by = user_id, from token
PRM.program_medications
medication_request_allowed = false
care_plan_activity_allowed = false
end_date = $.dispense_valid_to
updated_at = now()
updated_by = user_id, from token
Return job identifier with result.
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)
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 = 'DEACTIVATE_INNM_DOSAGE_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 that the identifiers from the request exist and active
Return 404 with the list of validation errors in case validation fails.
File example:
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 |
| Validation error |
ЕСОЗ - публічна документація