python-rule-engine
python-rule-engine copied to clipboard
Have you considered using jsonata?
You might be able to escape some of the weight of carrying around everything in JSON by transitioning to jsonata.
In your example, you use
rule = {
"name": "basic_rule",
"conditions": {
"all": [
{
# JSONPath support
"path": "$.person.name",
"operator": "equal",
"value": "Lionel"
},
{
"path": "$.person.last_name",
"operator": "equal",
"value": "Messi"
}
]
}
}
if you were to use the jsonata-python project as part of your engine, you could reduce these to
rule = {
"name": "basic_rule",
"conditions": {
"all": [
"$.person.name == \"Lionel\",
"$.person.last_name == \"Messi\""
]
}
or even
rule = {
"name": ...
"conditions": "$.person.name == \"Lionel\" and $.person.last_name == \"Messi\""
}
Feel free to close this issue, as it's completely unsolicited input.
Hi! Sorry for the late reply. That library looks incredible I did not know something like that existed. Im definitely gonna look into it.