Calculate notifications for a model¶
This operation is the public entry point of the notification rule engine. It iterates every NotificationRule in a caller-supplied NotificationMatrix, evaluates each against a caller-supplied model, and returns the non-null results keyed by rule position.
| Field | Value |
|---|---|
| Operation ID | OP-CIA-01 |
| Trigger | A caller request (public static method). |
| Inputs | model of any type T; matrix (NotificationMatrix), specifically its Rules array. |
| Outputs | A NotificationResult[] with at most one entry per distinct rule Key (rule Position). |
| Primary components | NotificationRuleEngine.CalculateNotifications<T> |
| Entry point | Services/SAIF.Services.ClaimInfoApi.Core/NotificationRuleEngine.cs (lines 11–32) |
Steps¶
- Create an empty dictionary of outputs keyed by string.
- Iterate
matrix.Rulesin array order. - If
matrix.Rulesis null, aNullReferenceExceptionis thrown; there is no null guard. - For each rule, evaluate it against the model via Evaluate one rule (CIA-BR-002 through CIA-BR-006).
- If the evaluated value is non-null, compute
key = rule.Key(thePositionas a string) and add or overwrite theNotificationResult(rule, value)for that key (CIA-BR-001, CIA-BR-007). - Last non-null result wins for a duplicate position.
- If the value is null, skip the rule; it produces no output (CIA-BR-007).
- Return
outputs.Values.ToArray(). - Array order follows
Dictionaryenumeration order, which is not formally guaranteed*.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Trigger]) --> S1["Iterate matrix.Rules"]
S1 --> S2["Evaluate rule<br>(OP-CIA-02)"]
S2 --> D{"Value non-null?"}
D -->|Yes| S3["Add/overwrite result<br>keyed by Position"]
D -->|No| Skip["Skip rule"]
S3 --> S1
Skip --> S1
S1 -->|all rules done| EndOk([Return NotificationResult array])
Failure and edge-case behavior¶
matrix.Rules == null: throwsNullReferenceException; there is no guard against this.- Duplicate rule positions: the last non-null value evaluated wins, silently discarding earlier values for the same position.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Related documentation¶
Sources¶
Services/SAIF.Services.ClaimInfoApi.Core/NotificationRuleEngine.cs