Versions Compared

Key

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

...

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

  2. Device Request is created in async way. Successful result of the job should return a link on the created Device Request (look at RС_[UPD] Get Device request details).

  3. Device Request should be signed with DS. Signed content stores in the media storage.

  4. All validations within Device request attributes should be executed by internal call of RС_[UPD] PreQualify Device request function

  5. Device Request can be created for a person only

  6. Medical program is optional in the Device Request

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#Validate17782014958#Validate-Patient

Skip the following validation in case madical_program is not specified in the request

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#117782014958#1.-Validate-requester

2. Validate based on

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#217782014958#2.-Validate-based-on

3. Validate intent

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#317782014958#3.-Validate-intent

4. Validate code or code_reference

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#417782014958#4.-Validate-code-or-code_reference

Skip the following validation in case madical_program is not specified in the request

Note
  • Check that there is at least one active device_definition with the same type (device_definitions.classification_type)

    • device_definitions.is_active = true

      • in case of error - return 422 ('No active device_definitions with the same type')

5. Validate quantity

Info

If medical program is not specified in request then quantity is optional here

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#517782014958#5.-Validate-quantity

  • Check that $.quantity.system is device_unit dictionary, required

    • in case of error - return 422 ('value is not allowed in enum')

  • Check that $.quantity.code comply with $.quantity.system, required

    • in case of error - return 422 ('value is not allowed in enum')

  • Check that $.quantity.value is integer, required

    • in case of error - return 422 ('Value should be an integer')

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#617782014958#6.-Validate-encounter

7. Validate authored on

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#717782014958#7.-Validate-authored-on

8. Validate occurrence

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#817782014958#8.-Validate-occurrence

9. Validate reason

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#917782014958#9.-Validate-reason

10. Validate Package unit and quantity

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#1017782014958#10.-Validate-Package-unit-and-quantity

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#1117782014958#11.-Validate-Medical-programs

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#1217782014958#12.-Validate-priority

13. Validate supporting info

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#1317782014958#13.-Validate-supporting-info

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#1417782014958#14.-Validate-performer

15. Validate parameter

...

https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670537622/UPD+PreQualify+Device+request#1517782014958#15.-Validate-parameter

Validate status

...

  1. Save signed content to media storage, in bucket pointed in MEDIA_STORAGE_DEVICE_REQUEST_BUCKET chart parameter

  2. Fill in the following fields:

    1. requisition. Generate requisition number as described at Human readable Medication request number, but based on the Device Request identifier and put it in the field.

    2. signed_content_links. Add string item in the array with a link on saved content in media storage

    3. status = ACTIVE

    4. status_reason = null

    5. subject. Set hashed patient_id from URL

    6. requester_legal_entity. Set client_id from token

    7. quantity.unit. Set description according to quantity code and system

    8. dispense_valid_to. dispense_valid_to. Set (current_date + dispense_period_day) if medical program was set and it has dispense_period_day setting. Otherwise, if medical program was set and it has NO dispense_period_day setting, set the value using device_dispense_period global parameter. Else, if medical program was NOT set dispense_valid_to = null.

      1. Save dispense_valid_to as datetime but truncate time to beginning of date (2013-08-02T00:00:00Z)

    9. verification_code. Generate random 4-digit code if medical program was set

    10. context_episode_id. Set episode from the $.encounter

    11. context_care_plan_id. Get Activity from $.based_on, set activity.care_plan as context_care_plan_id

    12. based_on. Set based_on from the $.based_on

    13. priority. Set priority from the $.priority

    14. parameter. Set parameter from the $.parameter

    15. performer. Set performer from the $.performer

    16. supporting_info. Set supporting_info from the $.supporting_info

    17. inserted_at. Set current date and time

    18. updated_at. Set current date and time

    19. inserted_by. Set current user from token

    20. updated_by. Set current user from token

  3. Send notification to patient:

    1. Determine patient's default authentication method as described at Determination of a default authentication method and return person's active auth_methods

    2. Get program from request and (if provided) get program setting request_notification_disabled:

      1. if program provided and request_notification_disabled == true:

        1. do not send SMS notification to patient

      2. if program provided and request_notification_disabled == false and OTP defined on patient:

        1. generate text according to CREATE_DEVICE_REQUEST_SMS_TEMPLATE and send SMS with verification_code

      3. if program not provided and OTP defined on patient:

        1. check config parameter DEVICE_REQUESTS_SMS_ENABLED is set to true

          1. generate text according to CREATE_DEVICE_REQUEST_SMS_TEMPLATE_WITHOUT_CODE and send SMS without verification_code

  4. Save data to device_requests collection in MongoDB according to RС_[UPD] Device request data model_EN

  5. If device request is based on activity - recalculate and set remaining_quantity for the activity

    1. select all device requests based on current activity and calculate previously reserved quantity as sum of DR.quantity.value.

    2. calculate reserved at the moment quantity as sum of previously reserved quantity and quantity from current DR

    3. calculate remaining quantity by subtracting reserved at the moment quantity from activity's quantity

    4. Update activity set remaining quantity (activity.detail.remaining_quantity)

  6. Send StatusChangeEvent to Event Manager