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

Event Manager Deprecated_CSI January-April

Event Manager is used to collect different events (like ATTRIBUTE_CHANGED, OBJECT_ADDED etc) from different sources and store them in one place.


Overview

  • The monitoring of changed statuses will be implemented to the code
  • Event manager reflects statuses of different objects
  • In case status was changed the information is sent to EventDB to be stored
  • This method does not guarantee the fact of storing data in EventDB
  • At the moment only statuses are monitored. Other events can be added in future, but they are not in a scope today.
  • This manager is used by MIS.
  • Context is not used to obtain data from DB.
  • Only changed statuses should be stored to EventDB, not new.\
  • events are transferred to event manager via Kafka


StatusChangeEvent

Statuses to collect

  • employee request status changed

  • employee status changed

  • declaration status changed

  • medication request status changed

  • medication dispense status changed

  • contract_request status change

  • contract status change

  • person status change

  • preperson status change

  • care plan status change

  • activity status change

  • approval status change


Save data to Event DB

NStepDescriptionOwner
1Status was changedStatus was changed on the one of events that are monitoressystem
2Collect DataAfter changing status System collect all necessary data in the required format system
3Save Data to EDB

Collected data are saved to EventDB.

Save Data directly to EventDB

system

Employee status changed

Save also employee_id value to EventDB

Employee object example
    {
      "id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
      "event_type": "StatusChangeEvent",
      "entity_type": "EmployeeRequest",
      "entity_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
      "properties": {
        "status": {
          "new_value": "APPROVED"
        },
        "employee_id": {
          "new_value": "e1453f4c-1077-4e85-8c98-c13ffca0063e"
        }
      },
      "event_time": "2017-04-20T19:14:13Z",
      "changed_by": "df9f70ee-4b12-4740-b0f5-bb5aea116863"
    }



Data format
idPK
event_type

string, the name of event (ex. StatusChangeEvent)

entity_typestring, the name on entity that was changed (ex. Medication_request)
entity_iduuid, id of changed object
propertiesjson, consists of datas that describe changed element (status: new_value)
event_timedatetime, date and time of event
changed_byuuid, id of a person

Obtain data from EventDB

Get list

GET https://dev.ehealth.world/api/events

Input parameters (optional)
  • date
  • event_type
  • entity_type
  • attribute_name
  • attribute_name & new_value
  • page
  • page_size
Logic WS
  1. Verify the validity of access token
  2. Check user scopes in order to perform this action (scope = 'event:read')
    1. return 403 in case invalid scope(s)
Validate EventType

Each event type can be filtered by scopes. At the moment we have only one event - StatusChangeEvent

  1. Check user scopes in order to perform this action (scope = 'event:read')
    1. return 403 in case invalid scope(s)

Get by ID

GET https://dev.ehealth.world/api/events/ID

Input parameters
  • id
Logic WS
  1. Verify the validity of access token
  2. Check user scopes in order to perform this action (scope = 'event:read')
    1. return 403 in case invalid scope(s)

Event termination

NStepDescriptionOwner
1
Once in 24H timer startssystem
2Check amount of data in DB

The number of data in DB should be checked.

amount of data in DB > event_max_number

system
3Delete data in DBall data > event_max_number should be deletedsystem


NStepDescriptionOwner
1
Once in 24H timer startssystem
2Check amount of data in DB

the Insert_at date in DB sould be checked

insert_at > event_max_time

system
3Delete data in DBAll data with (inserted_at>event_max_time) should be deletedsystem

Event termination starts with cron sqedule filtered by

  • time (event_max_time)
  • amount of data (event_max_number)

All filteres are parametrized. By default event_max_time=month, event_max_number=50.000

Cron starts once in 24H and delete data if events.id > "amount of data" OR events.event_time > "time"


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