Cruxflowdesign » History » Revision 2
« Previous |
Revision 2/21
(diff)
| Next »
Shuvam Misra, 21/09/2023 03:40 PM
Algorithms and data structures for the flow engine¶
- Table of contents
- Algorithms and data structures for the flow engine
We will refer heavily to the algorithms and data structures of the BRE here.
Here too, we need a rules schema, rulesets and a matching engine.
Rules schema¶
In the BRE, each rules schema has two parts: the pattern schema and the action schema. Each rulesschema
block is tagged with a class
attribute, specifying which class the schema applies to. There is one rules schema for each class of entities.
In the flow engine, there is no class
-- there is a process
instead. A workflow schema applies to a process.
The pattern schema specification is identical here to that used in the BRE.
In the flow engine, there is no actionschema
, but a flowschema
. The flow schema is much simpler than an action schema. The output of a flow engine matching exercise is just the ID of one step. Therefore the flow schema here is a list of possible steps.
"ruleschema": {
"process": "customerkyc",
"patternschema": {
"attr": [{
"name": "cat",
"type": "enum",
"vals": [ "textbook", "notebook", "stationery", "refbooks" ]
},{
"name": "mrp",
"type": "float"
},{
"name": "fullname",
"type": "str",
},{
"name": "ageinstock",
"type": "int"
},{
"name": "inventoryqty",
"type": "int"
}]
}
"flowschema": {
"steps": [ "initialdoc", "aadhaarcheck", "pancheck", "bankdetails", "referenchk", "complete" ]
}
}
In the example above:
class
is replaced withprocess
patternschema
remains unchangedactionschema
is replaced withflowschema
and the structure offlowschema is simplified to just one array of words. Each word here is an ID of a step. So, the
flowschema.steps` lists all the valid steps which the flow engine may return after matching an entity with the rules.
Updated by Shuvam Misra over 1 year ago · 2 revisions