"""Close-gate verification for HCC module."""
from starguard_core.hcc import (
    compute_raf_batch,
    identify_chronic_gaps,
    compute_revenue_opportunity,
    default_hcc_scenario,
)

profiles = default_hcc_scenario()
raf_results = compute_raf_batch(profiles)
gaps = []
for p in profiles:
    gaps.extend(identify_chronic_gaps(p))
summary = compute_revenue_opportunity(raf_results, gaps)
print("HCC module live")
print(f"   RAF avg:     {summary['average_raf_score']}")
print(f"   Gaps found:  {summary['total_gaps_identified']}")
print(f"   Opportunity: ${summary['net_opportunity_usd']:,.2f}")
print(f"   Narrative:   {summary['demo_narrative'].encode('ascii', 'replace').decode()}")
