...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Table of Contents |
---|
...
Table of Contents |
---|
- Specification
Status colour Green title done - Apiary
Status colour Green title Done - JSON schema request
Status colour Green title done - JSON schema response
Status colour Red title specs
Purpose
This WS is designed to update Innm substance (post).
APIary
Input
...
parameters
- id
- name (optional)
- innm_identifier (optional)
status (optional)
WS should work if there is at least one parameter present on payload.name_originalInfo - sctid
is_active
Authorize
- Verify the validity of access token
- Check user scope (scope = 'innmsubstance:write') in order to perform this action
- In case error - generate 401 response
Validate request (JSON schema)
Validate request using JSON schema (link !!! TBD)
Validate unique for Innms
Check existing substance
- Check exist substance by if $.innm_identifier id in payload - check unique by `innm_identifier`.
- if found - return 409 error (message: "Duplicate innm identifierSubstance does not exist!")
Validate statuses linked medication
Purpose validation: Status innm must be is equal to statuses linked medication.
- if $.status present in payload
- check availability linked medications check status for linked medications Get `is_active` medications (linked with substance) in the opposite $.is_active in payload
Code Block language sql IF EXISTS( SELECT * FROM medications M INNER JOIN ingridients ING ON ING.medication_idWHERE M.type == M.idINNM AND INGM.ingridients.innm_id == $.id AND M.statusis_active != $.statusis_active )
- if found - return 409 error (message: "Status innm must be is equal to statuses linked medications!")
Update
...
substance data
- Update innm substance data according to payload parameters.
Return data structure:
- id
...
- name
- name_original
- innm_identifier
...
is_active
tech info (created, updated)