---
# System prepended metadata

title: Acceptance criteria for Rules engine
tags: [Rules engine, Evrone, Jiseki Health]

---

# Acceptance criteria for Rules engine

###### tags: `Evrone`, `Rules engine`, `Jiseki Health`
## Intro
This document describes the whole process of Rule engine proceeding. All flow is divided into core two parts: **Rule creation** and **Rule execution**. We are going to use the following links (the links can be changed in the future):
* Rules engine UI: http://rmapp.jisekihealth.com
* Django admin dashboard: http://rmapi.jisekihealth.com:8000/admin/
* Airflow admin dashboard: rmapi.jisekihealth.com:8001/admin/airflow/
For all services, you can use test login/password: **evrone/evrone
## Rule creation (Rule engine UI)
1. You should give **title** and **expiration delay** - the period after that rule can be triggered again for the particular user after the previous triggering:
![](https://i.imgur.com/CreQ8TE.png)
2. **Actions creation**:
    * You should add **Actions** which can be executed due to **Rule** triggering. At the moment you have a choice from 3 different **Actions**:
        * *Send a message to User* - you should specify text message
        * *Notify agent when the rule is triggered*
        * *Add a customer to priority list whet rule is triggered*
    * For Actions you should choose **Send Type**. **Send type** define time of **Actions** execution. Now you have a choice from 3 different **Send Types**:
        * *When triggere*d - **Actions** executed ASAP after Rule triggering. You should specify the time period
        * *After triggered* - **Actions** executed with some delay after Rule triggering. You should specify the time period and delay.
        * *Specific time* - **Actions** executed at the specified time regardless of triggering time. You should specify the time period and a specific time.
3. **Conditions creation** - each condition is a simple **Condition** with one **Operator**. **Expression** builts from **Conditions** with OR/AND **Operators**. Each **Condition** contains:
    * Chain of fields (At this moment fields are manually added in DB (you can do it in **Django admin dashboard**), in the future we are going to add automapping using GraphQL introspection).
    * One of the operators:
        * In array
        * Equal
        * Greater than
        * Greater than or equal
        * Less than
        * Less than or equal 
    * Value
![](https://i.imgur.com/UWnoXa5.png)
4. Now you create the **Rule** and make it **Public**. Only **Public Rules** will be evaluted.
## Rule execution
1. You can observer DAG execution in Airflow admin dashboard:
![](https://i.imgur.com/ZhF5P2W.png)
    * First DAG is responsible for **Rule** evaluation
    * Seconds DAG is responsible for **Actions** execution
2. At this moment you can observe logs about **Actions** execution in the terminal. In the future, there is a special dashboard.
