feat: add health consultation report pipeline
This commit is contained in:
@@ -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": []}
|
||||
|
||||
Reference in New Issue
Block a user