new flow; remove plans from request
This commit is contained in:
parent
7178369f47
commit
c3135e1549
3 changed files with 24 additions and 11 deletions
|
|
@ -85,11 +85,29 @@ async def estimate(request: models.EstimationRequest):
|
||||||
)
|
)
|
||||||
|
|
||||||
print("estimation request: ", request)
|
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_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
|
return estimation_response
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,7 @@ class Address(BaseModel):
|
||||||
|
|
||||||
class EstimationRequest(BaseModel):
|
class EstimationRequest(BaseModel):
|
||||||
userId: str | int | None = Field(None, description="Unique identifier")
|
userId: str | int | None = Field(None, description="Unique identifier")
|
||||||
coverage: int = 1
|
|
||||||
applicants: List[Applicant]
|
applicants: List[Applicant]
|
||||||
plans: List[Plan] | None = None
|
|
||||||
phq: PHQ
|
phq: PHQ
|
||||||
income: float
|
income: float
|
||||||
address: Address
|
address: Address
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ class EstimationService:
|
||||||
return None
|
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 = []
|
estimation_results = []
|
||||||
is_review = False
|
is_review = False
|
||||||
review_reasons = []
|
review_reasons = []
|
||||||
|
|
@ -478,9 +478,6 @@ class EstimationService:
|
||||||
base_tier = tier
|
base_tier = tier
|
||||||
break
|
break
|
||||||
|
|
||||||
if not plan_coverage:
|
|
||||||
plan_coverage = self.get_plan_coverage(plans[0])
|
|
||||||
|
|
||||||
rx_spend = 0
|
rx_spend = 0
|
||||||
for applicant_id, applicant in enumerate(applicants):
|
for applicant_id, applicant in enumerate(applicants):
|
||||||
applicant_review_reasons = []
|
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:
|
if is_dtq:
|
||||||
reason = "\n".join(dtq_reasons)
|
reason = "\n".join(dtq_reasons)
|
||||||
|
|
@ -609,7 +606,7 @@ class EstimationService:
|
||||||
if new_tier > base_tier:
|
if new_tier > base_tier:
|
||||||
base_tier = new_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:
|
if base_tier is not None:
|
||||||
reason = "\n".join(accept_reasons)
|
reason = "\n".join(accept_reasons)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue