A simple 3-tier rule engine application(Simple UI, API and Backend, Data) to determine user eligibility based on attributes like age, department, income, spend etc. The system uses Abstract Syntax Tree (AST) to represent conditional rules and allow for dynamic creation,combination, and modification of these rules.
- create_rule(rule_string): This function takes a string representing a rule and returns a Node object representing the corresponding AST.
- combine_rules(rules): This function takes a list of rule strings and combines them into a single AST.
- evaluate_rule(JSON data): This function takes a JSON representing the combined rule's AST and a dictionary data containing attributes (e.g., data = {"age": 35, "department": "Sales", "salary": 60000, "experience": 3}).
- Python3
- HTML-CSS
- Flask
- Flask-SQLAlchemy
- MySQL (SQLAlchemy + PyMySQL client + Cryptography)
- Docker (v27.3.1)
- DockerCompose (v2.29.7)
- Linux (Ubuntu 24.04)
git clone https://github.com/BelieveInTheLimitless/Rule-Engine-with-AST
cd Rule-Engine-with-AST
# Making sure MySQL is not interacting already
sudo systemctl stop mysql
docker compose up --build
# This step may take a while to complete the database setup, have some snacks handy with you :)
#open
http://127.0.0.1:5000/
# CTRL + C to stop the running container
docker compose down