Drools Tutorial Series Part 4: Using Rules for Underwriting
In Part 4 of our Drools tutorial series, we take a look at a practical underwriting example that demonstrates eligibility, scoring, and premium adjustments.
Designing the workflow
We’ll implement a simplified small-commercial underwriting flow that determines:
- Eligibility (pass/fail)
- Risk score (0–100)
- Premium adjustments (surcharges or discounts)
Inputs include applicant profile, prior claims history, coverage options, and exposure details.
Data model (concise)
- Applicant { id, businessType, yearsInBusiness }
- Policy { id, coverageLimit, serviceArea, basePremium }
- Claim { date, amount, type }
Keep the domain model small and stable; changes to these objects ripple through rules, tests, and integrations.
Rules strategy
Split logic into three focused rulesets:
- Eligibility ruleset — gate checks that short-circuit ineligible applications
- Scoring ruleset — modular scoring components (claims history, industry risk, exposure)
- Pricing ruleset — applies surcharges/discounts using decision tables
This separation keeps each ruleset small, testable, and auditable.
Example decision table: premium adjustments
A decision table for surcharges may use industryRisk, claimsLast3Years, and coverageLimit to decide an adjustment percentage.
IndustryRisk,ClaimsLast3Years,CoverageLimit,Adjustment
LOW,0-1,<100000,-0.05
LOW,2-3,>=100000,0.00
MEDIUM,0-1,<100000,0.05
MEDIUM,2-3,>=100000,0.10
HIGH,>=4,any,0.20
In practice, map these rows to clear business descriptions so underwriters understand changes.
Human-in-loop and exceptions
When eligibility fails or scores exceed thresholds, route the application to an underwriter with context: which rule(s) fired, score breakdown, and suggested actions. Store the full audit trail (inputs, rule activations, and outputs) with the case for compliance and diagnostics.
Test fixtures and examples
Create representative fixtures for common scenarios:
fixtures/eligible-small-business.jsonfixtures/high-claims-history.jsonfixtures/edge-case-coverage.json
Parametrized tests iterate these fixtures and assert eligibility, score ranges, and final premium adjustments.
Deploying as a service
Package the rules into a KJAR and expose a simple REST endpoint that accepts policy payloads and returns a decision object:
POST /api/underwrite
{
"policy": {...}
}
// response
{
"eligible": true,
"score": 72,
"adjustment": 0.05,
"reasons": ["Claims in last 3 years: 1", "Industry risk: MEDIUM"]
}
Keep the REST contract stable and versioned so consumers can adapt to rule changes.
Operational notes
- Keep retention of decision logs for audits
- Use staged rollouts for new pricing tables and review downstream system impacts (billing, renewals)
- Provide underwriters a concise UI to review rule results and add manual overrides that are recorded in the audit trail
Conclusion
Insurance rules are a natural fit for Drools when you adopt a modular, test-first approach. Split eligibility, scoring, and pricing; use decision tables for rate tables; and keep humans in the loop for edge cases. These practices produce reliable, auditable underwriting automation.