Spaces:
Runtime error
Runtime error
Update analysis.py
Browse files- analysis.py +10 -1
analysis.py
CHANGED
@@ -164,7 +164,16 @@ async def analyze_patient(patient: dict):
|
|
164 |
return
|
165 |
|
166 |
# Generate analysis
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
message = (
|
169 |
"You are a clinical decision support AI.\n\n"
|
170 |
"Given the patient document below:\n"
|
|
|
164 |
return
|
165 |
|
166 |
# Generate analysis
|
167 |
+
# Custom JSON encoder to handle datetime objects
|
168 |
+
class DateTimeEncoder(json.JSONEncoder):
|
169 |
+
def default(self, obj):
|
170 |
+
if isinstance(obj, datetime):
|
171 |
+
return obj.isoformat()
|
172 |
+
elif hasattr(obj, '__dict__'):
|
173 |
+
return obj.__dict__
|
174 |
+
return super().default(obj)
|
175 |
+
|
176 |
+
doc = json.dumps(serialized, indent=2, cls=DateTimeEncoder)
|
177 |
message = (
|
178 |
"You are a clinical decision support AI.\n\n"
|
179 |
"Given the patient document below:\n"
|