Spaces:
Sleeping
fix(marketplace+voice+routing): KI-136 + KI-141 + KI-142 + KI-143 + KI-144 — full bundle
Browse filesFive distinct fixes shipped together for a single rebuild cycle:
KI-141 — hybrid alias dedup. /api/coverage + /api/policies/all now collapse
curated marketing-rename entries (Activ One, Optima Secure, etc.) under
their PDF-backed parent card, with aliases surfaced as 'Also marketed as:'
on the marketplace cards. Frontend page.tsx + api.ts add aliases[] field
on MarketplacePolicy. Card count went 158 -> ~137.
KI-142 — UIN-primary merge rule. /api/coverage and /api/policies/all now
build uin_to_parent maps from extracted JSONs and merge curated entries
based on UIN equality. Falls back to source_pdf gate when UIN matches
fail. 1 UIN = 1 marketplace card invariant.
KI-136 — named-SKU comparison routing. orchestrator.py
should_route_to_fact_find now accepts query and exempts intent=comparison
when the question mentions >=2 named insurers/SKUs. Empty profile no
longer traps SKU-specific compare questions in fact_find_brain.
Verified: 'Compare HDFC ERGO Optima Secure and Niva Bupa Aspire on
maternity' now routes to nim-chain comparison brain with citations.
KI-143 — bajaj group-health-guard slug correction. PDF labeled 'Gold'
in slug was actually 'Health Guard (Group) - Silver Plan' per the PDF
cover. Renamed PDF, extracted JSON, curated facts, Chroma metadata
(43 chunks), .gitattributes LFS line. The separate
health-guard-gold-individual product is untouched.
KI-144 — reliance-general -> indusind-general migration. The 3
INDUSIND-branded products (HealthGain, Hospi Care, Group Mediclaim) are
issued by IndusInd General Insurance (formerly Reliance General per
IRDAI Reg No. 103). Migrated insurer_slug for these 3, kept
personal-accident under reliance-general. Added insurer_meta entry for
indusind-general. Added legacy_issuer field for retrieval continuity.
164 Chroma chunks migrated.
Dockerfile DATASET_CACHE_BUST bumped to 2026-05-15-ki144-v1 so the next
Space rebuild pulls the freshly-updated Chroma binary.
Files changed (10)
- .gitattributes+1-1
- 40-data/policy_facts/bajaj-allianz__group-health-guard-gold__wordings.json → 40-data/policy_facts/bajaj-allianz__group-health-guard-silver__wordings.jsonRenamed+25-25
- 40-data/policy_facts/reliance-general__group-mediclaim__wordings.json → 40-data/policy_facts/indusind-general__group-mediclaim__wordings.jsonRenamed+5-4
- 40-data/policy_facts/reliance-general__health-gain__wordings.json → 40-data/policy_facts/indusind-general__health-gain__wordings.jsonRenamed+5-4
- 40-data/policy_facts/reliance-general__hospi-care__wordings.json → 40-data/policy_facts/indusind-general__hospi-care__wordings.jsonRenamed+5-4
- Dockerfile+1-1
- backend/main.py+307-2
- backend/orchestrator.py+32
- frontend/src/app/page.tsx+10-1
- frontend/src/lib/api.ts+1
41 unmodified lines4243444546474841 unmodified linesrag/corpus/bajaj-allianz/criti-care__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/extra-care-plus__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/global-health-care__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/group-personal-accident__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/health-guard-gold-individual__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/health-guard__wordings.pdf filter=lfs diff=lfs merge=lfs -text41 unmodified lines4243444546474841 unmodified linesrag/corpus/bajaj-allianz/criti-care__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/extra-care-plus__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/global-health-care__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/group-personal-accident__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/health-guard-gold-individual__wordings.pdf filter=lfs diff=lfs merge=lfs -textrag/corpus/bajaj-allianz/health-guard__wordings.pdf filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{"policy_id": "bajaj-allianz__group-health-guard-gold__wordings","policy_name": "Group Health Guard Gold","insurer_slug": "bajaj-allianz","uin_code": {"value": "BAJHLGP21181V022021","source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "UIN: BAJHLGP21181V022021"},"min_entry_age": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"max_entry_age": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"max_renewal_age": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"pre_existing_disease_waiting_months": {"value": 36,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "pre-existing Disease (PED) and its direct complications shall be excluded until the expiry of 36 months"},"initial_waiting_period_days": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"maternity_coverage": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"maternity_waiting_months": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"ayush_coverage": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"cashless_treatment_supported": {"value": true,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "Cashless facility"},"copayment_pct": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"no_claim_bonus_pct": {"value": 100,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "cumulative bonus (if any) is exhausted due to claims lodged during the Policy\nyear, then it is agreed that 100%"},"restoration_benefit": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"room_rent_capping": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"pre_hospitalization_days": {"value": 60,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "Pre-Hospitalisation\nThe Medical Expenses incurred during the 60 days"},"post_hospitalization_days": {"value": 90,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "Post-Hospitalisation\nThe Medical Expenses incurred during the 90 days"},"day_care_treatments_count": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"network_hospital_count": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"sum_insured_options": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"claim_settlement_ratio": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"tat_cashless_authorization_hours": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": ""},"policy_type": {"value": "group","source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","source_quote": "classified as group from PDF heuristics"},"_meta": {"curated_at": "2026-05-14","primary_source_pdf": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","completeness_pct": 32,"notes": "Curated by tools/curate_remaining.py \u2014 pattern-based extraction from local PDF"}}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121{"policy_id": "bajaj-allianz__group-health-guard-silver__wordings","policy_name": "Health Guard (Group) - Silver Plan","insurer_slug": "bajaj-allianz","uin_code": {"value": "BAJHLGP21181V022021","source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "UIN: BAJHLGP21181V022021"},"min_entry_age": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"max_entry_age": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"max_renewal_age": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"pre_existing_disease_waiting_months": {"value": 36,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "pre-existing Disease (PED) and its direct complications shall be excluded until the expiry of 36 months"},"initial_waiting_period_days": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"maternity_coverage": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"maternity_waiting_months": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"ayush_coverage": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"cashless_treatment_supported": {"value": true,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "Cashless facility"},"copayment_pct": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"no_claim_bonus_pct": {"value": 100,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "cumulative bonus (if any) is exhausted due to claims lodged during the Policy\nyear, then it is agreed that 100%"},"restoration_benefit": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"room_rent_capping": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"pre_hospitalization_days": {"value": 60,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "Pre-Hospitalisation\nThe Medical Expenses incurred during the 60 days"},"post_hospitalization_days": {"value": 90,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "Post-Hospitalisation\nThe Medical Expenses incurred during the 90 days"},"day_care_treatments_count": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"network_hospital_count": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"sum_insured_options": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"claim_settlement_ratio": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"tat_cashless_authorization_hours": {"value": null,"source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": ""},"policy_type": {"value": "group","source_pdf_path": "rag/corpus/bajaj-allianz/group-health-guard-silver__wordings.pdf","source_quote": "classified as group from PDF heuristics"},"_meta": {"curated_at": "2026-05-14","primary_source_pdf": "rag/corpus/bajaj-allianz/group-health-guard-gold__wordings.pdf","completeness_pct": 32,"notes": "Curated by tools/curate_remaining.py — pattern-based extraction from local PDF"}}
1234567126 unmodified lines134135136137138{"policy_id": "reliance-general__group-mediclaim__wordings","policy_name": "IndusInd Group Mediclaim","insurer_slug": "reliance-general","source_pdf_path": "rag/corpus/reliance-general/group-mediclaim__wordings.pdf","uin_code": {"value": "RELHLGP21523V022021",126 unmodified lines"unit": null,"source_pdf_path": "rag/corpus/reliance-general/group-mediclaim__wordings.pdf","source_quote": "not extracted from this PDF (field absent or LLM unable to infer)"}}1234567126 unmodified lines134135136137138139{"policy_id": "indusind-general__group-mediclaim__wordings","policy_name": "IndusInd Group Mediclaim","insurer_slug": "indusind-general","source_pdf_path": "rag/corpus/reliance-general/group-mediclaim__wordings.pdf","uin_code": {"value": "RELHLGP21523V022021",126 unmodified lines"unit": null,"source_pdf_path": "rag/corpus/reliance-general/group-mediclaim__wordings.pdf","source_quote": "not extracted from this PDF (field absent or LLM unable to infer)"},"legacy_issuer": "Reliance General Insurance"}
1234567126 unmodified lines134135136137138{"policy_id": "reliance-general__health-gain__wordings","policy_name": "IndusInd HealthGain Policy","insurer_slug": "reliance-general","source_pdf_path": "rag/corpus/reliance-general/health-gain__wordings.pdf","uin_code": {"value": "INIHLIP26040V042526",126 unmodified lines"unit": null,"source_pdf_path": "rag/corpus/reliance-general/health-gain__wordings.pdf","source_quote": "not extracted from this PDF (field absent or LLM unable to infer)"}}1234567126 unmodified lines134135136137138139{"policy_id": "indusind-general__health-gain__wordings","policy_name": "IndusInd HealthGain Policy","insurer_slug": "indusind-general","source_pdf_path": "rag/corpus/reliance-general/health-gain__wordings.pdf","uin_code": {"value": "INIHLIP26040V042526",126 unmodified lines"unit": null,"source_pdf_path": "rag/corpus/reliance-general/health-gain__wordings.pdf","source_quote": "not extracted from this PDF (field absent or LLM unable to infer)"},"legacy_issuer": "Reliance General Insurance"}
1234567126 unmodified lines134135136137138{"policy_id": "reliance-general__hospi-care__wordings","policy_name": "IndusInd Hospi Care Insurance","insurer_slug": "reliance-general","source_pdf_path": "rag/corpus/reliance-general/hospi-care__wordings.pdf","uin_code": {"value": "RELHLIP20027V012021",126 unmodified lines"unit": null,"source_pdf_path": "rag/corpus/reliance-general/hospi-care__wordings.pdf","source_quote": "not extracted from this PDF (field absent or LLM unable to infer)"}}1234567126 unmodified lines134135136137138139{"policy_id": "indusind-general__hospi-care__wordings","policy_name": "IndusInd Hospi Care Insurance","insurer_slug": "indusind-general","source_pdf_path": "rag/corpus/reliance-general/hospi-care__wordings.pdf","uin_code": {"value": "RELHLIP20027V012021",126 unmodified lines"unit": null,"source_pdf_path": "rag/corpus/reliance-general/hospi-care__wordings.pdf","source_quote": "not extracted from this PDF (field absent or LLM unable to infer)"},"legacy_issuer": "Reliance General Insurance"}
69 unmodified lines7071727374757669 unmodified lines# (7356 chunks from a prior ingest) instead of the freshly-uploaded# cleaned one (3799 chunks). Bump CACHE_BUST manually each time the# dataset is re-uploaded; the value just needs to change.ARG DATASET_CACHE_BUST=2026-05-15-ki138-v2RUN echo "Dataset cache bust: ${DATASET_CACHE_BUST}" && python -c "\from huggingface_hub import snapshot_download; \snapshot_download(\69 unmodified lines7071727374757669 unmodified lines# (7356 chunks from a prior ingest) instead of the freshly-uploaded# cleaned one (3799 chunks). Bump CACHE_BUST manually each time the# dataset is re-uploaded; the value just needs to change.ARG DATASET_CACHE_BUST=2026-05-15-ki144-v1RUN echo "Dataset cache bust: ${DATASET_CACHE_BUST}" && python -c "\from huggingface_hub import snapshot_download; \snapshot_download(\
139 unmodified lines140141142143144145411 unmodified lines55755855956056156229 unmodified lines59259359459559659759859960017 unmodified lines6186196206216226236246258 unmodified lines6346356366376386397 unmodified lines64764864965065165265365425 unmodified lines680681682683684685387 unmodified lines10731074107510761077107872 unmodified lines115111521153115411551156115711586 unmodified lines1165116611671168116911706 unmodified lines1177117811791180118111821183118411853 unmodified lines11891190119111921193119456 unmodified lines12511252125312541255125636 unmodified lines12931294129512961297129872 unmodified lines13711372137313741375137613 unmodified lines13901391139213931394139544 unmodified lines144014411442144314441445139 unmodified lineshome_url: str # insurer's main website (manually curated, verified)policy_count: intsample_policies: list[PolicyEntry]class CoverageResponse(BaseModel):411 unmodified lines"national-insurance": ("National Insurance Company", "https://nationalinsurance.nic.co.in/"),"new-india": ("New India Assurance", "https://www.newindia.co.in/"),"niva-bupa": ("Niva Bupa Health Insurance", "https://www.nivabupa.com/"),"oriental-insurance": ("Oriental Insurance Company", "https://orientalinsurance.org.in/"),"reliance-general": ("Reliance General Insurance", "https://www.reliancegeneral.co.in/"),"royal-sundaram": ("Royal Sundaram General Insurance", "https://www.royalsundaram.in/"),29 unmodified linesseen_product_keys: set[str] = set()seen_policy_ids: set[str] = set()# by_insurer entries:# products: set of product_keys (matches /api/policies/all card count)# names: ordered dict of policy_NAME -> first product_key (for sample display)# KI-135 (2026-05-15) — track product_keys (not names) for counting so the# ~1 within-insurer policy_name collision (e.g. new-india Floater listed# as both extracted + curated_facts) doesn't collapse the count below the17 unmodified linesname = data.get("policy_name", "") or pidurl = data.get("source_pdf_url", "")if slug not in by_insurer:by_insurer[slug] = {"products": set(), "names": [], "chunks": 0}by_insurer[slug]["products"].add(pkey)if name not in by_insurer[slug]["names"]:by_insurer[slug]["names"].append(name)by_insurer[slug]["chunks"] += 18 unmodified linescontinueif any(eid.startswith(curated_pid + "__") for eid in seen_policy_ids):continueseen_policy_ids.add(curated_pid)slug = data.get("insurer_slug", "")if slug == "regulatory":7 unmodified linesname = data.get("policy_name", "") or curated_pidurl = data.get("source_pdf_url", "")if slug not in by_insurer:by_insurer[slug] = {"products": set(), "names": [], "chunks": 0}by_insurer[slug]["products"].add(pkey)if name not in by_insurer[slug]["names"]:by_insurer[slug]["names"].append(name)by_insurer[slug]["chunks"] += 125 unmodified lineshome_url=home_url,policy_count=product_count,sample_policies=sample_entries,))387 unmodified linesmaternity_coverage: Optional[bool] = Nonecashless_treatment_supported: Optional[bool] = Noneroom_rent_capping: Optional[str] = Noneclass MarketplaceResponse(BaseModel):72 unmodified lines`{field: {value, source_pdf_path, source_quote}}` shape. We unwrap to aflat `{field: value}` dict for the marketplace endpoint, preserving theprovenance in a `_facts_provenance` field for transparency."""import json as _jsonfacts: dict[str, dict] = {}facts_dir = settings.CORPUS_DIR.parent.parent / "40-data" / "policy_facts"if not facts_dir.exists():6 unmodified linespolicy_id = d.get("policy_id") or f.stemflat: dict = {}provenance: dict = {}for k, v in d.items():if k.startswith("_") or k in ("policy_id", "policy_name", "insurer_slug"):flat[k] = v6 unmodified lines"source_quote": v.get("source_quote"),"source_url": v.get("source_url"),}else:flat[k] = vflat["_facts_provenance"] = provenance# Try a couple of policy_id permutations to maximise lookup hit ratefacts[policy_id] = flat# Some extracted JSONs use `_wordings` suffix; the curated files don't3 unmodified linesreturn factsdef _merge_curated(extracted: dict, curated: dict | None) -> dict:"""Curated facts override LLM extraction for every field they populate.LLM extraction fills the long tail. Provenance pointers survive in the56 unmodified lines"national-insurance": ("National Insurance Company", "https://nationalinsurance.nic.co.in/"),"new-india": ("New India Assurance", "https://www.newindia.co.in/"),"niva-bupa": ("Niva Bupa Health Insurance", "https://www.nivabupa.com/"),"oriental-insurance": ("Oriental Insurance Company", "https://orientalinsurance.org.in/"),"reliance-general": ("Reliance General Insurance", "https://www.reliancegeneral.co.in/"),"royal-sundaram": ("Royal Sundaram General Insurance", "https://www.royalsundaram.in/"),36 unmodified lineskey=lambda fp: (_DOCTYPE_RANK.get(_doctype_of(fp.stem), 99), fp.stem),)seen_product_keys: set[str] = set()seen_policy_ids: set[str] = set()out = []72 unmodified linesmaternity_coverage=_coerce_bool(data.get("maternity_coverage")),cashless_treatment_supported=_coerce_bool(data.get("cashless_treatment_supported")),room_rent_capping=data.get("room_rent_capping") if isinstance(data.get("room_rent_capping"), str) else None,))except Exception as e:# One malformed extraction should not kill the whole feed13 unmodified lines# Also skip if any extracted ID matches with a suffixif any(eid.startswith(curated_policy_id + "__") for eid in seen_policy_ids):continueseen_policy_ids.add(curated_policy_id)slug = data.get("insurer_slug", "")name, home = insurer_meta.get(slug, (slug, ""))44 unmodified linesmaternity_coverage=_coerce_bool(data.get("maternity_coverage")),cashless_treatment_supported=_coerce_bool(data.get("cashless_treatment_supported")),room_rent_capping=data.get("room_rent_capping") if isinstance(data.get("room_rent_capping"), str) else None,))except Exception as e:print(f"[marketplace] skipping curated {curated_policy_id}: {type(e).__name__}: {str(e)[:120]}")139 unmodified lines140141142143144145146147148149150151411 unmodified lines56356456556656756856929 unmodified lines59960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070117 unmodified lines7197207217227237247257267277288 unmodified lines7377387397407417427437447457467 unmodified lines75475575675775875976076176276376476525 unmodified lines791792793794795796797387 unmodified lines11851186118711881189119011911192119311941195119672 unmodified lines126912701271127212731274127512761277127812791280128112826 unmodified lines12891290129112921293129412956 unmodified lines13021303130413051306130713081309131013111312131313141315131613171318131913203 unmodified lines1324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134656 unmodified lines140314041405140614071408140936 unmodified lines1446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159172 unmodified lines16641665166616671668166916701671167213 unmodified lines1686168716881689169016911692169316941695169644 unmodified lines1741174217431744174517461747174817491750139 unmodified lineshome_url: str # insurer's main website (manually curated, verified)policy_count: intsample_policies: list[PolicyEntry]# KI-141 (2026-05-15) — backward-compatible default empty. Per-product# alias list isn't actually surfaced on the coverage card today, but the# field is mirrored from MarketplacePolicy so callers that union the two# endpoints see a consistent schema. Total aliases collapsed into this# insurer's parents — useful for QA + future UI surfacing.alias_count: int = 0class CoverageResponse(BaseModel):411 unmodified lines"national-insurance": ("National Insurance Company", "https://nationalinsurance.nic.co.in/"),"new-india": ("New India Assurance", "https://www.newindia.co.in/"),"niva-bupa": ("Niva Bupa Health Insurance", "https://www.nivabupa.com/"),"indusind-general": ("IndusInd General Insurance (formerly Reliance General)", "https://www.indusind.com/general-insurance/"),"oriental-insurance": ("Oriental Insurance Company", "https://orientalinsurance.org.in/"),"reliance-general": ("Reliance General Insurance", "https://www.reliancegeneral.co.in/"),"royal-sundaram": ("Royal Sundaram General Insurance", "https://www.royalsundaram.in/"),29 unmodified linesseen_product_keys: set[str] = set()seen_policy_ids: set[str] = set()# KI-141 (2026-05-15) — pre-compute the alias mapping (curated marketing# renames whose source PDF maps to an extracted parent). These curated# entries collapse onto the parent card; they DO NOT count separately.# Same algorithm as /api/policies/all so the totals stay in sync.## KI-142 (2026-05-15, REFACTORED) — UIN-primary invariant: 1 unique UIN# = 1 unique marketplace card. Mirrors the /api/policies/all algorithm# so the coverage policy_count stays in lockstep with the marketplace# card count. See the long-form comment block in that endpoint for the# full algorithm rationale.extracted_stems_cov = {fp.stem for fp in sorted_files}# Phase A — extracted parents claim their UINs first.uin_to_parent_cov: dict[str, str] = {}extracted_uin_cov: dict[str, str] = {}for fp in sorted_files:try:_d = _json.loads(fp.read_text())except Exception:continue_u = _d.get("uin_code")if isinstance(_u, dict):_u = _u.get("value")_u = (_u or "").strip() if isinstance(_u, str) else ""if _u:extracted_uin_cov[fp.stem] = _uuin_to_parent_cov.setdefault(_u, fp.stem)direct_parent_cov: dict[str, str] = {}curated_canonical_ids_cov: list[str] = []# Phase B — walk curated entries deterministically (sorted by policy_id).for curated_pid, cdata in sorted(curated_facts.items()):if curated_pid != cdata.get("policy_id", curated_pid):continueif any(curated_pid.endswith(f"__{dt}")for dt in ("wordings", "brochure", "cis", "prospectus")):continuecurated_canonical_ids_cov.append(curated_pid)curated_uin = cdata.get("uin_code")if isinstance(curated_uin, dict):curated_uin = curated_uin.get("value")curated_uin = (curated_uin or "").strip() if isinstance(curated_uin, str) else ""parent_id: str | None = Noneif curated_uin and curated_uin in uin_to_parent_cov \and uin_to_parent_cov[curated_uin] != curated_pid:parent_id = uin_to_parent_cov[curated_uin]elif curated_uin:uin_to_parent_cov[curated_uin] = curated_pidif parent_id is None:# KI-142 — fall back to source_pdf gate when UIN doesn't match# any prior claimant (curated UIN may be more accurate than# extracted; multi-variant PDFs naturally share one filing).fb_parent = _source_pdf_to_policy_id(cdata.get("_primary_source_pdf"))if fb_parent and fb_parent in extracted_stems_cov and fb_parent != curated_pid:parent_id = fb_parentif parent_id:direct_parent_cov[curated_pid] = parent_id# Phase C — chain-compress (see /api/policies/all for rationale).aliased_curated_ids_cov: set[str] = set()parent_pkey_alias_count: dict[str, int] = {}def _terminal_parent_cov(start: str) -> str | None:seen_chain: set[str] = set()cur = startwhile True:nxt = direct_parent_cov.get(cur)if not nxt:return cur if cur != start else Noneif nxt in seen_chain or nxt == start:return Noneseen_chain.add(nxt)cur = nxtfor curated_pid in curated_canonical_ids_cov:if curated_pid not in direct_parent_cov:continueterminal = _terminal_parent_cov(curated_pid)if not terminal:continueif terminal in extracted_stems_cov:terminal_pkey = _product_key_of_cov(terminal)else:terminal_pkey = terminalaliased_curated_ids_cov.add(curated_pid)parent_pkey_alias_count[terminal_pkey] = parent_pkey_alias_count.get(terminal_pkey, 0) + 1# by_insurer entries:# products: set of product_keys (matches /api/policies/all card count)# names: ordered dict of policy_NAME -> first product_key (for sample display)# aliases: KI-141 — count of curated marketing-rename entries merged# into this insurer's parent cards (for the alias_count field).# KI-135 (2026-05-15) — track product_keys (not names) for counting so the# ~1 within-insurer policy_name collision (e.g. new-india Floater listed# as both extracted + curated_facts) doesn't collapse the count below the17 unmodified linesname = data.get("policy_name", "") or pidurl = data.get("source_pdf_url", "")if slug not in by_insurer:by_insurer[slug] = {"products": set(), "names": [], "chunks": 0, "aliases": 0}by_insurer[slug]["products"].add(pkey)# KI-141 — accumulate alias count from the pre-passby_insurer[slug]["aliases"] += parent_pkey_alias_count.get(pkey, 0)if name not in by_insurer[slug]["names"]:by_insurer[slug]["names"].append(name)by_insurer[slug]["chunks"] += 18 unmodified linescontinueif any(eid.startswith(curated_pid + "__") for eid in seen_policy_ids):continue# KI-141 — skip curated entries that have already been collapsed into# a pass-1 parent's alias list.if curated_pid in aliased_curated_ids_cov:continueseen_policy_ids.add(curated_pid)slug = data.get("insurer_slug", "")if slug == "regulatory":7 unmodified linesname = data.get("policy_name", "") or curated_pidurl = data.get("source_pdf_url", "")if slug not in by_insurer:by_insurer[slug] = {"products": set(), "names": [], "chunks": 0, "aliases": 0}by_insurer[slug]["products"].add(pkey)# KI-142 — accumulate alias count for curated parents (curated entries# that themselves became the claimant of a new UIN, with later curated# siblings aliasing onto them).by_insurer[slug]["aliases"] += parent_pkey_alias_count.get(pkey, 0)if name not in by_insurer[slug]["names"]:by_insurer[slug]["names"].append(name)by_insurer[slug]["chunks"] += 125 unmodified lineshome_url=home_url,policy_count=product_count,sample_policies=sample_entries,alias_count=info.get("aliases", 0),))387 unmodified linesmaternity_coverage: Optional[bool] = Nonecashless_treatment_supported: Optional[bool] = Noneroom_rent_capping: Optional[str] = None# KI-141 (2026-05-15) — marketing-rename aliases that share the same# source PDF (e.g. "Activ One" and "Activ Health" both point to the# activ-health-individual__wordings.pdf parent). Default empty list so# the field is backward-compatible. Frontend renders these as small# "Also known as: X, Y" sub-labels under the parent card title.aliases: list[str] = Field(default_factory=list)class MarketplaceResponse(BaseModel):72 unmodified lines`{field: {value, source_pdf_path, source_quote}}` shape. We unwrap to aflat `{field: value}` dict for the marketplace endpoint, preserving theprovenance in a `_facts_provenance` field for transparency.KI-141 (2026-05-15) — also computes `_primary_source_pdf`, the most-common`source_pdf_path` across this curated entry's fields. Used by both/api/policies/all and /api/coverage to alias-merge marketing-renamecurated entries into their extracted-JSON parent card."""import json as _jsonfrom collections import Counterfacts: dict[str, dict] = {}facts_dir = settings.CORPUS_DIR.parent.parent / "40-data" / "policy_facts"if not facts_dir.exists():6 unmodified linespolicy_id = d.get("policy_id") or f.stemflat: dict = {}provenance: dict = {}all_source_pdfs: list[str] = []for k, v in d.items():if k.startswith("_") or k in ("policy_id", "policy_name", "insurer_slug"):flat[k] = v6 unmodified lines"source_quote": v.get("source_quote"),"source_url": v.get("source_url"),}if v.get("source_pdf_path"):all_source_pdfs.append(v["source_pdf_path"])else:flat[k] = vflat["_facts_provenance"] = provenance# KI-141 — pick the most-common source PDF path as this curated# entry's "primary source". When this path's extracted-JSON parent# already exists, the marketplace collapses this curated entry into# the parent's aliases list instead of emitting a separate card.flat["_primary_source_pdf"] = (Counter(all_source_pdfs).most_common(1)[0][0]if all_source_pdfs else None)# Try a couple of policy_id permutations to maximise lookup hit ratefacts[policy_id] = flat# Some extracted JSONs use `_wordings` suffix; the curated files don't3 unmodified linesreturn factsdef _source_pdf_to_policy_id(pdf_path: str | None) -> str | None:"""KI-141 — map a curated `source_pdf_path` like'rag/corpus/aditya-birla/activ-health-individual__wordings.pdf' to theextracted-JSON policy_id 'aditya-birla__activ-health-individual__wordings'.Returns None if the input is empty/None."""if not pdf_path:return Nones = pdf_pathif s.startswith("rag/corpus/"):s = s[len("rag/corpus/"):]if s.endswith(".pdf"):s = s[: -len(".pdf")]return s.replace("/", "__")def _merge_curated(extracted: dict, curated: dict | None) -> dict:"""Curated facts override LLM extraction for every field they populate.LLM extraction fills the long tail. Provenance pointers survive in the56 unmodified lines"national-insurance": ("National Insurance Company", "https://nationalinsurance.nic.co.in/"),"new-india": ("New India Assurance", "https://www.newindia.co.in/"),"niva-bupa": ("Niva Bupa Health Insurance", "https://www.nivabupa.com/"),"indusind-general": ("IndusInd General Insurance (formerly Reliance General)", "https://www.indusind.com/general-insurance/"),"oriental-insurance": ("Oriental Insurance Company", "https://orientalinsurance.org.in/"),"reliance-general": ("Reliance General Insurance", "https://www.reliancegeneral.co.in/"),"royal-sundaram": ("Royal Sundaram General Insurance", "https://www.royalsundaram.in/"),36 unmodified lineskey=lambda fp: (_DOCTYPE_RANK.get(_doctype_of(fp.stem), 99), fp.stem),)# KI-141 (2026-05-15) — alias-dedup pre-pass. Curated "marketing rename"# entries that re-describe the SAME IRDAI-filed product collapse onto a# single marketplace card; the marketing names surface as `aliases`.## KI-142 (2026-05-15, REFACTORED) — UIN-primary invariant: 1 unique UIN# = 1 unique marketplace card. The PDF-based gate is now a fallback for# entries that lack a UIN.## Algorithm (two phases so PDF-backed extracted entries always claim# their UIN before any curated rename does):# Phase A: walk extracted/*.json (sorted by doctype rank, then stem).# Each extracted parent claims its uin_code into `uin_to_parent`.# Phase B: walk curated_facts (sorted by policy_id for determinism).# For each canonical curated entry (skip lookup-permutation aliases# and entries that ARE __wordings/__brochure/__cis themselves):# 1. Read curated UIN (scalar OR nested .value form).# 2. If UIN non-empty AND already in `uin_to_parent` (claimant !=# self) → alias of that parent.# 3. Else if UIN non-empty → claim it (so subsequent curated# siblings with the same UIN alias onto THIS entry in pass 2).# 4. Else (UIN empty) OR (UIN had no prior claimant) → fall back# to the source_pdf gate: if `_primary_source_pdf` maps to an# extracted parent stem, alias under that parent.# 5. Otherwise the curated entry stays as a standalone card.## Multi-variant wordings PDFs with a single filed UIN (e.g.# manipalcigna prohealth-insurance-all-variants.pdf — the PDF text# confirms only ONE UIN `MCIHLIP24011V072324` is filed for that# product) correctly collapse all sub-product curated entries onto one# card. Distinct-UIN siblings under a shared PDF would surface as# separate cards because their UINs claim independent parents.extracted_stems = {fp.stem for fp in sorted_files}# Phase A — extracted parents claim their UINs first.uin_to_parent: dict[str, str] = {}extracted_uin: dict[str, str] = {} # kept for downstream introspectionfor fp in sorted_files:try:_d = _json.loads(fp.read_text())except Exception:continue_u = _d.get("uin_code")if isinstance(_u, dict):_u = _u.get("value")_u = (_u or "").strip() if isinstance(_u, str) else ""if _u:extracted_uin[fp.stem] = _uuin_to_parent.setdefault(_u, fp.stem)# Direct-parent map for each curated entry (built in Phase B), then# chain-compressed in Phase C so transitive aliases (e.g. activ-one →# activ-health → activ-health-individual__wordings) flatten onto the# ultimate extracted parent.direct_parent: dict[str, str] = {}curated_canonical_ids: list[str] = []# Phase B — walk curated entries deterministically (sorted by policy_id).for curated_policy_id, cdata in sorted(curated_facts.items()):# Skip the __wordings/__brochure/__cis lookup-permutation aliases# that _load_curated_facts adds for hit-rate (canonical policy_id is# stored in the JSON's "policy_id" field).if curated_policy_id != cdata.get("policy_id", curated_policy_id):continue# Skip curated entries that ARE their own __wordings/__brochure/__cis# (doctype-permutation curated files, not marketing renames; pass-2# dedup handles them via the seen_policy_ids prefix check).if any(curated_policy_id.endswith(f"__{dt}")for dt in ("wordings", "brochure", "cis", "prospectus")):continuecurated_canonical_ids.append(curated_policy_id)# Read curated UIN (scalar OR nested {value, source_pdf_path, ...}).curated_uin = cdata.get("uin_code")if isinstance(curated_uin, dict):curated_uin = curated_uin.get("value")curated_uin = (curated_uin or "").strip() if isinstance(curated_uin, str) else ""parent_id: str | None = Noneif curated_uin and curated_uin in uin_to_parent \and uin_to_parent[curated_uin] != curated_policy_id:# UIN-primary path: collapse onto the prior claimant of this UIN# (different policy_name same regulator filing = pure rename).parent_id = uin_to_parent[curated_uin]elif curated_uin:# New UIN — this curated entry becomes the claimant so any# later curated sibling with the same UIN aliases onto it.uin_to_parent[curated_uin] = curated_policy_idif parent_id is None and not curated_uin:# KI-142 (user rule, 2026-05-15): source-PDF fallback only fires# when the curated entry has NO UIN at all. If UIN exists but# doesn't match any extracted parent, they're different# regulator-filed products and must stay as separate cards —# source-PDF coincidence (multi-variant wordings) does NOT merge.fb_parent = _source_pdf_to_policy_id(cdata.get("_primary_source_pdf"))if fb_parent and fb_parent in extracted_stems and fb_parent != curated_policy_id:parent_id = fb_parentif parent_id:direct_parent[curated_policy_id] = parent_id# Phase C — chain-compress direct_parent so every curated alias points# at its terminal parent (an extracted stem, or a curated parent that# itself has no parent). Detect cycles defensively. After compression# we emit one alias entry per curated descendant onto the terminal# parent's product_key.parent_pkey_aliases: dict[str, list[str]] = {}aliased_curated_ids: set[str] = set()def _terminal_parent(start: str) -> str | None:"""Walk direct_parent until we hit an extracted stem or a curated idwith no further parent. Returns None on cycle (defensive)."""seen_chain: set[str] = set()cur = startwhile True:nxt = direct_parent.get(cur)if not nxt:return cur if cur != start else Noneif nxt in seen_chain or nxt == start:return None # cycle — drop the alias attemptseen_chain.add(nxt)cur = nxtfor curated_policy_id in curated_canonical_ids:if curated_policy_id not in direct_parent:continueterminal = _terminal_parent(curated_policy_id)if not terminal:continue# Alias-target product_key: extracted stems use _product_key_of()# (strips __doctype). Curated terminals use the policy_id directly.if terminal in extracted_stems:terminal_pkey = _product_key_of(terminal)else:terminal_pkey = terminalalias_name = (curated_facts.get(curated_policy_id, {}).get("policy_name")or curated_policy_id)parent_pkey_aliases.setdefault(terminal_pkey, []).append(alias_name)aliased_curated_ids.add(curated_policy_id)seen_product_keys: set[str] = set()seen_policy_ids: set[str] = set()out = []72 unmodified linesmaternity_coverage=_coerce_bool(data.get("maternity_coverage")),cashless_treatment_supported=_coerce_bool(data.get("cashless_treatment_supported")),room_rent_capping=data.get("room_rent_capping") if isinstance(data.get("room_rent_capping"), str) else None,# KI-141 — merge marketing-rename curated entries onto this# parent card. Sorted for deterministic output.aliases=sorted(parent_pkey_aliases.get(product_key, [])),))except Exception as e:# One malformed extraction should not kill the whole feed13 unmodified lines# Also skip if any extracted ID matches with a suffixif any(eid.startswith(curated_policy_id + "__") for eid in seen_policy_ids):continue# KI-141 — skip curated entries that have already been collapsed onto# a pass-1 parent card via the aliases mechanism (e.g. Activ One →# Activ Health Individual Wordings).if curated_policy_id in aliased_curated_ids:continueseen_policy_ids.add(curated_policy_id)slug = data.get("insurer_slug", "")name, home = insurer_meta.get(slug, (slug, ""))44 unmodified linesmaternity_coverage=_coerce_bool(data.get("maternity_coverage")),cashless_treatment_supported=_coerce_bool(data.get("cashless_treatment_supported")),room_rent_capping=data.get("room_rent_capping") if isinstance(data.get("room_rent_capping"), str) else None,# KI-142 — curated entries can ALSO be UIN-claimants when no# extracted parent owns their UIN. In that case their later# curated siblings alias onto them and surface here.aliases=sorted(parent_pkey_aliases.get(curated_policy_id, [])),))except Exception as e:print(f"[marketplace] skipping curated {curated_policy_id}: {type(e).__name__}: {str(e)[:120]}")
72 unmodified lines737475767778125 unmodified lines2042052062072082097 unmodified lines217218219220221222253 unmodified lines47647747847948048172 unmodified lines)def _phrase_present(phrase: str, q: str) -> bool:"""Word-boundary phrase match. KI-023 (2026-05-14) — replaces naivesubstring matching that incorrectly tripped triggers like "hi" on words125 unmodified linesprofile_is_empty: bool,in_fact_find_continuation: bool,free_form_session: bool,) -> bool:"""Pure decision function for the fact-find routing branch.7 unmodified linesif in_fact_find_continuation:return Trueif profile_is_empty and intent in CONTEXT_DEPENDENT_INTENTS:return Truereturn False253 unmodified linesprofile_is_empty=profile_is_empty,in_fact_find_continuation=in_fact_find_continuation,free_form_session=session.free_form_session,)if treat_as_fact_find:72 unmodified lines737475767778798081828384858687888990919293949596979899100101102103104125 unmodified lines2302312322332342352367 unmodified lines244245246247248249250251252253253 unmodified lines50750850951051151251372 unmodified lines)# KI-136 (2026-05-15) — named-SKU detector. Comparisons that name >=2# specific insurers/policies are policy-fact lookups, not profile-dependent# recommendations — same carve-out spirit as KI-018 for qa intent._NAMED_INSURER_TOKENS = ("hdfc ergo", "niva bupa", "star health", "care health", "icici lombard","bajaj allianz", "tata aig", "aditya birla", "manipal cigna", "sbi general","new india", "national insurance", "oriental insurance", "united india","reliance general", "go digit", "iffco tokio", "raheja qbe","cholamandalam", "acko", "royal sundaram",# Common product names"optima secure", "optima restore", "aspire", "activ assure", "activ one","activ health", "health companion", "young star", "senior citizen red carpet","arogya sanjeevani", "reassure", "health guard", "prohealth", "elevate","medicare", "criti", "saral suraksha", "comprehensive care",)def _names_two_specific_policies(q: str) -> bool:"""KI-136 — return True if the user's text mentions >=2 named SKUs/insurers,indicating a policy-fact lookup rather than a profile-dependentrecommendation."""ql = q.lower()hits = sum(1 for tok in _NAMED_INSURER_TOKENS if tok in ql)return hits >= 2def _phrase_present(phrase: str, q: str) -> bool:"""Word-boundary phrase match. KI-023 (2026-05-14) — replaces naivesubstring matching that incorrectly tripped triggers like "hi" on words125 unmodified linesprofile_is_empty: bool,in_fact_find_continuation: bool,free_form_session: bool,query: str = "",) -> bool:"""Pure decision function for the fact-find routing branch.7 unmodified linesif in_fact_find_continuation:return Trueif profile_is_empty and intent in CONTEXT_DEPENDENT_INTENTS:# KI-136 (2026-05-15) — exempt named-SKU comparisons. They're policy-fact# lookups (route to qa), not profile-dependent recommendations.if intent == "comparison" and _names_two_specific_policies(query):return Falsereturn Truereturn False253 unmodified linesprofile_is_empty=profile_is_empty,in_fact_find_continuation=in_fact_find_continuation,free_form_session=session.free_form_session,query=user_text,)if treat_as_fact_find:
1950 unmodified lines1951195219531954195519561957363 unmodified lines2321232223232324232523261950 unmodified linesconst insurers = Array.from(new Set(data.policies.map((p) => p.insurer_slug))).sort();const filtered = data.policies.filter((p) => {if (search && !p.policy_name.toLowerCase().includes(search.toLowerCase()) && !p.insurer_name.toLowerCase().includes(search.toLowerCase())) return false;if (insurerFilter !== "all" && p.insurer_slug !== insurerFilter) return false;if (grade !== "all" && p.grade !== grade) return false;if (p.pre_existing_disease_waiting_months && p.pre_existing_disease_waiting_months > maxPED) return false;363 unmodified lines<div className="flex-1 min-w-0"><div className="text-xs text-[var(--muted-foreground)] truncate">{policy.insurer_name}</div><div className="font-semibold text-sm truncate group-hover:text-[var(--primary)] transition">{policy.policy_name}</div></div>{/* Score badge ONLY when we have a profile — otherwise CTA pill */}{isPersonalized ? (1950 unmodified lines19511952195319541955195619571958195919601961363 unmodified lines232523262327232823292330233123322333233423351950 unmodified linesconst insurers = Array.from(new Set(data.policies.map((p) => p.insurer_slug))).sort();const filtered = data.policies.filter((p) => {if (search) {const q = search.toLowerCase();const aliasHit = (p.aliases || []).some((a) => a.toLowerCase().includes(q));if (!p.policy_name.toLowerCase().includes(q) && !p.insurer_name.toLowerCase().includes(q) && !aliasHit) return false;}if (insurerFilter !== "all" && p.insurer_slug !== insurerFilter) return false;if (grade !== "all" && p.grade !== grade) return false;if (p.pre_existing_disease_waiting_months && p.pre_existing_disease_waiting_months > maxPED) return false;363 unmodified lines<div className="flex-1 min-w-0"><div className="text-xs text-[var(--muted-foreground)] truncate">{policy.insurer_name}</div><div className="font-semibold text-sm truncate group-hover:text-[var(--primary)] transition">{policy.policy_name}</div>{policy.aliases && policy.aliases.length > 0 && (<div className="text-xs text-slate-500 italic mt-0.5 truncate">Also marketed as: {policy.aliases.join(", ")}</div>)}</div>{/* Score badge ONLY when we have a profile — otherwise CTA pill */}{isPersonalized ? (
273 unmodified lines274275276277278279273 unmodified linesexport type MarketplacePolicy = {policy_id: string;policy_name: string;insurer_slug: string;insurer_name: string;insurer_home_url: string;273 unmodified lines274275276277278279280273 unmodified linesexport type MarketplacePolicy = {policy_id: string;policy_name: string;aliases?: string[];insurer_slug: string;insurer_name: string;insurer_home_url: string;