Spaces:
Sleeping
Sleeping
Akis Giannoukos
commited on
Commit
·
8b938f4
1
Parent(s):
e8b82b0
Refactor summary formatting in patient and clinician summaries to improve readability and consistency.
Browse files
app.py
CHANGED
|
@@ -298,9 +298,9 @@ def build_patient_summary(chat_history: List[Tuple[str, str]], meta: Dict[str, A
|
|
| 298 |
total = meta.get("Total_Score") or display_json.get("Total_Score")
|
| 299 |
transcript_text = transcript_to_text(chat_history)
|
| 300 |
return (
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
f"
|
| 304 |
)
|
| 305 |
|
| 306 |
|
|
@@ -314,14 +314,14 @@ def build_clinician_summary(chat_history: List[Tuple[str, str]], meta: Dict[str,
|
|
| 314 |
scores_lines = "\n".join([f"- {k}: {v}" for k, v in scores.items()])
|
| 315 |
conf_str = ", ".join([f"{c:.2f}" for c in confidences]) if confidences else ""
|
| 316 |
return (
|
| 317 |
-
|
| 318 |
f"- Severity: **{severity}** \n"
|
| 319 |
f"- PHQ‑9 Total: **{total}** \n"
|
| 320 |
f"- High Risk: **{risk}**\n\n"
|
| 321 |
f"#### Item Scores\n{scores_lines}\n\n"
|
| 322 |
f"#### Item Confidences\n{conf_str}\n\n"
|
| 323 |
-
|
| 324 |
-
f"
|
| 325 |
)
|
| 326 |
|
| 327 |
def generate_recording_agent_reply(chat_history: List[Tuple[str, str]]) -> str:
|
|
|
|
| 298 |
total = meta.get("Total_Score") or display_json.get("Total_Score")
|
| 299 |
transcript_text = transcript_to_text(chat_history)
|
| 300 |
return (
|
| 301 |
+
"### Summary for You\n\n"
|
| 302 |
+
"Thank you for your time. Here is a copy of our conversation so you can review it later.\n\n"
|
| 303 |
+
f"```\n{transcript_text}\n```"
|
| 304 |
)
|
| 305 |
|
| 306 |
|
|
|
|
| 314 |
scores_lines = "\n".join([f"- {k}: {v}" for k, v in scores.items()])
|
| 315 |
conf_str = ", ".join([f"{c:.2f}" for c in confidences]) if confidences else ""
|
| 316 |
return (
|
| 317 |
+
"### Clinician Summary\n\n"
|
| 318 |
f"- Severity: **{severity}** \n"
|
| 319 |
f"- PHQ‑9 Total: **{total}** \n"
|
| 320 |
f"- High Risk: **{risk}**\n\n"
|
| 321 |
f"#### Item Scores\n{scores_lines}\n\n"
|
| 322 |
f"#### Item Confidences\n{conf_str}\n\n"
|
| 323 |
+
"#### Conversation Transcript\n\n"
|
| 324 |
+
f"```\n{transcript_text}\n```"
|
| 325 |
)
|
| 326 |
|
| 327 |
def generate_recording_agent_reply(chat_history: List[Tuple[str, str]]) -> str:
|