V7
Browse files- src/report_generator.py +19 -4
src/report_generator.py
CHANGED
@@ -16,7 +16,7 @@ import requests
|
|
16 |
|
17 |
from model import orchestrator_chat
|
18 |
from utils import format_conversation_history
|
19 |
-
from
|
20 |
|
21 |
|
22 |
# Function to fetch current date and time from an API
|
@@ -109,9 +109,24 @@ def extract_medical_json(conversation_text: str) -> dict:
|
|
109 |
Extract medical report data from conversation text into structured JSON.
|
110 |
Uses the existing orchestrator_chat model.
|
111 |
"""
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
# Create a fake history with the system prompt as a system message
|
116 |
history = [
|
117 |
{"role": "system", "content": system_prompt}
|
|
|
16 |
|
17 |
from model import orchestrator_chat
|
18 |
from utils import format_conversation_history
|
19 |
+
from session_state import get_full_history
|
20 |
|
21 |
|
22 |
# Function to fetch current date and time from an API
|
|
|
109 |
Extract medical report data from conversation text into structured JSON.
|
110 |
Uses the existing orchestrator_chat model.
|
111 |
"""
|
112 |
+
system_prompt = """
|
113 |
+
You are an expert medical report generator. Extract ALL info from the patient-assistant conversation into this JSON schema:
|
114 |
+
{
|
115 |
+
"patient": {"name":"","age":"","gender":""},
|
116 |
+
"visit_date":"YYYY-MM-DD",
|
117 |
+
"chief_complaint":"",
|
118 |
+
"history_of_present_illness":"",
|
119 |
+
"past_medical_history":"",
|
120 |
+
"medications":"",
|
121 |
+
"allergies":"",
|
122 |
+
"examination":"",
|
123 |
+
"diagnosis":"",
|
124 |
+
"recommendations":"",
|
125 |
+
"reasoning":"",
|
126 |
+
"sources":""
|
127 |
+
}
|
128 |
+
Do NOT invent any data. Return ONLY the JSON object.
|
129 |
+
"""
|
130 |
# Create a fake history with the system prompt as a system message
|
131 |
history = [
|
132 |
{"role": "system", "content": system_prompt}
|