Spaces:
Sleeping
fix(api): KI-132 — drop regulatory from /api/policies/all + complete insurer_meta
Browse filesAfter KI-130 fixed /api/coverage, the marketplace pane STILL showed:
• '224 policies from 20 leading Indian health insurers'
• Dropdown listing 'regulatory (13)' as a fake 20th insurer
• 9 of 19 insurer cards rendering raw slugs (cholamandalam, national-insurance,
sbi-general, royal-sundaram, oriental-insurance, iffco-tokio, go-digit,
reliance-general, acko) instead of proper display names
Root cause: I patched /api/coverage in KI-130 but missed /api/policies/all,
which is a SEPARATE endpoint that backs the marketplace pane copy + filter
dropdown + card list. The two endpoints had independent insurer_meta dicts,
both with only 10 of 19 real insurers populated.
Fix:
• Add 'if slug == "regulatory": continue' in the /api/policies/all
iteration loop (backend/main.py L1192) so regulatory JSONs (13 of 224)
don't generate marketplace cards.
• Expand insurer_meta in /api/policies/all to all 19 real insurers with
curated display names + home URLs.
• Apply the same expansion to /api/coverage's insurer_meta for consistency
so the deep-dive insurer view also gets proper names.
Verified on localhost after restart:
/api/policies/all -> total=209 (was 224), insurers_indexed=19 (was 20),
has regulatory=False, all 19 slugs render proper display names.
Marketplace UI will now read '209 policies from 19 leading Indian health
insurers' (matches the badge philosophy if not the exact 138 count — that's
because /api/policies/all is one card per PDF / extracted JSON, while
/api/coverage's 138 is one entry per unique policy_NAME). Both are now
regulatory-free and slug-name-clean.
Regulatory PDFs continue to be retrieved + cited in chat answers — they're
just not surfaced in the marketplace.
- backend/main.py +52 -22
|
@@ -540,19 +540,30 @@ async def coverage():
|
|
| 540 |
total = 0
|
| 541 |
|
| 542 |
# Insurer metadata — names + home URLs are curated + verified
|
| 543 |
-
# (see eval/verified_urls.json + tools/verify_urls.py)
|
|
|
|
|
|
|
| 544 |
insurer_meta = {
|
| 545 |
-
"
|
| 546 |
-
"
|
| 547 |
-
"
|
| 548 |
-
"
|
| 549 |
-
"
|
| 550 |
-
"
|
| 551 |
-
"
|
| 552 |
-
"
|
| 553 |
-
"
|
| 554 |
-
"
|
| 555 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 556 |
}
|
| 557 |
|
| 558 |
# policy -> source_url (verified at download time)
|
|
@@ -1154,17 +1165,31 @@ async def policies_all(session_id: Optional[str] = None):
|
|
| 1154 |
corpus_url_index = _build_corpus_url_index()
|
| 1155 |
curated_facts = _load_curated_facts()
|
| 1156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1157 |
insurer_meta = {
|
| 1158 |
-
"
|
| 1159 |
-
"
|
| 1160 |
-
"
|
| 1161 |
-
"
|
| 1162 |
-
"
|
| 1163 |
-
"
|
| 1164 |
-
"
|
| 1165 |
-
"
|
| 1166 |
-
"
|
| 1167 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1168 |
}
|
| 1169 |
|
| 1170 |
def _coerce_bool(v):
|
|
@@ -1190,6 +1215,11 @@ async def policies_all(session_id: Optional[str] = None):
|
|
| 1190 |
data = _merge_curated(data, curated_for_this)
|
| 1191 |
seen_policy_ids.add(policy_id_local)
|
| 1192 |
slug = data.get("insurer_slug", "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1193 |
name, home = insurer_meta.get(slug, (slug, ""))
|
| 1194 |
# Get insurer reviews if available for the scorecard
|
| 1195 |
ir = None
|
|
|
|
| 540 |
total = 0
|
| 541 |
|
| 542 |
# Insurer metadata — names + home URLs are curated + verified
|
| 543 |
+
# (see eval/verified_urls.json + tools/verify_urls.py).
|
| 544 |
+
# KI-132 (2026-05-15) — expanded to all 19 real insurers so /api/coverage
|
| 545 |
+
# also returns proper display names (was 10 of 19).
|
| 546 |
insurer_meta = {
|
| 547 |
+
"acko": ("Acko Health Insurance", "https://www.acko.com/health-insurance/"),
|
| 548 |
+
"aditya-birla": ("Aditya Birla Health Insurance", "https://www.adityabirlacapital.com/healthinsurance"),
|
| 549 |
+
"bajaj-allianz": ("Bajaj Allianz General Insurance", "https://www.bajajallianz.com/"),
|
| 550 |
+
"care-health": ("Care Health Insurance", "https://www.careinsurance.com/"),
|
| 551 |
+
"cholamandalam": ("Cholamandalam MS General Insurance", "https://www.cholainsurance.com/"),
|
| 552 |
+
"go-digit": ("Go Digit General Insurance", "https://www.godigit.com/"),
|
| 553 |
+
"hdfc-ergo": ("HDFC ERGO General Insurance", "https://www.hdfcergo.com/"),
|
| 554 |
+
"icici-lombard": ("ICICI Lombard General Insurance", "https://www.icicilombard.com/"),
|
| 555 |
+
"iffco-tokio": ("IFFCO Tokio General Insurance", "https://www.iffcotokio.co.in/"),
|
| 556 |
+
"manipalcigna": ("ManipalCigna Health Insurance", "https://www.manipalcigna.com/"),
|
| 557 |
+
"national-insurance": ("National Insurance Company", "https://nationalinsurance.nic.co.in/"),
|
| 558 |
+
"new-india": ("New India Assurance", "https://www.newindia.co.in/"),
|
| 559 |
+
"niva-bupa": ("Niva Bupa Health Insurance", "https://www.nivabupa.com/"),
|
| 560 |
+
"oriental-insurance": ("Oriental Insurance Company", "https://orientalinsurance.org.in/"),
|
| 561 |
+
"reliance-general": ("Reliance General Insurance", "https://www.reliancegeneral.co.in/"),
|
| 562 |
+
"royal-sundaram": ("Royal Sundaram General Insurance", "https://www.royalsundaram.in/"),
|
| 563 |
+
"sbi-general": ("SBI General Insurance", "https://www.sbigeneral.in/"),
|
| 564 |
+
"star-health": ("Star Health & Allied Insurance", "https://www.starhealth.in/"),
|
| 565 |
+
"tata-aig": ("Tata AIG General Insurance", "https://www.tataaig.com/"),
|
| 566 |
+
"user-upload": ("Your uploaded policies", ""),
|
| 567 |
}
|
| 568 |
|
| 569 |
# policy -> source_url (verified at download time)
|
|
|
|
| 1165 |
corpus_url_index = _build_corpus_url_index()
|
| 1166 |
curated_facts = _load_curated_facts()
|
| 1167 |
|
| 1168 |
+
# KI-132 (2026-05-15) — expanded insurer_meta to cover all 19 real
|
| 1169 |
+
# insurers. Previously only 10 had curated display-names + home URLs,
|
| 1170 |
+
# so 9 insurers rendered as raw slugs in the marketplace dropdown
|
| 1171 |
+
# (acko, cholamandalam, go-digit, iffco-tokio, national-insurance,
|
| 1172 |
+
# oriental-insurance, reliance-general, royal-sundaram, sbi-general).
|
| 1173 |
insurer_meta = {
|
| 1174 |
+
"acko": ("Acko Health Insurance", "https://www.acko.com/health-insurance/"),
|
| 1175 |
+
"aditya-birla": ("Aditya Birla Health Insurance", "https://www.adityabirlacapital.com/healthinsurance"),
|
| 1176 |
+
"bajaj-allianz": ("Bajaj Allianz General Insurance", "https://www.bajajallianz.com/"),
|
| 1177 |
+
"care-health": ("Care Health Insurance", "https://www.careinsurance.com/"),
|
| 1178 |
+
"cholamandalam": ("Cholamandalam MS General Insurance", "https://www.cholainsurance.com/"),
|
| 1179 |
+
"go-digit": ("Go Digit General Insurance", "https://www.godigit.com/"),
|
| 1180 |
+
"hdfc-ergo": ("HDFC ERGO General Insurance", "https://www.hdfcergo.com/"),
|
| 1181 |
+
"icici-lombard": ("ICICI Lombard General Insurance", "https://www.icicilombard.com/"),
|
| 1182 |
+
"iffco-tokio": ("IFFCO Tokio General Insurance", "https://www.iffcotokio.co.in/"),
|
| 1183 |
+
"manipalcigna": ("ManipalCigna Health Insurance", "https://www.manipalcigna.com/"),
|
| 1184 |
+
"national-insurance": ("National Insurance Company", "https://nationalinsurance.nic.co.in/"),
|
| 1185 |
+
"new-india": ("New India Assurance", "https://www.newindia.co.in/"),
|
| 1186 |
+
"niva-bupa": ("Niva Bupa Health Insurance", "https://www.nivabupa.com/"),
|
| 1187 |
+
"oriental-insurance": ("Oriental Insurance Company", "https://orientalinsurance.org.in/"),
|
| 1188 |
+
"reliance-general": ("Reliance General Insurance", "https://www.reliancegeneral.co.in/"),
|
| 1189 |
+
"royal-sundaram": ("Royal Sundaram General Insurance", "https://www.royalsundaram.in/"),
|
| 1190 |
+
"sbi-general": ("SBI General Insurance", "https://www.sbigeneral.in/"),
|
| 1191 |
+
"star-health": ("Star Health & Allied Insurance", "https://www.starhealth.in/"),
|
| 1192 |
+
"tata-aig": ("Tata AIG General Insurance", "https://www.tataaig.com/"),
|
| 1193 |
}
|
| 1194 |
|
| 1195 |
def _coerce_bool(v):
|
|
|
|
| 1215 |
data = _merge_curated(data, curated_for_this)
|
| 1216 |
seen_policy_ids.add(policy_id_local)
|
| 1217 |
slug = data.get("insurer_slug", "")
|
| 1218 |
+
# KI-132 (2026-05-15) — regulatory is not an insurer; drop entirely
|
| 1219 |
+
# from the marketplace. IRDAI/NHA docs are still retrieved and cited
|
| 1220 |
+
# in chat answers, they just don't appear as marketplace cards.
|
| 1221 |
+
if slug == "regulatory":
|
| 1222 |
+
continue
|
| 1223 |
name, home = insurer_meta.get(slug, (slug, ""))
|
| 1224 |
# Get insurer reviews if available for the scorecard
|
| 1225 |
ir = None
|