estimation service refactor

This commit is contained in:
ipu 2025-07-25 17:43:23 +03:00
parent aaba8753ef
commit 18c95083c9
4 changed files with 367 additions and 62 deletions

View file

@ -128,23 +128,45 @@ async def test_estimation():
"uid": "test-application-123",
"applicants": [
{
"applicant": 1,
"firstName": "John",
"dob": "15/03/1985",
"weight": 70,
"lastName": "Doe",
"midName": "M",
"phone": "555-123-4567",
"gender": "male",
"dob": "1985-03-15",
"nicotine": False,
"weight": 70.0,
"heightFt": 5,
"heightIn": 10,
"applicant": 1
"heightIn": 10
}
],
"plans": [
{
"id": 1,
"coverage": 1,
"tier": "tier_1"
}
],
"plans": [{"coverage": 1}],
"phq": {
"effectiveDate": "01/01/2024",
"treatment": False,
"invalid": False,
"pregnancy": False,
"effectiveDate": "2024-01-01",
"disclaimer": True,
"signature": "John Doe",
"medications": [],
"conditions": [],
"issues": []
"issues": [],
"conditions": []
},
"income": 50000,
"address": {}
"income": 50000.0,
"address": {
"address1": "123 Main St",
"address2": "Apt 4B",
"city": "New York",
"state": "NY",
"zipcode": "10001"
}
}
async with httpx.AsyncClient() as client:
@ -153,8 +175,18 @@ async def test_estimation():
if response.status_code == 200:
data = response.json()
print(f"✅ Estimation successful!")
print(f"Application ID: {data['uid']}")
print(f"Status: {data['status']}")
print(f"Details:")
print(f" DTQ: {data['details']['dtq']}")
print(f" Tier: {data['details']['tier']}")
print(f" Total Price: ${data['details']['total_price']}")
print(f" Reason: {data['details']['reason']}")
print(f"Results:")
for i, result in enumerate(data['results'], 1):
print(f" Applicant {i}: {result['name']} ({result['applicant_type']})")
print(f" Age: {result['age']}, BMI: {result['bmi']}")
print(f" Tier: {result['tier']}, Rx Spend: ${result['rx_spend']}")
print(f" Message: {result['message']}")
else:
print(f"❌ Estimation failed with status {response.status_code}")
print(f"Error: {response.text}")