diff --git a/rag/equitable_dental_plan_class_1.txt b/rag/equitable_dental_plan_class_1.txt new file mode 100644 index 0000000..5b5231c --- /dev/null +++ b/rag/equitable_dental_plan_class_1.txt @@ -0,0 +1,74 @@ +PLAN: Equitable Dental Plan - Class 1 +UID: Equitable Dental Plan - Class 1 +Category: Dental +Type: None +Marketing Name: Equitable Dental - Class 1 +Average Price: $65.64 +Short Description: Essential dental coverage for preventive care including exams, cleanings, and X-rays. Great for maintaining a healthy smile on a budget. + +Long Description: The Class I dental plan offers essential preventive coverage designed to help you maintain good oral health. This includes 100% coverage (in-network) for routine exams, cleanings, and bitewing X-rays twice per year, with no deductible. It’s an affordable way to stay proactive with your dental care and avoid unexpected issues. + + +PRICING: + Coverage 1: $28.11 + Coverage 2: $55.68 + Coverage 3: $75.62 + Coverage 4: $103.18 + +DETAILS: + +COVERAGE: + Coinsurance - In Network: 100% – Preventive care (like cleanings, exams, and X-rays).80% – Basic care (like fillings and simple extractions).50% – Major care (like crowns, dentures, and root canals). + Coinsurance - Out of Network: 100% – Preventive care (like cleanings, exams, and X-rays). 80% – Basic care (like fillings and simple extractions). 50% – Major care (like crowns, dentures, and root canals). + Missing Tooth Clause - In Network: Pre-existing missing teeth not covered + Missing Tooth Clause - Out ofNetwork: Pre-existing missing teeth not covered + Annual Individual Maxium Benefit - In Network: 1000 + Annual Individual Maxium Benefit - Out of Network: 1000 + Annual Individual / Family Deductible - In Network: $50 deductible per person For a family, you only have to pay it for 3 people max (so $150 total), even if more are covered and preventive services are free. + Annual Individual / Family Deductible - Out of Network: $50 deductible per person For a family, you only have to pay it for 3 people max (so $150 total), even if more are covered and preventive services are free. + Reimbursement (how much the insurance company pays thef or care) - In Network: Agreed Rate + Reimbursement (how much the insurance company pays thef or care) - Out of Network: Fixed Coverage Amount + Alternative Benefit (If two treatments would fix the problem, the plan pays for the less expensive one) - In Network: Included + Alternative Benefit (If two treatments would fix the problem, the plan pays for the less expensive one) - Out of Network: Included + +BASICSERVICES: + Simple Extractions - In Network: 80% + Simple Extractions - Out of Network: 80% + Periodontal Maintenance - In Network: 80% + Periodontal Maintenance - Out of Network: 80% + Emergency Palliative Treatment - In Network: 80% + Complete Series/ Panoramic X-Rays - In Network: 80% + Emergency Palliative Treatment - Out of Network: 80% + Complete Series/ Panoramic X-Rays - Out of Network: 80% + Basic Restorative Services (amalgam, composite resin, acrylic, synthetic or plastic fillings) - In Network: 80% + Basic Restorative Services (amalgam, composite resin, acrylic, synthetic or plastic fillings) - Out of Network: 80% + +MAJORSERVICES: + Bridges - In Network: 50% + Bridges - Out of Network: 50% + Oral Surgery - In Network: 50% + Bitewing X-Rays - In Network: 50% + Oral Surgery - Out of Network: 50% + Bitewing X-Rays - Out of Network: 50% + Periodontal Surgery - In Network: 50% + Inlays/Onlays/Crowns - In Network: 50% + Surgical Endodontics - In Network: 50% + Periodontal Surgery - Out of Network: 50% + Inlays/Onlays/Crowns - Out of Network: 50% + Non-Surgical Endodontics - In Network: 50% + Non-Surgical Periodontal - In Network: 50% + Surgical Endodontics - Out of Network: 50% + Non-Surgical Endodontics - Out of Network: 50% + Non-Surgical Periodontal - Out of Network: 50% + Surgical Extractions and Removal of Impacted Teeth - In Network: 80% + Surgical Extractions and Removal of Impacted Teeth - Out of Network: 50% + Dentures – complete, partial, overdenture (upper and lower) - In Network: 50% + Dentures – complete, partial, overdenture (upper and lower) - Out of Network: 50% + +PREVENTIVESERVICES: + Periodic Oral Evaluation - In Network: 100% + Periodic Oral Evaluation - Out of Network: 100% + Comprehensive Oral Evaluation - In Network: 100% + Comprehensive Oral Evaluation - Out of Network: 100% + Limited Oral Evaluation (problem focused) - In Network: 100% + Limited Oral Evaluation (problem focused) - Out of Network: 100% diff --git a/rag/equitable_dental_plan_class_2.txt b/rag/equitable_dental_plan_class_2.txt new file mode 100644 index 0000000..d4a1c77 --- /dev/null +++ b/rag/equitable_dental_plan_class_2.txt @@ -0,0 +1,72 @@ +PLAN: Equitable Dental Plan - Class 2 +UID: Equitable Dental Plan - Class 2 +Category: Dental +Type: None +Marketing Name: Equitable Dental - Class2 +Average Price: $77.90 +Short Description: Expanded dental coverage including preventive and basic restorative services like fillings and extractions. +Long Description: The Class II dental plan builds on the preventive care of Class I and adds basic restorative services such as fillings, simple extractions, and emergency treatment for pain relief. Preventive services are covered at 100% in-network, and basic services are covered at 80% after a $50 annual deductible. This plan is ideal if you want broader protection and help managing more than just routine dental care. + +PRICING: + Coverage 1: $32.87 + Coverage 2: $65.12 + Coverage 3: $90.68 + Coverage 4: $122.93 + +DETAILS: + +COVERAGE: + Coinsurance - In Network: 100% – Preventive care (like cleanings, exams, and X-rays).80% – Basic care (like fillings and simple extractions).50% – Major care (like crowns, dentures, and root canals). + Coinsurance - Out of Network: 100% – Preventive care (like cleanings, exams, and X-rays). 80% – Basic care (like fillings and simple extractions). 50% – Major care (like crowns, dentures, and root canals). + Missing Tooth Clause - In Network: Pre-existing missing teeth not covered + Missing Tooth Clause - Out ofNetwork: Pre-existing missing teeth not covered + Annual Individual Maxium Benefit - In Network: 2000 + Annual Individual Maxium Benefit - Out of Network: 2000 + Annual Individual / Family Deductible - In Network: $50 deductible per person For a family, you only have to pay it for 3 people max (so $150 total), even if more are covered and preventive services are free. + Annual Individual / Family Deductible - Out of Network: $50 deductible per person For a family, you only have to pay it for 3 people max (so $150 total), even if more are covered and preventive services are free. + Reimbursement (how much the insurance company pays thef or care) - In Network: Agreed Rate + Reimbursement (how much the insurance company pays thef or care) - Out of Network: Fixed Coverage Amount + Alternative Benefit (If two treatments would fix the problem, the plan pays for the less expensive one) - In Network: Included + Alternative Benefit (If two treatments would fix the problem, the plan pays for the less expensive one) - Out of Network: Included + +BASICSERVICES: + Simple Extractions - In Network: 80% + Simple Extractions - Out of Network: 80% + Periodontal Maintenance - In Network: 80% + Periodontal Maintenance - Out of Network: 80% + Emergency Palliative Treatment - In Network: 80% + Complete Series/ Panoramic X-Rays - In Network: 80% + Emergency Palliative Treatment - Out of Network: 80% + Complete Series/ Panoramic X-Rays - Out of Network: 80% + Basic Restorative Services (amalgam, composite resin, acrylic, synthetic or plastic fillings) - In Network: 80% + Basic Restorative Services (amalgam, composite resin, acrylic, synthetic or plastic fillings) - Out of Network: 80% + +MAJORSERVICES: + Bridges - In Network: 50% + Bridges - Out of Network: 50% + Oral Surgery - In Network: 50% + Bitewing X-Rays - In Network: 50% + Oral Surgery - Out of Network: 50% + Bitewing X-Rays - Out of Network: 50% + Periodontal Surgery - In Network: 50% + Inlays/Onlays/Crowns - In Network: 50% + Surgical Endodontics - In Network: 50% + Periodontal Surgery - Out of Network: 50% + Inlays/Onlays/Crowns - Out of Network: 50% + Non-Surgical Endodontics - In Network: 50% + Non-Surgical Periodontal - In Network: 50% + Surgical Endodontics - Out of Network: 50% + Non-Surgical Endodontics - Out of Network: 50% + Non-Surgical Periodontal - Out of Network: 50% + Surgical Extractions and Removal of Impacted Teeth - In Network: 80% + Surgical Extractions and Removal of Impacted Teeth - Out of Network: 50% + Dentures – complete, partial, overdenture (upper and lower) - In Network: 50% + Dentures – complete, partial, overdenture (upper and lower) - Out of Network: 50% + +PREVENTIVESERVICES: + Periodic Oral Evaluation - In Network: 100% + Periodic Oral Evaluation - Out of Network: 100% + Comprehensive Oral Evaluation - In Network: 100% + Comprehensive Oral Evaluation - Out of Network: 100% + Limited Oral Evaluation (problem focused) - In Network: 100% + Limited Oral Evaluation (problem focused) - Out of Network: 100% diff --git a/rag/equitable_hospital_indemnity_high_plan.txt b/rag/equitable_hospital_indemnity_high_plan.txt new file mode 100644 index 0000000..0807981 --- /dev/null +++ b/rag/equitable_hospital_indemnity_high_plan.txt @@ -0,0 +1,29 @@ +PLAN: Equitable Hospital Indemnity - High Plan +UID: Equitable Hospital Indemnity - High Plan +Category: Hospital Indemnity +Type: None +Marketing Name: Equitable Hospital Indemnity Benefit - High Plan +Average Price: $87.01 +Short Description: Enhanced coverage with higher daily payments and stronger support for ICU stays, emergencies, and family-related travel. +Long Description: The High Hospital Indemnity Plan offers more robust protection for serious medical events. It pays $2,000 for the first day in the hospital, $300 per day for regular stays, and $500 per day in the ICU—plus enhanced benefits for maternity, rehabilitation, wellness screenings, accident-related ER visits, and well-baby nursery care. It also includes increased reimbursements for family lodging, transportation, and caregiving expenses. This plan is ideal for those seeking greater peace of mind when facing potential hospital-related costs. + +PRICING: + Coverage 1: $45.65 + Coverage 2: $96.54 + Coverage 3: $77.48 + Coverage 4: $128.37 + +DETAILS: + +BENEFITS: + Daily Lodging - Benefit Amount: $200, up to 5 days per year + Daily Family Care - Benefit Amount: $200, up to 5 days per year + First Day Hospital - Benefit Amount: $2,000, once a per year + Daily Transportation - Benefit Amount: $200, up to 5 days per year + Annual Wellness Screening - Benefit Amount: $50, once per year per insured + Daily Hospital Confinement - Benefit Amount: $300, up to 31 days per year + Daily Hospital ICU Confinement - Benefit Amount: $500, up to 10 days per year + Daily Hospital Rehabilitation Unit - Benefit Amount: $100, up to 60 days per year + Daily Well Baby Nursery Confinement - Benefit Amount: $200, up to 60 days per year + Emergency Room Treatment (accident only) - Benefit Amount: 200 + First Day Hospital Intensive Care Unit (ICU) Confinement - Benefit Amount: $4,000, once a per year diff --git a/rag/equitable_hospital_indemnity_low_plan.txt b/rag/equitable_hospital_indemnity_low_plan.txt new file mode 100644 index 0000000..eae11b4 --- /dev/null +++ b/rag/equitable_hospital_indemnity_low_plan.txt @@ -0,0 +1,31 @@ +PLAN: Equitable Hospital Indemnity - Low Plan +UID: Equitable Hospital Indemnity - Low Plan +Category: Hospital Indemnity +Type: None +Marketing Name: Equitable Hospital Indemnity Benefit - Low Plan +Average Price: $46.06 +Short Description: Helps cover basic out-of-pocket costs during a hospital stay, including daily payments, wellness screenings, and accident-related ER visits. + + +Long Description: The Low Hospital Indemnity Plan provides essential financial protection in the event of a hospital stay. It pays you a fixed amount per day you’re hospitalized—including $1,000 for your first hospital day, $200 per day for regular stays, and $400 per day for ICU stays. Additional benefits include wellness screening payouts, emergency accident coverage, and limited support for lodging, transportation, and family care. This plan offers a straightforward safety net for medical-related interruptions without deductibles or networks. + +PRICING: + Coverage 1: $22.44 + Coverage 2: $51.51 + Coverage 3: $41.62 + Coverage 4: $68.69 + +DETAILS: + +BENEFITS: + Daily Lodging - Benefit Amount: $100, up to 5 days per year + Daily Family Care - Benefit Amount: $100, up to 5 days per year + First Day Hospital - Benefit Amount: $1,000, once a per year + Daily Transportation - Benefit Amount: $100, up to 5 days per year + Annual Wellness Screening - Benefit Amount: $50, once per year per insured + Daily Hospital Confinement - Benefit Amount: $200, up to 31 days per year + Daily Hospital ICU Confinement - Benefit Amount: $400, up to 10 days per year + Daily Hospital Rehabilitation Unit - Benefit Amount: $50, up to 60 days per year + Daily Well Baby Nursery Confinement - Benefit Amount: $100, up to 60 days per year + Emergency Room Treatment (accident only) - Benefit Amount: 100 + First Day Hospital Intensive Care Unit (ICU) Confinement - Benefit Amount: $2,000, once a per year diff --git a/src/api/v1/models.py b/src/api/v1/models.py index f1be272..f7a7cc4 100644 --- a/src/api/v1/models.py +++ b/src/api/v1/models.py @@ -26,8 +26,8 @@ class Applicant(BaseModel): applicant: int firstName: str lastName: str - midName: str - phone: str + midName: Optional[str] = Field("", description="Middle name") + phone: Optional[str] = Field("", description="Phone number") gender: str dob: date nicotine: bool @@ -38,7 +38,7 @@ class Applicant(BaseModel): class Plan(BaseModel): id: int coverage: int - tier: str + tier: Optional[str] = Field(None, description="Tier assignment") class Medication(BaseModel): applicant: int @@ -72,14 +72,14 @@ class PHQ(BaseModel): conditions: List[Condition] class Address(BaseModel): - address1: str - address2: str - city: str - state: str - zipcode: str + address1: Optional[str] = Field("", description="Address line 1") + address2: Optional[str] = Field("", description="Address line 2") + city: Optional[str] = Field("", description="City") + state: Optional[str] = Field("", description="State") + zipcode: Optional[str] = Field("", description="Zip code") class EstimationRequest(BaseModel): - uid: str + uid: Optional[str] = Field(None, description="Unique identifier") applicants: List[Applicant] plans: List[Plan] phq: PHQ diff --git a/src/api/v1/router.py b/src/api/v1/router.py index c5d9e81..0680a6f 100644 --- a/src/api/v1/router.py +++ b/src/api/v1/router.py @@ -106,7 +106,8 @@ async def estimate(request: models.EstimationRequest): # Step 2: Check if DTQ → reject application if underwriting_result["combined"].get("dtq"): # For DTQ cases, call external reject API and return rejected status - reject_response = await reject_application(request.uid) + if request.uid: + reject_response = await reject_application(request.uid) return models.EstimationResponse( status="rejected", details=models.EstimationDetails( diff --git a/src/services/chat_service.py b/src/services/chat_service.py index 408ea4e..dea098d 100644 --- a/src/services/chat_service.py +++ b/src/services/chat_service.py @@ -100,22 +100,15 @@ class ChatService: async def process_insurance_chat(self, message: str, session_id: Optional[str] = None) -> Dict[str, Any]: """Process an insurance chat request""" try: - # Create session if not provided if not session_id: session_id = await session_service.create_session() - # Validate session if provided elif not await session_service.validate_session(session_id): - # Create new session if invalid session_id = await session_service.create_session() - # Send message to talestorm-ai chat_response = await self.send_message(session_id, message) - - # Get chat history history = await self.get_chat_history(session_id) - # Extract sources from the response (placeholder for RAG implementation) sources = self._extract_sources_from_response(chat_response.get("message", "")) return { diff --git a/src/services/session_service.py b/src/services/session_service.py index bed3474..3c177ad 100644 --- a/src/services/session_service.py +++ b/src/services/session_service.py @@ -56,29 +56,16 @@ class SessionService: async def create_session(self, agent_id: Optional[str] = None) -> Optional[str]: """Create a new chat session in talestorm-ai""" async with await self.get_client() as client: - try: - # Use provided agent_id, then configured agent_id, then fallback to default - if not agent_id: - if self.agent_id: - agent_id = self.agent_id - else: - default_agent = await self.get_default_agent() - if not default_agent: - # Create a simple session ID for now - return str(uuid.uuid4()) - agent_id = str(default_agent["id"]) - - # Create session with talestorm-ai - response = await client.post("/sessions/", params={"agent_id": agent_id}) - if response.status_code == 200: - session_data = response.json() - return str(session_data["id"]) + if not agent_id: + if self.agent_id: + agent_id = self.agent_id else: - # Fallback to local session ID - return str(uuid.uuid4()) - except Exception: - # Fallback to local session ID - return str(uuid.uuid4()) + agent_id = settings.TALESTORM_AGENT_ID + + response = await client.post("/sessions/", params={"agent_id": agent_id}) + session_data = response.json() + return str(session_data["id"]) + async def get_session(self, session_id: str) -> Optional[Dict[str, Any]]: """Get session details from talestorm-ai"""