diff --git a/src/api/v1/router.py b/src/api/v1/router.py index 8aa867b..09c1122 100644 --- a/src/api/v1/router.py +++ b/src/api/v1/router.py @@ -85,11 +85,29 @@ async def estimate(request: models.EstimationRequest): ) print("estimation request: ", request) - if not request.plans: - request.plans = list() + + has_primary = False + has_spouse = False + has_dependents = False + for applicant in request.applicants: + if applicant.applicant == 1: + has_primary = True + elif applicant.applicant == 2: + has_spouse = True + elif applicant.applicant == 3: + has_dependents = True + + if has_primary and not has_spouse and not has_dependents: + coverage = 1 + elif has_primary and has_spouse and not has_dependents: + coverage = 2 + elif has_primary and not has_spouse and has_dependents: + coverage = 3 + else: + coverage = 4 estimation_service = EstimationService() - estimation_response = await estimation_service.estimate_insurance(request.applicants, request.phq, request.plans, request.coverage) + estimation_response = await estimation_service.estimate_insurance(request.applicants, request.phq, coverage) return estimation_response diff --git a/src/models.py b/src/models.py index d8bfe05..3f56a35 100644 --- a/src/models.py +++ b/src/models.py @@ -60,9 +60,7 @@ class Address(BaseModel): class EstimationRequest(BaseModel): userId: str | int | None = Field(None, description="Unique identifier") - coverage: int = 1 applicants: List[Applicant] - plans: List[Plan] | None = None phq: PHQ income: float address: Address diff --git a/src/services/estimation_service_v2.py b/src/services/estimation_service_v2.py index a5cecee..a9f3552 100644 --- a/src/services/estimation_service_v2.py +++ b/src/services/estimation_service_v2.py @@ -458,7 +458,7 @@ class EstimationService: return None - async def estimate_insurance(self, applicants: list[Applicant], phq: PHQ, plans: list[Plan], plan_coverage: int): + async def estimate_insurance(self, applicants: list[Applicant], phq: PHQ, plan_coverage: int): estimation_results = [] is_review = False review_reasons = [] @@ -478,9 +478,6 @@ class EstimationService: base_tier = tier break - if not plan_coverage: - plan_coverage = self.get_plan_coverage(plans[0]) - rx_spend = 0 for applicant_id, applicant in enumerate(applicants): applicant_review_reasons = [] @@ -562,7 +559,7 @@ class EstimationService: ) ) - plan_price_id = self.get_plan_price(plans[0], base_tier, plan_coverage) + # plan_price_id = self.get_plan_price(plans[0], base_tier, plan_coverage) if is_dtq: reason = "\n".join(dtq_reasons) @@ -609,7 +606,7 @@ class EstimationService: if new_tier > base_tier: base_tier = new_tier - plan_price_id = self.get_plan_price(plans[0], base_tier, plan_coverage) + # plan_price_id = self.get_plan_price(plans[0], base_tier, plan_coverage) if base_tier is not None: reason = "\n".join(accept_reasons)