ЕСОЗ - публічна документація

Get Person Emergency contact

Purpose

This WS allows to get person’s emergency contact using a medical event as the evidence for the request.

Specification

Apiary

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 'Invalid access token'

  2. Verify that token is not expired

    1. in case of error return 401 'Invalid access token'

  3. Check user scopes in order to perform this action (scope = 'person_emergency_contact:read')

    1. in case of error return 403 'Your scope does not allow to access this resource. Missing allowances: persons_emergency_contact:read'

Validate Patient

  • Get Patient identifier from the URL

    • Check it exists in DB

      • in case of error return 404 'Patient is not found'

Validate Medical event

  1. Validate medical_event_type from the URL

    1. Check it is one of 'conditions' or 'diagnostic_reports'

      1. in case of error return 404 'no Route matched with those values'

  2. Validate medical event identifier from the URL

    1. Check it exists in DB

      1. in case of error return 404 '<medical_event_type> is not found'

    2. Check medical event belongs to patient

      1. in case of error return 404 '<medical_event_type> is not found'

  3. Validate medical event has valid status:

    1. if ME is condition, check $.conditions.verification_status != 'entered_in_error'

    2. if ME is diagnostic_report, check $.diagnostic_reports.status != 'entered_in_error'
      In case of error return 403 'Invalid medical event status'

  4. Validate medical event creation period:

    1. validate that $.<medical_event_type>.inserted_at <= (now - EMERGENCY_CONTACT_MEDICAL_EVENT_MAX_DAYS_PASSED)
      In case of error return 403 'Medical event was created later than allowed period for data receiving'

More information about EMERGENCY_CONTACT_MEDICAL_EVENT_MAX_DAYS_PASSED configuration you can find here Medical Events Dictionaries and configurations

Service logic

Service returns emergency contact info for a specified person:

  • Get person’s data from mpi.persons.emergency_contact table

  • Render a response according to specification

  • Every request is logged to medical_data.person_data_request_log

    • Record must be created regardless of the result value

    • Set $.request_type='Person Emergency Contact'

Collection description

Collection name: person_data_request_log

This collection is used to store logs of person’s data requests.

Record schema

Name

Type

M/O

Description and constraints

Name

Type

M/O

Description and constraints

_id

uuid

M

System identifier of request

consumer

object

M

Information about who has been consumed patient’s personal data

patient_id

string

M

Patient hashed identifier

access_context

object

O

Information on the basis of which entity access was granted

result

boolean

M

Result of obtaining data on request

request_type

string

M

Type of received data

inserted_at

timestamp

M

Datetime when request was created

Consumer schema

Information about who has been consumed patient’s emergency contact

Name

Type

M/O

Description and constraints

Name

Type

M/O

Description and constraints

client_id

uuid

M

Client identifier to which the user belongs

mis_client_id

uuid

M

MIS client identifier

user_id

uuid

M

User who monitor patient's data

Access_context schema

Information on the basis of which entity access was granted

Name

Type

M/O

Description and constraints

Name

Type

M/O

Description and constraints

id

uuid

M

Resource identifier

type

string

M

Resource type

Example

{ "_id" : UUID("6ad3a23c-45a5-4062-865d-6b1bffb6ed37"), "consumer": { "client_id" : UUID("73f81820-1d5a-43d8-98e1-b73b99d71d10"), "mis_client_id" : UUID("d2cb70ce-a3e6-4c5d-951e-418d9ee3db9e"), "user_id" : UUID("8a1658f2-1491-4825-886e-b92638689501") }, "patient_id" : "CE4D70F0A930C052324E72102FE5F3910F16B78BF34307B56B2323C107442547", "access_context" : { "id" : UUID("3f2d7006-0167-4817-8b48-224aec3c3872"), "type" : "condition" }, "result" : true, "request_type" : "Person Emergency Contact", "inserted_at" : ISODate("2018-12-07T11:49:07.504Z") }

ЕСОЗ - публічна документація