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
NHS admin user download file with fields according to its structure.
The file should be in .csv format.
Specification
Specification for Create full medication registry
"Creates a single `MedicationRegistry`."
createMedicationRegistry(
input: CreateMedicationRegistryInput!
): CreateMedicationRegistryPayload
"""
Input for `createMedicationRegistry` mutation.
User must have a scope **medication_registry:write**
"""
input CreateMedicationRegistryInput {
"Type of register originating medication registry data. The value should be present in the `REGISTER_TYPE` dictionary."
registerType: String!
"Create medication registry reason description."
reasonDescription: String!
"Input file in csv format with medication register."
csvData: Upload!
}
"""
Return type for `createMedicationRegistry` mutation.
"""
type CreateMedicationRegistryPayload {
"Created `MedicationRegistryJob`."
medicationRegistryJob: MedicationRegistryJob
}
"""
An object for MedicationRegistryJob.
"""
type MedicationRegistryJob implements Node {
"The ID of an object"
id: ID!
"Primary key identifier from the database"
databaseId: UUID!
"Job name."
name: String
"Medication registry Job status."
status: JobStatus!
"Job execution strategy."
strategy: JobStrategy!
"Date and time when the job starts."
startedAt: DateTime!
"Date and time when the job ends."
endedAt: DateTime
"Tasks within this job."
tasks(
"A condition to be used in determining which values should be returned by the collection."
filter: TaskFilter
"The method to use when ordering collection items."
orderBy: TaskOrderBy
"Read all values in the set after (below) this cursor."
after: String
"Read all values in the set before (above) this cursor."
before: String
"Only read the first _n_ values of the set."
first: Int
"Only read the last _n_ values of the set."
last: Int
): MedicationRegistryTaskConnection!
"Type of register originating medication registry data. The value should be present in the `REGISTER_TYPE` dictionary."
registerType: String!
"Medication registry job reason description."
reasonDescription: String!
}
"""
A connection to a list of `MedicationRegistryTask` values.
"""
type MedicationRegistryTaskConnection {
"Information to aid in pagination."
pageInfo: PageInfo!
"A list of nodes."
nodes: [MedicationRegistryTask]
"A list of edges."
edges: [MedicationRegistryTaskEdge]
}
"""
Reads and enables pagination through a set of `MedicationRegistryTask`.
"""
type MedicationRegistryTaskEdge {
"The item at the end of the edge."
node: MedicationRegistryTask!
"A cursor for use in pagination."
cursor: String!
}
"""
A child of a `MedicationRegistryJob`, contains the result of task execution.
"""
type MedicationRegistryTask implements Node {
"The ID of an object"
id: ID!
"Primary key identifier from the database"
databaseId: UUID!
"Task name."
name: String
"Task status, is set automatically."
status: TaskStatus!
"Task meta data."
meta: MedicationRegistryTaskMeta
"Date and time when task was executed."
endedAt: DateTime
"Task error."
error: TaskError
"Technical information when task was inserted into the DB."
insertedAt: DateTime!
"Technical information when task was updated in the DB."
updatedAt: DateTime!
}
"""
Metadata of a `MedicationRegistryTask`.
"""
type MedicationRegistryTaskMeta {
"Primary key identifier of an entity from the database."
databaseId: UUID
"Line number of csv file from input."
csvDataLine: Int
}
Logic*
Потрібно по пунктах описати логіку методу API або додати діаграму
Preconditions
Які передумови мають бути виконані системою/користувачем. Наприклад:
Global and configurable parameters
Потрібно вказати глобальні та конфігураційні параметри.
Наприклад:
Variable | Values | Description |
---|
CARE_PLAN_<category>_ICD10_AM_CONDITIONS_ALLOWED | Values that matches with dictionaryeHealth/ICD10_AM/condition_codes Example: “E10.32, E11.92” | Allowed diagnoses for specified care plan category. Diagnoses should match with eHealth/ICD10_AM/condition_codes dictionary, <category> - is a value from dictionary eHealth/care_plan_categories in uppercase (Example: CARE_PLAN_CLASS_1_ICD10_AM_CONDITIONS_ALLOWED) |
Потрібно вказати вхідні параметри запиту. Наприклад, для GET /patients/composition/job/{{asyncJobId}} вхідний параметр:
Input parameter | Values | Type | Description | Example |
---|
asyncJobId | | String | Async Job Object ID | |
Filters
Потрібно вказати фільтри. Наприклад, для GET /api/medication_requests/{{id}}/dispenses?status=PROCESSED фільтр:
Filter | Values | Type | Description | Example |
---|
status | | String | Optional | PROCESSED |
Dictionaries
Потрібно вказати довідники, які використовує метод API
Request structure*
See on Apiary
Example:
Request example
{
"category": {
"coding": [
{
"system": "eHealth/composition_categories",
"code": "LIVE_BIRTH"
}
]
},
"type": {
"coding": [
{
"system": "eHealth/composition_types",
"code": "NEWBORN"
}
]
},
"event": [
{
"code": {
"coding": [
{
"system": "eHealth/composition_events",
"code": "COMPOSITION_VALIDITY_PERIOD"
}
]
},
"period": {
"start": "2020-06-26T15:22:53.403Z",
"end": "2020-07-26T15:22:53.403Z"
}
}
],
"subject": {
"type": {
"coding": [
{
"system": "eHealth/composition",
"code": "string"
}
],
"text": "string"
},
"value": "e49abc30-6d17-11ea-b83c-673680173afa"
},
"encounter": {
"type": {
"coding": [
{
"system": "eHealth/composition",
"code": "string"
}
],
"text": "string"
},
"value": "e49abc30-6d17-11ea-b83c-673680173afa"
},
"author": {
"type": {
"coding": [
{
"system": "eHealth/composition",
"code": "string"
}
],
"text": "string"
},
"value": "e49abc30-6d17-11ea-b83c-673680173afa"
},
"section": {
"focus": {
"type": {
"coding": [
{
"system": "eHealth/composition",
"code": "string"
}
],
"text": "string"
},
"value": "e49abc30-6d17-11ea-b83c-673680173afa"
}
},
"extension": [
{
"valueCode": "AUTHORIZE_WITH",
"valueUuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
{
"valueCode": "IS_ACCIDENT",
"valueBoolean": true
},
{
"valueCode": "TREATMENT_VIOLATION",
"valueString": "late_arrival"
},
{
"valueCode": "TREATMENT_VIOLATION_DATE",
"valueDate": "2020-12-12"
},
{
"valueCode": "IS_INTOXICATED",
"valueBoolean": true
},
{
"valueCode": "IS_FOREIGN_TREATMENT",
"valueBoolean": true
},
{
"valueCode": "IS_FORCE_RENEW",
"valueBoolean": true
}
]
}
Authorize*
Вимоги до авторизації: яким чином надається доступ до використання методу
Request to process the request using a token in the headers
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
api-key:uXhEczJ56adsfh3Ri9SUkc4en
Request data validation*
Валідація даних
Наприклад:
Validate request using JSON schema
In case validation failed - generate 422 error
JSON schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"verification_code": {
"type": "string"
}
},
"required": [
"verification_code"
],
"additionalProperties": false
}
Processing*
Потрібно описати процеси, які відбуваються з даними
1. Using global parameters
Потрібно викликати глобальні параметри (Global parameters), щоб отримати наведені нижче параметри
Response structure*
See on Apiary
Example:
Response example
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "PENDING",
"eta": "string",
"doneAt": "string",
"links": [
{
"entity": "eHealth/composition",
"href": "composition/0daaad78-6cfb-11ea-9cd6-afab698838bc",
"error": "string"
}
]
}
}
Post-processing processes*
Що має відбутися в ЦБД після опрацювання та відправлення відповіді, тощо
HTTP status codes*
Backward compatibility
Сумісність з попередніми версіями методу