feat: add health consultation report pipeline

This commit is contained in:
Jesse_Chen
2026-09-03 23:57:27 +08:00
parent 0be6fcfb4c
commit c2f23131f7
17 changed files with 277 additions and 25 deletions
@@ -87,6 +87,24 @@ def compact_timing_narrative(modules: dict | None) -> dict[str, Any]:
}
def compact_health_narrative(modules: dict | None, chart: dict | None = None) -> dict[str, Any]:
"""Length-capped non-medical health seed for the commercial prompt pack."""
try:
engine = _load_engine()
payload = engine._build_health_narrative_payload(modules, chart)
except Exception as exc:
return {"status": "blocked", "reason": f"health_narrative_unavailable:{exc.__class__.__name__}"}
if not isinstance(payload, dict):
return {"status": "blocked", "reason": "health_narrative_unavailable"}
return {
"status": "parameter_sensitive",
"headline": _clip_text(payload.get("headline"), _HEADLINE_MAX),
"strengths": _clip_lines(payload.get("strengths")),
"risks": _clip_lines(payload.get("risks")),
"boundaries": _clip_lines(payload.get("boundaries")),
}
def compact_planetary_friendship(snapshot: dict | None) -> dict[str, Any]:
if not isinstance(snapshot, dict):
return {"status": "blocked", "reason": "planetary_friendship_unavailable", "rows": []}