Evaluate one rule¶
This operation evaluates a single NotificationRule against the model, dispatching to an int, bool, or string evaluation path based on the rule's TypeName metadata, including the conditional recursion that lets a bool rule resolve to a derived property value.
| Field | Value |
|---|---|
| Operation ID | OP-CIA-02 |
| Trigger | Step 3 of Calculate notifications for a model, or a recursive call for an out-property child rule. |
| Inputs | rule (NotificationRule); model (T). |
| Outputs | A string value, or null. |
| Primary components | NotificationRuleEngine.CalculateNotification<T> (private) |
| Entry point | Services/SAIF.Services.ClaimInfoApi.Core/NotificationRuleEngine.cs (lines 34–71) |
Steps¶
- Resolve
rule.Type, which isType.GetType(rule.TypeName)(CIA-BR-002). - If unresolvable,
rule.Typeis null and the rule falls through to the string branch (step 4). - When
rule.Typeisint: compile the rule asFunc<T,int>via Compile a rule into a delegate, invoke it on the model, and return.ToString()of the result (CIA-BR-003). - When
rule.Typeisbool: compile the rule asFunc<T,bool>and invoke it. - If the result is true and
OutPropertyis set: build a child rule withNotificationRule.PropertyRule(rule.Position, rule.OutPropertyTypeName, rule.Name, rule.OutProperty), copy the parentIdinto the child's_id, and recursively evaluate it via this same operation. The child's value is returned (CIA-BR-005). - Else, if the result is true and
OutValueis set: returnOutValue(CIA-BR-006). - If the result is true but neither
OutPropertynorOutValueis set: return null. - If the result is false: return null (CIA-BR-004).
- Otherwise (any other resolved type, or an unresolvable
TypeName): compile the rule asFunc<T,string>, invoke it, and return its value (CIA-BR-003).
Process flow¶
The following diagram visualizes this operation's type-dispatch control flow.
flowchart TD
Start([Trigger]) --> Resolve["Resolve rule.Type<br>from TypeName"]
Resolve --> D{"Resolved type?"}
D -->|int| IntPath["Compile Func<T,int><br>return .ToString()"]
D -->|bool| BoolPath["Compile Func<T,bool><br>invoke delegate"]
D -->|other / unresolvable| StrPath["Compile Func<T,string><br>return value"]
BoolPath --> BD{"Result true?"}
BD -->|Yes, OutProperty set| Child["Recurse into child<br>PropertyRule (this operation)"]
BD -->|Yes, OutValue only| OutVal(["Return OutValue"])
BD -->|Yes, neither set| NullOut(["Return null"])
BD -->|No| NullOut
IntPath --> Done([Return string or null])
StrPath --> Done
Child --> Done
OutVal --> Done
Failure and edge-case behavior¶
- An unresolvable
TypeNameis not an error; the rule silently falls through to the string branch (step 4). - A
boolrule that is true with neitherOutPropertynorOutValueset produces null, with no diagnostic. - Compilation and invocation failures propagate from Compile a rule into a delegate with no local
try/catch.
Related documentation¶
Sources¶
Services/SAIF.Services.ClaimInfoApi.Core/NotificationRuleEngine.csServices/SAIF.Services.ClaimInfoApi.Core/NotificationRule.cs