Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Purpose

This WS allows to create new medication program participant.

...

  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 Program medication.

  3. Program medication can be created only for a medical program with type MEDICATION.

Specification

...

Page Properties

Link

API paragraph not found

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

Resource

API paragraph not found

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

Scope

program_medication: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

API paragraph not found

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

Logic

  1. Create new program medication entity: store input into program_medications table (prm). Also, set:

    1. medication_request_allowed = true

    2. is_active = true

    3. inserted_at, updated_at = user_id (from token)

    4. inserted_at, updated_at = current date and time.

...

  1. Check medicalProgramId:

    1. exists in DB

      1. in case of error - return 404 ('not_found')

    2. has type = MEDICATION

      1. in case of error - return 409 ('MedicalProgram type should be MEDICATION')

    3. is_active = true

      1. in case of error - return 409 ('Medical program is not active')

  2. Check start_date < end_date

    1. in case of error - return 422 ('must be earlier than the end date')

  3. Validate reimbursement:

    1. If reimbursement type = FIXED, than reimbursementAmount field required

    2. If reimbursement type = PERCENTAGE, percentageDiscount field required

      1. in case of error - return 422 ('can't be blank')

  4. If percentageDiscount submitted in the reimbursement structure:

    1. Check it’s value in range from 0 to 100

      1. in case of error - return 422 ('expected the value to be <= 100')

  5. Validate medicationId:

    1. Check it is active and it’s type is BRAND

      1. in case of error - return 409 ('Medication is not active')

  6. Validate compliance of INNM_DOSAGE.mr_blank_type of a BRAND to medicalProgram.mr_blank_type:

    1. Check INNM_DOSAGE

      1. There is link of a BRAND to INNM_DOSAGE (in prm.ingredients table) and INNM_DOSAGE exists

        1. in case of error - return 404 ('INNM_DOSAGE of a BRAND not_found')

      2. is_active = true

        1. in case of error - return 409 ('INNM_DOSAGE of a BRAND is not active')

    2. Check compliance of INNM_DOSAGE of a BRAND to medicalProgram

      1. if INNM_DOSAGE.mr_blank_type = medicalProgram.mr_blank_type
        (i.e prm.medications.mr_blank_type = prm.medical_programs.mr_blank_type)

        1. in case of error - return 422 ('Dosage form of selected Medication does not comply with mr_blank_type requirement of Medical Program')

Processing

API paragraph not found

...

Page Properties

HTTP status code

Message

What caused the error

200

Response

 

401

Invalid access token

 

403

Your scope does not allow to access this resource. Missing allowances: program_medication:read

404

Not found

  • medicalProgramId exists in DB check fails.

  • INNM_DOSAGE of a BRAND not_found.

409

  • INNM_DOSAGE of a BRAND is not active.

  • Medication is not active.

  • Medical program is not active.

  • MedicalProgram type should be MEDICATION.

422

  • must be earlier than the end date.

  • can't be blank.

  • expected the value to be <= 100.

  • Dosage form of selected Medication does not comply with mr_blank_type requirement of Medical Program.

Backward compatibility

API paragraph not found