Versions Compared

Key

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

Purpose

This WS is designed to qualify Device Request: check the ability of dispense Device Request within the Medical program.

...

Table of Contents

Purpose

This WS is designed to qualify Device Request: check the ability of dispense Device Request within the Medical program.

Key points

  1. Only authenticated and authorized users with appropriate scope can invoke Qualify Device Request

  2. This method returns for existing Device Request the result of data validation within each submitted medical program, but not creates any entities in the system.

  3. Each Medical program may have its unique conditions for the Device Dispense. They can be based on analysis of personal info, device definition list, terms, locations and combinations of them.

  4. Any Medical program can have separate block of branching logic configured at medical program settings by NHS administrator.

  5. Сompatibility is checked only for programs which are available in payload (array).

  6. Successful invocation of the method returns decision for each program if it is valid or not to create Device dispense with submitted combination of parameters in the payload. If program is invalid, the reason must be returned in the response.

  7. Allowed for existing and active Device Requests with medical program

  8. Also medical program provision is checked for the division of the pharmacy.

...

  • Check that device request exists and has ACTIVE status

    • in case of error - return 422 ('Device request not found')

  • Check that intent specified in Device request is order

    • in case of error - return 409 error ('Only device request with intent = 'order' can be dispensed')

  • has a program

    • in case of error - return 409 ('Device request without a program cannot be qualified')

  • has dispense_valid_to that is greater or equal to current date

    • in case of error - return 409 ('Device request is expired for dispense')

Validate related Care plan

If reference on activity in device_request.based_on is present and not null:

  1. Verify care plan Activity from $.based_on where coding.code=activity:

    1. It has scheduled or in_progress status

      1. in case of error - return 409 (message: "Invalid Activity status")

  2. Verify Care plan:

    1. Get Activity from $.based_on where coding.code=activity

    2. Get Care plan from activity.care_plan

      1. It should be in active status

        1. in case of error - return 409 (message: "Invalid Care plan status")

      2. Care plan's period end (if exist) should be greater than current date or equal.

        1. in case of error - return 409 (message: “Care plan expired“)

Check for existing Device dispenses

...

  • Check that division exists

    • in case of error - return 409 ("Division not found")

  • Check that division is active

    • in case of error - return 409 ("Division is not active")

  • Validate division belongs to user's legal entity (client_id from token)

    • in case of error - return 409 ("Division does not belong to user's legal entity")

  • If chart parameter DEVICE_DISPENSE_DIVISION_DLS_VERIFY is on, then validate division is DLS verified (dls_verified=true)

    in

    DEVICE_DISPENSE_DIVISION_DLS_VERIFY is on, then validate division is DLS verified (dls_verified=true)

    • in case of error - return 409 "Division is not verified in DLS"

  • If the medical program has no setting skip_dispense_division_dls_verify or it is set in false/null validate:

    • Check $.division.dls_verify == true:

      • In case of error - return 409 "Division is not verified in DLS"

    else if skip_dispense_division_dls_verify = true, then skip license verification for the division

Validate Medical programs

...

Validate medical program provision

If the medical program has no setting skip_contract_provision_verify or it is set in false/null validate:

  • Check $.division participates in submitted program. Validate Provision for the medical program:

    • Medical program in the request has funding_source = NHS

      1. In case of error - return reject_reason = "Program was configured incorrectly - incorrect source of funding"

    • Provision exist and active, relates to the $.location and to the actual reimbursement contract: contract.start_date <= current_date <= contract.end_date, is_active = true, status = VERIFIED, contracts.type==reimbursement, contracts.contractor_legal_entity_id=token.client_id, contracts.medical_program_id==$.medical_program_id

      1. in case of error - return reject_reason = "Medical program provision is not related to any actual contract for the current date"

    • Сontract is_suspended = false

      1. in case of error - return reject_reason="Contract with number <contract_number> is suspended"

else if skip_contract_provision_verify = true, then skip provision verification for the medical program

Find Program participants

If device_request.code specified, then:

  • Find program_devices related to the program, that:

    • are active

    • have validity period (start_date and end_date) within current date

      • in case not found - return reject_reason = “No appropriate participants found for this medical program“

  • For found program_devices check there at least one appropriate Device Definition, that:

    • is active

    • has packaging_unit that matches to quantity.code of the Device Request

      • in case of error - return reject_reason = “Not found any active Device Definition with the same units of measure as pointed in the quantity of the Device Request”

    • has the same code as in the Device Request

      • in case of error - return reject_reason = “Not found any active device definition with classification type that match with code from device request”

    • has a remainder of the division ($.device_request.quantity.value/device_definition.packaging_count) that is equal to 0

      • in case of error - return reject_reason = “The quantity in the Device Request must be divisible to packaging_count of at least one related Device Definition”

If device_request.code_reference specified, then:

  • Find program_devices related to the program, that:

    • are active

    • related to the Device definition(device_request.code_reference)

    • have validity period (start_date and end_date) within current date

      • in case not found - return reject_reason = “No appropriate participants found for this medical program“

  • For found program_devices check Device Definition, that:

    • is active

      • in case of error - return reject_reason = "Device definition is not active"

    • has packaging_unit that matches to quantity.code of the Device Request

      • in case of error - return reject_reason = “Units of measure in the Device definition doesn't correspond to the units of measure in the Device request”

    • has a remainder of the division ($.device_request.quantity.value/device_definition.packaging_count) that is equal to 0

      • in case of error - return reject_reason = “The quantity in the Device Request must be divisible to packaging_count of the related Device Definition”

Service logic

Generate structure for response

...