Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Specification

...

titleSchema

...

Table of Contents

Purpose

This WS allows to create a new medical program

Key points

  1. This is a graphQl method used in the Administration panel only.

  2. Only authenticated and authorized NHS employee with an appropriate scope can create a medical program.

  3. A medical program with the type MEDICATION or SERVICE can be created.

Specification

Page Properties

Link

See GraphQl Specification

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

Resource

See GraphQl Specification

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

Scope

medical_program:write

Scope для доступу

Components

Medical Programs

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: 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

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

Public/Private/Internal

Internal

Logic

  1. Create medical program entity in medical_programs table (prm).

  2. Set fields submitted on input: name and type.

  3. Set following fields by default:

    1. id = generate UUID value

    2. is_active = true

    3. medication_request_allowed = true

    4. medication_dispense_allowed = true

    5. medical_program_settings = null

    6. inserted_at, updated_at = current date and time

    7. inserted_by, updated_by = current user (from token).

Input parameters

API paragraph not found

Filters

API paragraph not found

Dictionaries

  • FUNDING_SOURCE

  • MR_BLANK_TYPES

  • PROVIDING_CONDITION

  • eHealth/clinical_impression_patient_categories

  • LICENSE_TYPE

  • MEDICAL_PROGRAM_TYPE

GraphQl Specification

Expand
titlecreateMedicalProgram
Code Block
  "Creates a single `MedicalProgram`."
  createMedicalProgram(
    input: CreateMedicalProgramInput!
  ): CreateMedicalProgramPayload

Code Block
"""
Input for `createMedicalProgram` mutation.
User must have a scope **medical_program:write**
"""
input CreateMedicalProgramInput {
  "The name of the `MedicalProgram`."
  name: String!
  "Type of the `MedicalProgram`. The value should be present in the `MEDICAL_PROGRAM_TYPE` dictionary."
  type: String!
}

Code Block
"""
Return type for `createMedicalProgram` mutation.
"""
type CreateMedicalProgramPayload {
  "Created `MedicalProgram`."
  medicalProgram: MedicalProgram
}

"""
MedicalProgram contains details about medical program for reimbursement and services.

In order to obtain details user must have a scope **medical_program:read**
"""
type MedicalProgram implements Node {
  "The ID of an object."
  id: ID!
  "Primary key identifier from the database."
  databaseId: UUID!
  "The name of the `MedicalProgram`."
  name: String!
  "Type of the `MedicalProgram`."
  type: String!
  "Whether the `MediaclProgram` is active or not?"
  isActive: Boolean!
  "Date and time when record was inserted."
  insertedAt: DateTime!
  "Date and time when record was updated."
  updatedAt: DateTime!
  "Whether it is possible to create `Medication Request`"
  medicationRequestAllowed: Boolean!
  "Medication request allowed status description"
  medicationRequestAllowedText: String
  "Whether it is possible to create `Medication Dispense`"
  medicationDispenseAllowed: Boolean!
  "Medication dispense allowed status description"
  medicationDispenseAllowedText: String
  "Medical program settings"
  medicalProgramSettings: MedicalProgramSettings
  "Medical program settings description"
  medicalProgramSettingsText: String
}

"""
Medical program settings. Described at https://edenlab.atlassian.net/wiki/spaces/EH/pages/3132620836/Medical+program+settings
"""
type MedicalProgramSettings {
  "Skip MNN in treatment period requirement flag"
  skipMnnInTreatmentPeriod: Boolean
  "Care plan requirement flag"
  carePlanRequired: Boolean!
  "Skip employee validation requirement flag"
  skipEmployeeValidation: Boolean
  "Allowed employee types from `EMPLOYEE_TYPE` dictionary to create medication request"
  employeeTypesToCreateMedicationRequest: [String]
  "Speciality types allowed. From `SPECIALITY_TYPE` dictionary"
  specialityTypesAllowed: [String]
  "conditions ICD10_AM allowed. From `eHealth/ICD10_AM/condition_code` dictionary"
  conditionsIcd10AmAllowed: [String]
  "Conditions ICPC2 allowed. From `eHealth/ICPC2/condition_code` dictionary"
  conditionsIcpc2Allowed: [String]
  "Maximum length in days of treatment period for `Medication Request` created with the program"
  medicationRequestMaxPeriodDay: Int
  "Providing conditions allowed

" providingConditionsAllowed: [String] } """ Input for `createMedicalProgram` mutation

. 

User must have a scope **medical_program:write** """ input CreateMedicalProgramInput { "The name of the `MedicalProgram`." name: String! "Type of the `MedicalProgram`. The value should be present in the `MEDICAL_PROGRAM_TYPE` dictionary.

From `PROVIDING_CONDITION` dictionary"
  

type

providingConditionsAllowed: [String

!

]

}

  "

""

Skip 

Return

declaration 

type

verification for 

`createMedicalProgram` mutation. """ type CreateMedicalProgramPayload { "Created `MedicalProgram`." medicalProgram: MedicalProgram } """ Input for `updateMedicalProgram` mutation. User must have a scope **medical_program:write** """ input UpdateMedicalProgramInput { "The ID of an object." id: ID! "Whether it is possible to

employee on create `Medication Request`"
  

medicationRequestAllowed

skipMedicationRequestEmployeeDeclarationVerify: Boolean
  "

Medication

Skip 

request

declaration 

allowed

verification 

status

for 

description"

legal entity 

medicationRequestAllowedText: String "Whether it is possible to

on create `Medication 

Dispense`

Request`"
  

medicationDispenseAllowed

skipMedicationRequestLegalEntityDeclarationVerify: Boolean
  "

Medication

Allows multi dispense 

allowed

for 

status

`Medication 

description

Request`"
  

medicationDispenseAllowedText

multiMedicationDispenseAllowed: 

String

Boolean
  "

Medical

Allows 

program

to 

settings"

process `Medication Dispense` 

medicalProgramSettings:

without 

MedicalProgramSettingsInput

digital 

sign"

Medical


program

 

settings description" medicalProgramSettingsText: String } """ Input for `MedicalProgramSettings` of `updateMedicalProgram` mutation. """ input MedicalProgramSettingsInput { "Skip MNN in treatment period requirement flag" skipMnnInTreatmentPeriod

 skipMedicationDispenseSign: Boolean
  "

Care

Disables 

plan

patient 

requirement

notification 

flag"

on operations with 

carePlanRequired: Boolean! "Skip employee validation requirement flag" skipEmployeeValidation

`Medication Request`"
  medicationRequestNotificationDisabled: Boolean
  "

Allowed employee types to create

Specifies medication 

request" employeeTypesToCreateMedicationRequest: [String] "Speciality types allowed" specialityTypesAllowed: [String] "conditions ICD10_AM allowed" conditionsIcd10AmAllowed: [String] "Conditions ICPC2 allowed" conditionsIcpc2Allowed: [String] "Maximum length in days of treatment period for `Medication Request` created with the program

dispense period in days"
  

medicationRequestMaxPeriodDay: Int "Providing conditions allowed" providingConditionsAllowed: [String] } """ Return type for `updateMedicalProgram` mutation. """ type UpdateMedicalProgramPayload { "Updated `MedicalProgram`." medicalProgram: MedicalProgram } """ Input for `deactivateMedicalProgram` mutation. User must have a scope **medical_program:deactivate** """ input DeactivateMedicalProgramInput { "The ID of a `MedicalProgram` to deactivate." id: ID! } """ Return type for `deactivateMedicalProgram` mutation. """ type DeactivateMedicalProgramPayload { "Deactivated `MedicalProgram`." medicalProgram: MedicalProgram }

Purpose

This WS is designed to create new medical program.

...

medicationDispensePeriodDay: Int
}

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 = 'medical_program:write')

...

  1. In case error - generate 403 response

Validate request (JSON schema)

  1. Validate request using JSON schemas (TBD):

    1. Return 422 with list of validation errors in case validation fails (422 EView)

Create new Medical Program

  1. Create new record in Medical_programs 

...

Destination

...

Source

...

Type

...

Default

...

M/O

...

Description

...

id

...

uuid

...

M

...

Autogenerated

...

name

...

varchar

...

M

...

is_active

...

boolean

...

M

...

type

...

varchar

...

M

...

Dictionary: MEDICAL_PROGRAM_TYPE

...

medication_request_allowed

...

boolean

...

M

...

medication_dispense_allowed

...

boolean

...

M

...

medication_request_allowed_text

...

varchar

...

O

...

medication_dispense_allowed_text

...

varchar

...

O

...

medical_program_settings

...

jsonb

...

null

...

O

...

skip_mnn_in_treatment_period

...

boolean

...

false

...

M

...

Allow to create medication request with the same innm in one treatment period

...

employee_types_to_create_medication_request

...

[varchar]

...

null

...

O

...

Allow to create medication request for particular types of employees (if empty - all employee types, which have scopes can create medication request without limitations). Fills with values from EMPLOYEE_TYPE dictionary.

Example: ["DOCTOR", "SPECIALIST"]

...

speciality_types_allowed

...

[varchar]

...

null

...

O

...

Allows to create:

  • Medication Request for particular specialities $.employees.speciality.speciality(speciality_officio == true) of employees with SPECIALIST type (if empty - all specialists who have scopes can create medication request w/o limitations). 

  • care plan's Activity for particular specialities $.employees.speciality.speciality(speciality_officio == true) of employees. If empty - all employees who have scopes can create Activity w/o any limitations.

Fills with values from SPECIALITY_TYPE dictionary. For example: ["ENDOCRINOLOGY", "FAMILY_DOCTOR"]

...

care_plan_required

...

boolean

...

false

...

M

...

Allow to create medication request for with reference on care plan

...

skip_employee_validation

...

boolean

...

false

...

M

...

Allows to skip all employee validations, including restrictions in the employee_types_to_create_medication_request and speciality_types_allowed parameters. So, any user who has a scope can create medication request

...

conditions_icd10_am_allowed

...

[varchar]

...

null

...

O

...

Array of condition codes from eHealth/ICD10_AM/condition_codes dictionary. For example: ["M61.25", "L70.0"]

Allows to create:

  • Medication Request Request with encounter in context that should have primary diagnosis with code that correspond to config. 

  • Activity with addresses field of related Care plan that should have condition codes that correspond to config.

If absent - any ICD10_AM condition codes allowed.

Can be combined with codes in conditions_icpc2_allowed

...

conditions_icpc2_allowed

...

[varchar]

...

null

...

O

...

 Array of condition codes from eHealth/ICPC2/actions dictionary. For example: ["R25","R80","L09"]

Allows to create Medication Request Request or Activity according to the logic as described for conditions_icd10_am_allowed

If absent - any ICPC2 condition codes allowed.

Can be combined with codes in conditions_icpc2_allowed

...

medication_request_max_period_day

...

integer

...

null

...

O

...

Maximum period length (in days) allowed for the Medication request with the medical program. Has a precedence over the same chart parameter

...

providing_conditions_allowed

...

[varchar]

...

null

...

O

...

 Allowed terms of service for a Care plan to create activity with the medical program. Fills with values from PROVIDING_CONDITION dictionary. For example: ["INPATIENT", "OUTPATIENT"]

...

medical_program_settings_text

...

varchar

...

O

...

 Comment on update medical_program_settings

...

inserted_at

...

Timestamp: now()

...

M

...

Get current date-time

...

inserted_by

...

Token: user_id

...

M

...

Extract user from token

...

updated_at

...

Timestamp: now()

...

M

...

Get current date-time

...

updated_by

...

Token: user_id

...

M

...

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: medical_program:write”) in case of invalid scope(s).

Headers

API paragraph not found

Request data validation

Validate legal entity

  • Extract client_id from token.

  • Check client scopes in order to perform this action (scope = 'medical_program:write')

    • in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: medical_program:write”).

  • Check type = NHS

    • in case of error - return 403 ('You don’t have permission to access this resource').

Validate request

Validate input according to schema only

Processing

API paragraph not found

Response structure

API paragraph not found

Post-processing processes

API paragraph not found

HTTP status codes

Page Properties

HTTP status code

Message

What caused the error

 401

 Invalid access token

 

 403

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

  • You don’t have permission to access this resource.

 

Backward compatibility

API paragraph not found