Project

General

Profile

Cruxflowdesign » History » Version 1

Shuvam Misra, 21/09/2023 01:10 PM

1 1 Shuvam Misra
# Algorithms and data structures for the flow engine
2
3
{{>toc}}
4
5
We will refer heavily to the algorithms and data structures of the BRE here.
6
7
Here too, we need a rules schema, rulesets and a matching engine.
8
9
## Rules schema
10
11
In the BRE, each rules schema has two parts: the pattern schema and the action schema. Each rules schema block is tagged with a `class` attribute, specifying which class the schema applies to. There is one rules schema for each class of entities.
12
13
In the flow engine, there is no `class` -- there is a `process` instead. A workflow schema applies to a process.
14
15
The pattern schema specification is identical here to that used in the BRE. 
16
17
The flow schema is much simpler. The output of a flow engine matching exercise is just one step ID. Therefore the flow schema here is a list of possible steps.
18
19
``` json
20
"ruleschema": {
21
    "process": "customerkyc",
22
    "patternschema": {
23
        "attr": [{
24
            "name": "cat",
25
            "type": "enum",
26
            "vals": [ "textbook", "notebook", "stationery", "refbooks" ]
27
        },{
28
            "name": "mrp",
29
            "type": "float"
30
        },{
31
            "name": "fullname",
32
            "type": "str",
33
        },{
34
            "name": "ageinstock",
35
            "type": "int"
36
        },{
37
            "name": "inventoryqty",
38
            "type": "int"
39
        }]
40
    }
41
    "flowschema": {
42
        "steps": [ "initialdoc", "aadhaarcheck", "pancheck", "bankdetails", "referenchk", "complete" ]
43
    }
44
}
45
```