Versions Compared

Key

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

Overview

This web service is designed to dismiss episode in case it was entered in error

Specification

Apiary

Validation

Validate token

  • Verify the validity of access token
    • Return 401 in case validation fails
  • Verify token is not expired
    • in case of error return 401 

Validate scopes

  • Check user scopes in order to perform this action (scope = 'episode:write')
    1. Return 403 in case invalid scope(s)

Validate declaration

In order to perform this action, primary doctor must have active declaration with the patient

  • Validate declaration using Method
    • in case of error 403

Validate request

  1. Validate patients(<patient_id>).episodes(<episode_id>).status=="activeepisode is not already canceled
    1. ME.patients{patient_id}.episodes{episode_id}.status!="entered_in_error"
      1. in case of error "Episode in <status> can not be
      dismissed
      1. canceled"  
    Validate  patients(<patient_id>).episodes(<episode_id>).encounters(*).status ==
  2. Validate that all encounters created on episode are already canceled
    1.   ME.patients{patient_id}.episodes{episode_id}.encounters{*}.status != `entered_in_error`
      1. in case of error - "Episode can not be
      dismissed
      1. canceled while it has not
      dismissed
      1. canceled encounters"


Request processing

  1. Set the status of the episode in "entered_in_error"
  2. Create a record in ME.episode.status_history