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

RC_(CSI-1323)_Check confidant person relationship

Purpose

This algorithm is used to validate relationship between Confidant Person and Patient based on confidant_person_relationships (MPI DB table).

Key points

  1. This algorithm uses dataset data to check if relationship between two patients from mpi database is exists confidant_person_relationships table or not and what kind of verification status it has.

  2. This algorithm can be used in different processes and is not limited to specific process.

  3. At least one of ids must be set as input parameter

Specification

{ "confidant_person_id": "70a9e15b-b71b-4caf-8f2e-ff247e8a5677", "person_id": "70a9e15b-b71b-4caf-8f2e-ff247e8a5678" }

Service logic

  1. Get relationship between two persons from confidant_person_relationships table where:

    • person_id is equal to $.person_id

    • AND confidant_person_id is equal to $.confidant_person_id (if confidant_person_id exists in the dataset)

    • AND is_active=true

    • AND active_to > now() or active_to is null

  2. Return result:

    • If record is found and has
      verification_status = “VERIFIED”
      OR
      verification_status = “VERIFICATION_NEEDED” AND verification_reason = “MANUAL_CREATED_BY_DOCTOR”
      return {:ok, {:approved, "Relationship is approved"}}

    • Else if record is found but has another status
      return {:ok, {:not_approved, "Relationship is not approved yet"}}

    • Else if record is not found
      return {:error, {:not_found, "Relationship is not found"}}

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