|
1 | | -# Custom Checks |
| 1 | +# Custom Eligibility Checks |
| 2 | + |
| 3 | +## 1. What Are Custom Eligibility Checks? |
| 4 | + |
| 5 | +The BDT platform provides a library of **public eligibility checks** — prebuilt rule components that cover common eligibility criteria such as age thresholds, residency requirements, and income limits. For most screeners, combining these public checks is sufficient to express the required eligibility logic. |
| 6 | + |
| 7 | +However, if the public checks do not cover a requirement specific to your use case, BDT allows you to build your own reusable **custom eligibility checks**. |
| 8 | + |
| 9 | +A custom eligibility check works exactly like a public check within your screener: |
| 10 | + |
| 11 | +- It accepts one or more inputs from the screener form |
| 12 | +- It evaluates a defined condition |
| 13 | +- It returns an eligibility result (`True` or `False`) |
| 14 | + |
| 15 | +The key difference is that you define the logic yourself using **DMN (Decision Model and Notation)**, a low-code standard for expressing decision rules. |
| 16 | + |
| 17 | +Once created and published, your custom checks appear alongside public checks in the **Configure Benefit** page and can be reused across multiple screeners. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 2. DMN and FEEL |
| 22 | + |
| 23 | +Custom check logic is defined using **DMN** with expressions written in **FEEL**. Neither requires traditional programming experience, but understanding their core concepts will help you build effective checks. |
| 24 | + |
| 25 | +### 2.1 What Is DMN? |
| 26 | + |
| 27 | +**Decision Model and Notation (DMN)** is an open standard for modeling and executing decision logic. It provides a visual, structured way to express rules that a system can evaluate automatically. |
| 28 | + |
| 29 | +In BDT, each custom check is backed by a DMN model that contains one or more **decision tables** organized into a decision tree. |
| 30 | + |
| 31 | +DMN models have two main building blocks: |
| 32 | + |
| 33 | +- **Input Data nodes** — represent values coming in from the form or from configured parameters |
| 34 | +- **Decision nodes** — represent rules that evaluate those inputs and produce an output |
| 35 | + |
| 36 | +### 2.2 What Is FEEL? |
| 37 | + |
| 38 | +**FEEL (Friendly Enough Expression Language)** is the expression language used inside DMN to write rule conditions and computed values. |
| 39 | + |
| 40 | +FEEL is designed to be readable and approachable. A few examples: |
| 41 | + |
| 42 | +| FEEL Expression | Meaning | |
| 43 | +| --------------------------------- | ------------------------ | |
| 44 | +| `age >= 65` | Age is 65 or older | |
| 45 | +| `state = "California"` | State equals California | |
| 46 | +| `income < 2000` | Income is less than 2000 | |
| 47 | +| `date("2024-01-01")` | A specific date literal | |
| 48 | +| `age >= minAge and age <= maxAge` | Age falls within a range | |
| 49 | + |
| 50 | +FEEL supports arithmetic, comparisons, logical operators (`and`, `or`, `not`), date functions, string functions, and more. |
| 51 | + |
| 52 | +### 2.3 Decision Tables |
| 53 | + |
| 54 | +The most common way to express eligibility logic in DMN is a **decision table** — a structured grid where each row is a rule. |
| 55 | + |
| 56 | +Each rule specifies: |
| 57 | + |
| 58 | +- **Input conditions** — the values or ranges that must be true for this rule to apply |
| 59 | +- **Output** — the result returned when the rule matches |
| 60 | + |
| 61 | +BDT eligibility checks always return `true` (eligible), `false` (not eligible), or a value indicating insufficient information. |
| 62 | + |
| 63 | +**Example — Minimum Age Check**: |
| 64 | + |
| 65 | +| Age (Input) | Eligible (Output) | |
| 66 | +| ----------- | ----------------- | |
| 67 | +| `>= 65` | `true` | |
| 68 | +| `< 65` | `false` | |
| 69 | + |
| 70 | +**Example — Income and Household Size Check**: |
| 71 | + |
| 72 | +| Household Size (Input) | Annual Income (Input) | Eligible (Output) | |
| 73 | +| ---------------------- | --------------------- | ----------------- | |
| 74 | +| `1` | `<= 20000` | `true` | |
| 75 | +| `2` | `<= 27000` | `true` | |
| 76 | +| `any` | `> 50000` | `false` | |
| 77 | + |
| 78 | +**Identifying the result node**: |
| 79 | + |
| 80 | +When you create a custom check in BDT, you give it a name (for example, "Household Income Limit"). Your DMN model must contain a decision node with that exact same name. BDT uses this naming convention to identify which decision node represents the final eligibility result for the check. All other decision nodes in the model are treated as intermediate steps that feed into it. |
| 81 | + |
| 82 | +### 2.4 Further Reading |
| 83 | + |
| 84 | +For a deeper understanding of DMN and FEEL, refer to the official documentation: |
| 85 | + |
| 86 | +- [DMN Documentation (Drools)](https://docs.drools.org/latest/drools-docs/drools/DMN/index.html) |
| 87 | +- [FEEL Language Handbook](https://kiegroup.github.io/dmn-feel-handbook/#dmn-feel-handbook) |
| 88 | +- [Learn DMN in 15 Minutes](https://learn-dmn-in-15-minutes.com/) |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 3. Managing Custom Checks |
| 93 | + |
| 94 | +The **Eligibility Checks** view lists all of the custom checks you have created. You can access it from the BDT home screen by selecting the **Eligibility Checks** tab. |
| 95 | + |
| 96 | +From this view, you can: |
| 97 | + |
| 98 | +- View all of your custom checks |
| 99 | +- Create a new custom check |
| 100 | +- Open an existing check to edit or publish it |
| 101 | + |
| 102 | +> TODO: Add image of Eligibility Checks list view |
| 103 | +
|
| 104 | +### Creating a New Check |
| 105 | + |
| 106 | +To create a new custom check, select **Create New Check**. You will be prompted to provide: |
| 107 | + |
| 108 | +- **Name** — a descriptive name for the check (e.g., "Household Income Limit") |
| 109 | +- **Module** — the category or group that this check belongs to (e.g., `housing`) |
| 110 | +- **Description** — a brief explanation of what the check evaluates |
| 111 | + |
| 112 | +Once created, the check opens in the **Custom Check Editor**, where you define its logic, configure its parameters, test it, and publish it. |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## 4. The Custom Check Editor |
| 117 | + |
| 118 | +When you open a custom check, you are taken to the **Custom Check Editor**. This editor has four tabs that guide you through the process of building and publishing a check: |
| 119 | + |
| 120 | +- **Parameters** — define configurable inputs for your check |
| 121 | +- **DMN Definition** — build the decision logic using the visual DMN editor |
| 122 | +- **Testing** — run the check against sample inputs to verify it behaves correctly |
| 123 | +- **Publish** — publish a version of the check to make it available in your screeners |
| 124 | + |
| 125 | +> TODO: Add image of Custom Check Editor navigation tabs |
| 126 | +
|
| 127 | +--- |
| 128 | + |
| 129 | +### 4.1 Parameters |
| 130 | + |
| 131 | +The **Parameters** tab is where you define inputs that can be configured when adding your check to a benefit, rather than being supplied directly by the form. |
| 132 | + |
| 133 | +**What is a parameter?** |
| 134 | + |
| 135 | +Most eligibility checks involve a threshold or reference value — for example, a minimum age or an income limit. Rather than hardcoding that value in your DMN logic, you can expose it as a **parameter**. When you add the check to a benefit, you supply the specific value for that parameter. This makes the check reusable across multiple benefits with different thresholds. |
| 136 | + |
| 137 | +**Example**: A custom income check might expose a `maximumIncome` parameter. When configuring the check on a benefit for Program A, you set `maximumIncome` to 20000. For Program B, you set it to 35000. The same check logic serves both without modification. |
| 138 | + |
| 139 | +**Adding a parameter**: |
| 140 | + |
| 141 | +Select **Create New Parameter** and fill in the following fields: |
| 142 | + |
| 143 | +- **Key** — the internal identifier used in your DMN model to reference this parameter (e.g., `maximumIncome`) |
| 144 | +- **Label** — the human-readable name displayed when configuring the check on a benefit |
| 145 | +- **Type** — the data type: `string`, `number`, `boolean`, or `date` |
| 146 | +- **Required** — whether the parameter must be provided when the check is added to a benefit |
| 147 | + |
| 148 | +> TODO: Add image of Parameters tab and Parameter modal |
| 149 | +
|
| 150 | +--- |
| 151 | + |
| 152 | +### 4.2 DMN Definition |
| 153 | + |
| 154 | +The **DMN Definition** tab contains the visual DMN editor where you define the decision logic for your check. |
| 155 | + |
| 156 | +The editor provides a graphical canvas for building your DMN model. You can create and connect decision nodes, define input data sources, build decision tables, and organize decisions into a Decision Service. |
| 157 | + |
| 158 | +**Saving your work**: |
| 159 | + |
| 160 | +Select **Save Changes** to persist your DMN model. The save button turns yellow when there are unsaved changes, so you can tell at a glance whether your current edits have been saved. |
| 161 | + |
| 162 | +**Validating your DMN**: |
| 163 | + |
| 164 | +Select **Validate Current DMN** to check your model for structural or syntax errors. If validation issues are found, a summary of the errors is displayed. Resolve all validation errors before testing or publishing your check. |
| 165 | + |
| 166 | +> TODO: Add image of DMN Definition tab |
| 167 | +
|
| 168 | +--- |
| 169 | + |
| 170 | +### 4.3 Testing |
| 171 | + |
| 172 | +The **Testing** tab lets you run your check against sample input data to verify that it evaluates correctly before publishing. |
| 173 | + |
| 174 | +The screen is split into two panels: |
| 175 | + |
| 176 | +**Left panel — Test Inputs**: |
| 177 | + |
| 178 | +Enter a JSON object representing the form inputs you want to test with. Each key in the JSON should correspond to an input defined in your DMN model. |
| 179 | + |
| 180 | +Example: |
| 181 | + |
| 182 | +```json |
| 183 | +{ |
| 184 | + "age": 72, |
| 185 | + "state": "California" |
| 186 | +} |
| 187 | +``` |
| 188 | + |
| 189 | +**Right panel — Check Summary**: |
| 190 | + |
| 191 | +Displays information about the check being tested, including its configured parameters and their current values. |
| 192 | + |
| 193 | +**Running a test**: |
| 194 | + |
| 195 | +Select **Run Test** to evaluate the check against your input data. The result is displayed as: |
| 196 | + |
| 197 | +- **Eligible** (green) — the check returned `true` |
| 198 | +- **Ineligible** (red) — the check returned `false` |
| 199 | +- **Need more information** (yellow) — the check could not determine eligibility from the provided inputs |
| 200 | + |
| 201 | +Use the testing tab iteratively as you build your DMN logic to confirm each rule behaves as expected. |
| 202 | + |
| 203 | +> TODO: Add image of Testing tab with a sample result |
| 204 | +
|
| 205 | +--- |
| 206 | + |
| 207 | +### 4.4 Publish |
| 208 | + |
| 209 | +The **Publish** tab is where you publish your custom check to make it available in the **Configure Benefit** page of your screeners. |
| 210 | + |
| 211 | +Eligibility checks use semantic versioning. Each time you publish, a new version is created. Previously published versions are preserved and remain available. |
| 212 | + |
| 213 | +> Publishing creates a snapshot of your current DMN model. Subsequent changes to the DMN definition do not affect already-published versions. You must publish again to make new changes available. |
| 214 | +
|
| 215 | +**To publish a check**: |
| 216 | + |
| 217 | +Select **Publish Check**. The new version will appear in the **Published Versions** list below, sorted from newest to oldest. |
| 218 | + |
| 219 | +**Published version details**: |
| 220 | + |
| 221 | +Each published version displays: |
| 222 | + |
| 223 | +- **Name** — the check name |
| 224 | +- **Version** — the semantic version number (e.g., `1.0.0`) |
| 225 | +- **Module** — the module identifier |
| 226 | + |
| 227 | +Once published, the check and its version will appear in the **Your Checks** section when adding eligibility checks to a benefit in any of your screeners. |
| 228 | + |
| 229 | +> TODO: Add image of Publish tab with published versions list |
0 commit comments