{"id":18416917,"url":"https://github.com/rpdevjesco/decisionrules","last_synced_at":"2025-04-13T03:18:21.161Z","repository":{"id":231244555,"uuid":"781255785","full_name":"RPDevJesco/DecisionRules","owner":"RPDevJesco","description":"DecisionRules is a lightweight framework for defining and evaluating decision trees and rule sets. ","archived":false,"fork":false,"pushed_at":"2024-04-03T05:02:30.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T03:18:18.074Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RPDevJesco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-03T03:18:18.000Z","updated_at":"2024-04-03T03:19:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"0ce34e30-d9e6-4430-baa4-d5437cc9c2d2","html_url":"https://github.com/RPDevJesco/DecisionRules","commit_stats":null,"previous_names":["rpdevjesco/decisionrules"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RPDevJesco%2FDecisionRules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RPDevJesco%2FDecisionRules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RPDevJesco%2FDecisionRules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RPDevJesco%2FDecisionRules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RPDevJesco","download_url":"https://codeload.github.com/RPDevJesco/DecisionRules/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657909,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T04:07:41.943Z","updated_at":"2025-04-13T03:18:21.140Z","avatar_url":"https://github.com/RPDevJesco.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DecisionRules\n\n# Overview\n\nDecisionRules is a lightweight framework for defining and evaluating decision trees and rule sets. It provides a simple yet powerful way to encapsulate business logic and decision-making processes in a structured and maintainable manner. This framework can be used in various applications, including business process automation, data validation, and dynamic content generation.\n\n# Features\n\nRule Engine: Allows defining and evaluating rules based on context data. Each rule consists of a condition and an action, where the action is executed if the condition evaluates to true.\nDecision Tree: Supports creating and traversing decision trees, where each node represents a decision or action based on the evaluation of a condition.\nContext Management: Provides a mechanism to store and manage context data, which is used for evaluating rules and decision trees.\n\n# Use Cases\n\nBusiness Process Automation: Automate decision-making in business workflows, such as approval processes, pricing strategies, and eligibility checks.\nData Validation: Define rules for validating input data in forms, APIs, or data processing pipelines.\nDynamic Content Generation: Use decision trees to dynamically generate content or recommendations based on user input or behavior.\n\n# Getting Started\n\nTo get started with DecisionRules, you can create a new instance of the RuleSet and Tree classes and define your rules and decision nodes. Then, create a Context object to hold your data and evaluate your rules and decision trees against this context.\n\n```cs\nvar ruleSet = new RuleSet();\nruleSet.AddRule(new Rule(\n    ctx =\u003e ctx.GetData\u003cint\u003e(\"Age\") \u003e= 18,\n    ctx =\u003e Console.WriteLine(\"User is an adult.\")));\n\nvar context = new Context();\ncontext.SetData(\"Age\", 25);\n\nvar ruleEvaluator = new RuleEvaluator(ruleSet);\nruleEvaluator.Evaluate(context);\n```\n\n# Complex Conditons \u0026 Rule Priority\n\n```cs\n// Example of combining conditions\nFunc\u003cContext, bool\u003e conditionA = ctx =\u003e ctx.SomeValue \u003e 10;\nFunc\u003cContext, bool\u003e conditionB = ctx =\u003e ctx.AnotherValue == \"Yes\";\nFunc\u003cContext, bool\u003e complexCondition = ctx =\u003e conditionA(ctx) \u0026\u0026 conditionB(ctx);\n\n// Creating a rule with a complex condition\nvar complexRule = new Rule(complexCondition, someAction, priority: 1);\n```\n\n# Missing Features\n\nRule Persistence: Currently, there is no built-in mechanism to persist rules to a database or file system.\n\n# Contributing\n\nContributions to the DecisionRules project are welcome. If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpdevjesco%2Fdecisionrules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frpdevjesco%2Fdecisionrules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpdevjesco%2Fdecisionrules/lists"}