Versions Compared

Key

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

Table of Contents

Requirements

...

  1. Release Service Request

Validation

Authorization

  • Verify the validity of access token
    • Return (401, 'unauthorized') in case of validation fails
  • Verify that token is not expired
    • in case of error - return (401, 'unauthorized')
  • Check user scopes in order to perform this action (scope = 'service_request:use')
    1. Return (403, 'invalid scopes') in case of invalid scope(s)

Validate transition

Only active and used service request can be released

  1. Get service request by ID
  2. Service request must be active
    1. $.status == "active"
      1. in case of error return 409 "Invalid service request status"

Check for related episodes and encounters

Service request can be released only if there is no related episodes and encounters

  1. Search for episode of care related to this service request.
    1. Medical Events DB: patient[<patient_id>].episodes[*].incoming_referrals = Request: service_request_id
    2. Status in (active, closed) 
      1. If there is at least one 

Notes

Валидация: обязательно проверка, что на реферрал не ссылается какой-нибудь эпизод с энкаунтером  - это означает, что пациент уже приходил на прием к другому врачу. Исключением может быть энтеред ин эррор или клоузд но с каким-то ризоном особенным