Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bbace95
Add test rules endpoint and comprehensive Swagger documentation
arunv11u Nov 5, 2025
a74619a
Fix Dockerfile casing warning: use uppercase AS keyword
arunv11u Nov 5, 2025
a107903
Make Excel files publicly accessible in S3
arunv11u Nov 5, 2025
87580f4
Add ACL fallback for S3 Excel uploads
arunv11u Nov 6, 2025
c1875ff
Revert Excel files to private access
arunv11u Nov 6, 2025
5d32771
Implement container-per-ruleset architecture for Docker and Kubernetes
arunv11u Nov 6, 2025
72310dd
Fix Docker network detection in ContainerOrchestrator
arunv11u Nov 6, 2025
a930130
Fix registry access error when container exists
arunv11u Nov 6, 2025
c95ab0f
Update rules engine drools to create dedicated containers for policies
arunv11u Nov 6, 2025
bc9fc42
Add sample policy document for loan
arunv11u Nov 6, 2025
248298d
Update policy document processing
arunv11u Nov 7, 2025
0fa2d7c
Update rule engine policy extraction
arunv11u Nov 7, 2025
6f54a16
implemented the file upload api 1
MKarthikeyanAI Nov 7, 2025
09f671b
Update rule engine
arunv11u Nov 10, 2025
c77c7db
Update rules engine
arunv11u Nov 11, 2025
66d9a39
Update rule engine logic
arunv11u Nov 11, 2025
16cc468
Update rule engine
arunv11u Nov 11, 2025
7537cd7
Update rule engine
arunv11u Nov 11, 2025
d33a78b
Update cors config
arunv11u Nov 11, 2025
5bc4af5
Update cors config
arunv11u Nov 11, 2025
0585f72
Update cors config
arunv11u Nov 11, 2025
78072c6
Update cors config
arunv11u Nov 11, 2025
fe003f0
Update rule engine
arunv11u Nov 12, 2025
9f1623a
Update rule engine hierarchy
arunv11u Nov 14, 2025
9d8ff2c
Update hierarchical rules
arunv11u Nov 14, 2025
932f192
Update hierarchy rules
arunv11u Nov 14, 2025
0c53dcd
Update readme file
arunv11u Nov 15, 2025
1699619
Update workflow diagram
arunv11u Nov 15, 2025
98e9150
Update test cases for policies
arunv11u Nov 15, 2025
0d4bd3f
Update edit-hierachical rules api
ashwinrookie Nov 17, 2025
a1f6660
Merge branch 'main' of https://github.com/infiniai-tech/underwriter-r…
ashwinrookie Nov 17, 2025
2d26af2
Update test harness
arunv11u Nov 19, 2025
5337a07
Update database service for test harness
arunv11u Nov 19, 2025
2e03f4a
Comment sample test cases in the migration file
arunv11u Nov 19, 2025
97d9a04
Update Test harness
arunv11u Nov 20, 2025
67f1265
Update test harness
arunv11u Nov 22, 2025
f185f3b
Updte db init file
arunv11u Nov 22, 2025
c78a75e
Update init file
arunv11u Nov 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Normalize line endings to prevent Windows CRLF issues in Docker containers

# Shell scripts MUST use LF (Linux line endings)
*.sh text eol=lf

# Python files should use LF
*.py text eol=lf

# Docker files should use LF
Dockerfile text eol=lf
.dockerignore text eol=lf
docker-compose.yml text eol=lf
docker-compose.*.yml text eol=lf

# Configuration files should use LF
*.yaml text eol=lf
*.yml text eol=lf
*.json text eol=lf
*.env text eol=lf
*.env.* text eol=lf

# Markdown files
*.md text eol=lf

# XML files (for Maven)
*.xml text eol=lf
pom.xml text eol=lf

# Java files
*.java text eol=lf
*.drl text eol=lf

# Binary files (don't normalize)
*.jar binary
*.war binary
*.ear binary
*.pdf binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.xlsx binary
*.xls binary
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ hs_err_pid*

# private files
**/.env.local
*.env
llm.env
tmp
TODO.md
240 changes: 240 additions & 0 deletions API_FIELD_NAMING_CONVENTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
# API Field Naming Conventions

## Important: Field Names Must Match DRL Declarations

When calling the `/api/v1/evaluate-policy` endpoint, **field names in your JSON request must exactly match the field names declared in the DRL rules**.

## Why This Matters

The Drools rule engine uses Java POJOs generated from DRL `declare` statements. For proper deserialization, JSON field names must match the Java field names (which are generated from DRL declarations).

## Current Field Names for Insurance Policies

### Applicant Object

Based on the DRL declaration:
```drl
declare Applicant
name: String
age: int
occupation: String
healthConditions: String
creditScore: int
annualIncome: double
smoker: boolean
end
```

**Correct field names (camelCase):**
```json
{
"applicant": {
"name": "John Doe",
"age": 35,
"occupation": "Engineer",
"healthConditions": "good",
"creditScore": 720,
"annualIncome": 75000,
"smoker": false
}
}
```

**Incorrect field names (snake_case) - WILL NOT WORK:**
```json
{
"applicant": {
"health_status": "good", ❌ Use "healthConditions"
"credit_score": 720, ❌ Use "creditScore"
"annual_income": 75000, ❌ Use "annualIncome"
"income": 75000 ❌ Use "annualIncome"
}
}
```

### Policy Object

Based on the DRL declaration:
```drl
declare Policy
policyType: String
coverageAmount: double
term: int
end
```

**Correct field names:**
```json
{
"policy": {
"policyType": "term_life",
"coverageAmount": 500000,
"term": 20
}
}
```

**Note:** The example also shows alternative fields like `termYears` and `type` being used in practice - verify with your actual DRL file which fields are expected.

## Complete Working Example

```json
{
"bank_id": "chase",
"policy_type": "insurance",
"applicant": {
"age": 35,
"annualIncome": 75000,
"creditScore": 720,
"healthConditions": "good",
"smoker": false
},
"policy": {
"coverageAmount": 500000,
"termYears": 20,
"type": "term_life"
}
}
```

### Expected Response (Approved)
```json
{
"bank_id": "chase",
"container_id": "chase-insurance-underwriting-rules",
"decision": {
"approved": true,
"reason": "Application meets all requirements",
"requiresManualReview": false,
"premiumMultiplier": 1.0
},
"status": "success"
}
```

## Rejection Examples

### Example 1: Age Too High
```json
{
"applicant": {
"age": 70, // > 65, will be rejected
"annualIncome": 75000,
"creditScore": 720,
"healthConditions": "good",
"smoker": false
}
}
```

**Response:**
```json
{
"decision": {
"approved": false,
"reason": "Applicant age is outside acceptable range"
}
}
```

### Example 2: Credit Score Too Low
```json
{
"applicant": {
"age": 35,
"annualIncome": 75000,
"creditScore": 550, // < 600, will be rejected
"healthConditions": "good",
"smoker": false
}
}
```

**Response:**
```json
{
"decision": {
"approved": false,
"reason": "Applicant credit score is below minimum requirement"
}
}
```

### Example 3: Income Too Low
```json
{
"applicant": {
"age": 35,
"annualIncome": 20000, // < 25000, will be rejected
"creditScore": 720,
"healthConditions": "good",
"smoker": false
}
}
```

**Response:**
```json
{
"decision": {
"approved": false,
"reason": "Applicant annual income is below minimum requirement"
}
}
```

### Example 4: Coverage Too High Relative to Income
```json
{
"applicant": {
"age": 35,
"annualIncome": 50000,
"creditScore": 720,
"healthConditions": "good",
"smoker": false
},
"policy": {
"coverageAmount": 600000 // > 10x income (500,000), will be rejected
}
}
```

**Response:**
```json
{
"decision": {
"approved": false,
"reason": "Coverage amount is outside acceptable range"
}
}
```

## Troubleshooting

### Symptom: Getting unexpected rejections
**Cause:** Field names don't match DRL declarations, so values aren't being read by rules.

**Solution:** Check your DRL file and ensure JSON field names exactly match the declared field names.

### How to Check Your DRL File

1. Find your deployed DRL file in S3 or the database
2. Look for `declare` statements
3. Use those exact field names in your JSON requests

### Example DRL Check
```bash
# Get the DRL file from S3
aws s3 cp s3://uw-data-extraction/generated-rules/chase-insurance-underwriting-rules/latest/*.drl - | grep -A 10 "declare Applicant"
```

## Best Practices

1. **Always use camelCase** for field names (matches Java conventions)
2. **Verify field names** against the actual DRL file for your policy
3. **Test with known values** before integrating
4. **Check the response** - if fields are missing from the decision object, they weren't properly deserialized

## Updated Documentation

The swagger documentation at `/rule-agent/docs` has been updated with correct examples showing the proper field names.
Loading