Table of Contents |
---|
Specification
...
Code Block |
---|
"""
Fields to filter medication in the system.
"""
input MedicationFilter {
"Primary key identifier from the database."
databaseId: UUID
"Medicalation name."
name: String
"Activeness status."
isActive: Boolean
"Medication form."
form: String
"INNMDosage filter."
innmDosages: INNMDosageFilter
"Manufacturer filter."
manufacturer: ManufacturerFilter
"Anatomical Therapeutic Chemical Classification System"
atcCode: String
}
"""
Manufacturer filter.
"""
input ManufacturerFilter {
"Manufactorer name"
name: String
}
"""
Methods to use when ordering `Medication`.
"""
enum MedicationOrderBy {
"Sort Medication by form in ascending order."
FORM_ASC
"Sort Medication by form in descending order."
FORM_DESC
"Sort Medication by inserted_at in ascending order."
INSERTED_AT_ASC
"Sort Medication by inserted_at in descending order."
INSERTED_AT_DESC
"Sort Medication by manufacturer in ascending order."
MANUFACTURER_ASC
"Sort Medication by manufacturer in descending order."
MANUFACTURER_DESC
"Sort Medication by name in ascending order."
NAME_ASC
"Sort Medication by name in descending order."
NAME_DESC
}
"""
A connection to a list of `Medication` items.
"""
type MedicationConnection {
"Information to aid in pagination."
pageInfo: PageInfo!
"A list of nodes."
nodes: [Medication]
"A list of edges."
edges: [MedicationEdge]
}
"""
An edge in a connection of `Medication`.
"""
type MedicationEdge {
"The item at the end of the edge."
node: Medication!
"A cursor for use in pagination."
cursor: String!
}
"""
Input for `createMedication` mutation.
User must have scopes **medication:write**
"""
input CreateMedicationInput {
"Certificate number"
certificate: String!
"A day when certificate expired"
certificateExpiredAt: Date!
"Anatomical Therapeutic Chemical Classification System"
atcCodes: [String]!
"A container in medication (vacuum packed box, jar, etc.)"
container: CreateContainerInput!
"Daily dose of medication, recommended by WHO"
dailyDosage: Float
"Form of medication. The value should be present in the `MEDICATION_FORM` dictionary."
form: String!
"Ingredients in medication"
ingredients: [CreateMedicationIngredientInput]!
"Company that creates medication"
manufacturer: CreateManufacturerInput!
"Medication name"
name: String!
"A minimum quantity that could be sold"
packageMinQty: Int!
"Quantity of pills in medication"
packageQty: Int!
}
"""
Input for `Container` of `createMedication` mutation.
"""
input CreateContainerInput {
"Numerator unit. The value should be present in the `MEDICATION_UNIT` dictionary."
numeratorUnit: String!
"Numerator value"
numeratorValue: Int!
"Denumerator unit. The value should be present in the `MEDICATION_UNIT` dictionary."
denumeratorUnit: String!
"Denumerator value"
denumeratorValue: Int!
}
"""
Input for `MedicationIngredient` of `createMedication` mutation.
"""
input CreateMedicationIngredientInput {
"The size or frequency of a dose of a medicine or drug."
dosage: CreateDosageInput!
"Is the component primary or not"
isPrimary: Boolean!
"innmDosage ID"
innmDosage: ID!
}
"""
Input for `Dosage` of `createMedication` mutation.
"""
input CreateDosageInput {
"Numerator unit. The value should be present in the `MEDICATION_UNIT` dictionary."
numeratorUnit: String!
"Numerator value"
numeratorValue: Int!
"Denumerator unit. The value should be present in the `MEDICATION_UNIT` dictionary."
denumeratorUnit: String!
"Denumerator value"
denumeratorValue: Int!
}
"""
Input for `Manufacturer` of `createMedication` mutation.
"""
input CreateManufacturerInput {
"Manufacturer country"
country: String!
"Manufacturer name"
name: String!
}
"""
Return type for `createMedication` mutation.
"""
type CreateMedicationPayload {
"Created `Medication`."
medication: Medication
}
"""
Input for `deactivateMedication` mutation.
User must have scopes **medication:deactivate**
"""
input DeactivateMedicationInput {
"The ID of an object"
id: ID!
}
"""
Return type for `deactivateMedication` mutation.
"""
type DeactivateMedicationPayload {
"Deactivated `Medication`."
medication: Medication
}
"""
Trade mark medication. User must have a scope **medication:read**
"""
type Medication implements Node {
"The ID of an object"
id: ID!
"Primary key identifier from the database"
databaseId: UUID!
"Medication name"
name: String!
"Company that creates medication"
manufacturer: Manufacturer!
"Anatomical Therapeutic Chemical Classification System"
atcCodes: [String]!
"Form of medication. The value should be present in the `MEDICATION_FORM` dictionary."
form: String
"A container in medication (vacuum packed box, jar, etc.)"
container: Container!
"Quantity of pills in medication"
packageQty: Int!
"A minimum quantity that could be sold"
packageMinQty: Int!
"Daily dose of medication, recommended by WHO"
dailyDosage: Float
"Certificate number"
certificate: String!
"A day when certificate expired"
certificateExpiredAt: Date!
"Ingredients in medication"
ingredients: [MedicationIngredient]!
"is_active status"
isActive: Boolean!
"type od medication"
type: MedicationType
"Date and time when record was inserted"
insertedAt: DateTime!
"Date and time when record was updated"
updatedAt: DateTime!
}
"""
A company that makes medication.
"""
type Manufacturer {
"Manufacturer name"
name: String!
"Manufacturer country"
country: String!
}
"""
The kind of container that this package comes as.
"""
type Container {
"Numerator unit. The value should be present in the `MEDICATION_UNIT` dictionary."
numeratorUnit: String!
"Numerator value"
numeratorValue: String!
"Denumerator unit. The value should be present in the `MEDICATION_UNIT` dictionary."
denumeratorUnit: String!
"Denumerator value"
denumeratorValue: String!
}
"""
A component part of medication.
"""
type MedicationIngredient implements Ingredient {
"The size or frequency of a dose of a medicine or drug."
dosage: Dosage!
"Is the component primary or not"
isPrimary: Boolean!
"International Nonproprietary Name"
innmDosage: INNMDosage!
}
"""
Medication type.
"""
enum MedicationType {
"Trade name"
BRAND
"Medicinal forms"
INNM_DOSAGE
}
|
Purpose
This WS is designed to create new medication.
Input parameters
name
(object)
code_atc
form
info
package_qty
package_min_qty
certificate
expired_certificate_at
ingredients (array)
id
info
is_primary
Authorize
Verify the validity of access token
Check user scope (scope = 'medication:write') in order to perform this action
In case error - generate 401 response
Validate request
Validate request using features.
...
Table of Contents | ||||
---|---|---|---|---|
|
Required parameters are marked with "*"
Якщо інформації по відповідному параметру немає, потрібно зазначити: “APIparagraph not found”.
Purpose*
This WS is designed to create new medication.
Specification*
Page Properties | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic*
This method is used to create Medications. Fields descriptions are listed in request Example view.
Request structure*
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Authorize*
Verify the validity of access token
Check user scope (scope = 'medication:write') in order to perform this action
In case error - generate 401 response
Request to process the request using a token in the headers
Headers*
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation*
Validate FK
Purpose validation: Check on existing Substance/Innm in ingredients
Check exist `Medications` by $.ingredients[].id.
if invalid - return 422 error (message: "INNM in ingredients is not found!")
Validate status & type ingredients
Purpose validation: Id's in ingredients must be active
Invoke GetInnmByID($.ingredients[].id). Check exist any innm.is_active=FALSE.
if exists - return 422 error (message: "INNM in ingredients must be active!")
Purpose validation: Ingredients for TYPE=BRAND must be TYPE=INNM_DOSAGE
Check exists Ingredients with type=BRAND.
if exists - return 422 error (message: "Only INNM_DOSAGE can be ingredients!")
Validate status ingredients.is_primary
Purpose validation: in ingredients only one item must be is primary (TRUE)
Calculate count() where is_primary=TRUE in ingredients. Check count()>=1.
if invalid - return 422 error (message: "One of ingredients must be is primary!")
Validate Equal Dosage & Container
Purpose validation: Denumerator unit from Ingredients.dosage must be equal Numerator unit from Container.
Check exist any ($.ingredients[].dosage.denumerator_unit != $.container.numerator_unit).
if invalid - return 422 error (message: "Denumerator unit from Dosage ingredients must be equal Numerator unit from Container medication!")
Validate multiplicity
Purpose validation: Package_qty for container_dosage must have multiplicity package_min_qty. Result (Mod or % operator) must = 0 .
MEDICATION - Validate multiplicity (Mod == 0) $.package_qty Mod $.package_min_qty == 0
if result NOT 0 - return 409 error (message: "Only a multiplicity package quantity for the minimum package quantity medication!")
Validate atc code
Validate value according to regex ^[abcdghjlmnprsvABCDGHJLMNPRSV]{1}[0-9]{2}[a-zA-Z]{2}[0-9]{2}$
in case of error return ('Invalid code')
Check that all elements in array of atc_code are different
in case of error return 422 error (message `atc codes are duplicated`)
Validate request
Validate request using features.
Expand | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Validate FK
Purpose validation: Check on existing Substance/Innm in ingredients
Check exist `Medications` by $.ingredients[].id.
if invalid - return 422 error (message: "INNM in ingredients is not found!")
Validate status & type ingredients
Purpose validation: Id's in ingredients must be active
Invoke GetInnmByID($.ingredients[].id). Check exist any innm.is_active=FALSE.
if exists - return 422 error (message: "INNM in ingredients must be active!")
Purpose validation: Ingredients for TYPE=BRAND must be TYPE=INNM_DOSAGE
Check exists Ingredients with type=BRAND.
if exists - return 422 error (message: "Only INNM_DOSAGE can be ingredients!")
Validate status ingredients.is_primary
Purpose validation: in ingredients only one item must be is primary (TRUE)
Calculate count() where is_primary=TRUE in ingredients. Check count()>=1.
if invalid - return 422 error (message: "One of ingredients must be is primary!")
Validate Equal Dosage & Container
Purpose validation: Denumerator unit from Ingredients.dosage must be equal Numerator unit from Container.
Check exist any ($.ingredients[].dosage.denumerator_unit != $.container.numerator_unit).
if invalid - return 422 error (message: "Denumerator unit from Dosage ingredients must be equal Numerator unit from Container medication!")
Validate multiplicity
Purpose validation: Package_qty for container_dosage must have multiplicity package_min_qty. Result (Mod or % operator) must = 0 .
MEDICATION - Validate multiplicity (Mod == 0) $.package_qty Mod $.package_min_qty == 0
if result NOT 0 - return 409 error (message: "Only a multiplicity package quantity for the minimum package quantity medication!")
Validate atc code
Validate value according to regex ^[abcdghjlmnprsvABCDGHJLMNPRSV]{1}[0-9]{2}[a-zA-Z]{2}[0-9]{2}$
in case of error return ('Invalid code')
Check that all elements in array of atc_code are different
in case of error return 422 error (message `atc codes are duplicated`)
Create new Medication
Info |
---|
Saving innm dosage and medication occurs in one table - prm.medications. They are separated by the parameter type - innm_dosage and brand. Therefore, some fields may not be filled in when creating an innm dosage or medication. For example, max_daily_dosage is filled for innm dosage, but not filled for medication, etc. |
Create new record in Medications
Fill data
...
Destination
...
Source
...
id
...
name
...
$.name
...
TYPE
...
MEDICATION
...
is_active
...
TRUE
...
form
...
$.form
...
ingredients
...
$.ingredients
...
container
...
$.container
...
package_qty
...
$.package_qty
...
package_min_qty
...
$.package_min_qty
...
code_atc
...
$.code_atc
...
manufacturer
...
$.manufacturer
...
certificate
...
$.certificate
...
expired_certificate_at
...
$.expired_certificate_at
...
inserted_at
...
:timestamp
...
inserted_by
...
user_id
...
updated_at
...
:timestamp
...
updated_by
...
user_id
...
daily_dosage
...
number
Create new Ingredients
Create new record in Ingredients from $.ingredients
Fill data
...
Destination
...
Source
...
id
...
dosage
...
$.ingredients.dosage
...
parent_id
...
medication_id
...
innm_child_id
...
NULL
...
medication_child_id
...
$.ingredients.innm_dosage_id
...
is_primary
...
$.ingredients.is_primary
...
inserted_at
...
:timestamp
...
inserted_by
...
user_id
...
updated_at
...
:timestamp
...
updated_by
...
|
Processing*
Info |
---|
Saving innm dosage and medication occurs in one table - prm.medications. They are separated by the parameter type - innm_dosage and brand. Therefore, some fields may not be filled in when creating an innm dosage or medication. For example, max_daily_dosage is filled for innm dosage, but not filled for medication, etc. |
Create new record in Medications
Fill data
Destination | Source |
---|---|
id | |
name | $.name |
TYPE | MEDICATION |
is_active | TRUE |
form | $.form |
ingredients | $.ingredients |
container | $.container |
package_qty | $.package_qty |
package_min_qty | $.package_min_qty |
code_atc | $.code_atc |
manufacturer | $.manufacturer |
certificate | $.certificate |
expired_certificate_at | $.expired_certificate_at |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
daily_dosage | number |
Create new Ingredients
Create new record in Ingredients from $.ingredients
Fill data
Destination | Source |
---|---|
id | |
dosage | $.ingredients.dosage |
parent_id | medication_id |
innm_child_id | NULL |
medication_child_id | $.ingredients.innm_dosage_id |
is_primary | $.ingredients.is_primary |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
Response structure*
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Post-processing processes*
API paragraph not found
HTTP status codes*
Page Properties | |||||||||
---|---|---|---|---|---|---|---|---|---|
|