Skip to content

This project implements a decision tree to evaluate conditions and execute actions based on those conditions. It supports various actions such as sending SMS and email, with the ability to loop through actions.

Notifications You must be signed in to change notification settings

gegii/decision-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decision Tree Implementation

This project implements a decision tree to evaluate conditions and execute actions based on those conditions. It supports various actions such as sending SMS and email, with the ability to loop through actions.

Table of Contents

Features

  • Condition Evaluation: Evaluate conditions dynamically using string representations of functions.
  • Action Handling: Execute different actions based on the outcome of conditions (e.g., sending SMS or email).
  • Looping: Execute actions multiple times using a loop node.
  • Serialization: Serialize and deserialize decision trees to and from JSON format.

Installation

npm install

Usage

In the src/main.ts file, you can specify the current date by modifying the decisionTreeJson based on the commented condition. The decision tree operates based on the condition property set to either true or false. If you change the condition to match today’s date and set it to true, the application will send an SMS. Conversely, if you specify any other date and set the condition to false, it will send emails. This behavior is determined by the entire structure of the decisionTreeJson.

and run:

npx ts-node src/main.ts

Testing

To run the tests for this project, you can use the following command:

npx jest

About

This project implements a decision tree to evaluate conditions and execute actions based on those conditions. It supports various actions such as sending SMS and email, with the ability to loop through actions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published