xiaosuhu86 commited on
Commit
b487b99
·
1 Parent(s): cd0d86b

update: modified a bit to display the user input in console, also added a version with checkpointer

Browse files
Files changed (3) hide show
  1. modules/nodes.py +1 -0
  2. paintrek-chat-v1.ipynb +304 -0
  3. paintrek-chat-v2.ipynb +88 -29
modules/nodes.py CHANGED
@@ -87,6 +87,7 @@ def human_node(state: DataState) -> DataState:
87
  print("Model:", last_msg.content)
88
 
89
  user_input = input("User: ")
 
90
 
91
  # If it looks like the user is trying to quit, flag the conversation
92
  # as over.
 
87
  print("Model:", last_msg.content)
88
 
89
  user_input = input("User: ")
90
+ print("User:", user_input)
91
 
92
  # If it looks like the user is trying to quit, flag the conversation
93
  # as over.
paintrek-chat-v1.ipynb ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "execution": {
8
+ "iopub.execute_input": "2025-01-29T20:09:11.440091Z",
9
+ "iopub.status.busy": "2025-01-29T20:09:11.439766Z",
10
+ "iopub.status.idle": "2025-01-29T20:09:11.751153Z",
11
+ "shell.execute_reply": "2025-01-29T20:09:11.750263Z",
12
+ "shell.execute_reply.started": "2025-01-29T20:09:11.440060Z"
13
+ },
14
+ "id": "xaiioUQni_ga",
15
+ "trusted": true
16
+ },
17
+ "outputs": [],
18
+ "source": [
19
+ "from modules.data_class import DataState\n",
20
+ "from modules.tools import data_node\n",
21
+ "from modules.nodes import chatbot_with_tools, human_node, maybe_exit_human_node, maybe_route_to_tools\n",
22
+ "\n",
23
+ "from langgraph.graph import StateGraph, START, END\n",
24
+ "\n",
25
+ "from IPython.display import Image, display\n",
26
+ "from pprint import pprint\n",
27
+ "from typing import Literal\n",
28
+ "\n",
29
+ "from langgraph.prebuilt import ToolNode\n",
30
+ "\n",
31
+ "from collections.abc import Iterable\n",
32
+ "from IPython.display import display, clear_output\n",
33
+ "import sys"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": null,
39
+ "metadata": {
40
+ "execution": {
41
+ "iopub.execute_input": "2025-01-29T20:09:11.906458Z",
42
+ "iopub.status.busy": "2025-01-29T20:09:11.905241Z",
43
+ "iopub.status.idle": "2025-01-29T20:09:11.994921Z",
44
+ "shell.execute_reply": "2025-01-29T20:09:11.993761Z",
45
+ "shell.execute_reply.started": "2025-01-29T20:09:11.906419Z"
46
+ },
47
+ "id": "9rqkQzlZxrzp",
48
+ "trusted": true
49
+ },
50
+ "outputs": [
51
+ {
52
+ "data": {
53
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAATIAAAFNCAIAAAAM0HSGAAAAAXNSR0IArs4c6QAAIABJREFUeJzt3XdAE2cfB/Ang0DIYoQ9RWSIiFtUVNx7oyjiqKNYd11t1TraOuvAva0DHKAoxYUoDlA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DVpmD2ME9dKOKUcG3ti7zGmaNcCNQjGskniI9lvn3HMnU2MbWho1/KdpFI5K7tSUC3w9WM6eWpzt9RaAMayqQQ82eOIiqJsgT5Nn2pGoZoaqPz5L3UQCSQ1ZbX8Sr6BId69O7WjDzzB0wrAWDaPsFaW/47//gWfz5FWl4tJZALdnCziSdCu6ws4PJCK5GKhTCyQmTuQze3023Wi2LSF/fS0GjCW308qlvO5stoamVyGsXWIA3r6OAqdSKHDmytbJRhLCMIceIEEgjAHxhKCMAfGEoIwB8YSgjAHxhKCMAfGEoIw53/f3ohJ2E1W/QAAAABJRU5ErkJggg==",
54
+ "text/plain": [
55
+ "<IPython.core.display.Image object>"
56
+ ]
57
+ },
58
+ "execution_count": 2,
59
+ "metadata": {},
60
+ "output_type": "execute_result"
61
+ }
62
+ ],
63
+ "source": [
64
+ "graph_builder = StateGraph(DataState)\n",
65
+ "\n",
66
+ "# Nodes\n",
67
+ "graph_builder.add_node(\"chatbot_healthassistant\", chatbot_with_tools)\n",
68
+ "graph_builder.add_node(\"patient\", human_node)\n",
69
+ "graph_builder.add_node(\"documenting\", data_node)\n",
70
+ "\n",
71
+ "# Chatbot -> {ordering, tools, human, END}\n",
72
+ "graph_builder.add_conditional_edges(\"chatbot_healthassistant\", maybe_route_to_tools)\n",
73
+ "# Human -> {chatbot, END}\n",
74
+ "graph_builder.add_conditional_edges(\"patient\", maybe_exit_human_node)\n",
75
+ "# TestCase_Paintrek\n",
76
+ "# Tools (both kinds) always route back to chat afterwards.\n",
77
+ "graph_builder.add_edge(\"documenting\", \"chatbot_healthassistant\")\n",
78
+ "\n",
79
+ "graph_builder.add_edge(START, \"chatbot_healthassistant\")\n",
80
+ "graph_with_order_tools = graph_builder.compile()\n",
81
+ "\n",
82
+ "Image(graph_with_order_tools.get_graph().draw_mermaid_png())"
83
+ ]
84
+ },
85
+ {
86
+ "cell_type": "code",
87
+ "execution_count": null,
88
+ "metadata": {
89
+ "execution": {
90
+ "iopub.execute_input": "2025-01-29T20:09:38.185616Z",
91
+ "iopub.status.busy": "2025-01-29T20:09:38.185131Z",
92
+ "iopub.status.idle": "2025-01-29T20:10:08.474591Z",
93
+ "shell.execute_reply": "2025-01-29T20:10:08.472926Z",
94
+ "shell.execute_reply.started": "2025-01-29T20:09:38.185577Z"
95
+ },
96
+ "id": "NCRSgaBUfIHF",
97
+ "trusted": true
98
+ },
99
+ "outputs": [
100
+ {
101
+ "name": "stdout",
102
+ "output_type": "stream",
103
+ "text": [
104
+ "Executing the chatbot graph...\n",
105
+ "Model: Welcome to the Paintrek world. I am a health assistant, an interactive clinical recording system. I will ask you questions about your pain and related symptoms and record your responses. I will then store this information securely. At any time, you can type `q` to quit.\n",
106
+ "User: Let's start\n",
107
+ "Model: First, I'll need some basic information for identification. What is your full name, date of birth, gender, and contact number? Also, please provide the name and contact information for an emergency contact.\n",
108
+ "User: I am Frank, DOB 1986-01-01, male, phone number is 12345, emergency name is Zoe, number is 67890.\n",
109
+ "Model: Thank you. Now, can you describe your main symptom and how long you've been experiencing it?\n",
110
+ "User: I had a headache, and it started two days ago.\n",
111
+ "Model: Okay. Let's move on to a pain assessment. To help me understand your headache, please tell me:\n",
112
+ "\n",
113
+ "1. Where is the pain located on your head? (e.g., forehead, temple, back of head)\n",
114
+ "2. On which side of your head is the pain located? (left, right, or both)\n",
115
+ "3. On a scale of 0 to 10, with 0 being no pain and 10 being the worst pain imaginable, how intense is your headache right now?\n",
116
+ "4. Can you describe the characteristics of your pain? (e.g., sharp, dull, throbbing, aching)\n",
117
+ "5. When did the headache begin?\n",
118
+ "6. Does the pain radiate to any other areas? If so, where?\n",
119
+ "7. Are there any triggers that seem to make the headache worse?\n",
120
+ "8. Do you have any other symptoms associated with the headache? (e.g., nausea, vomiting, sensitivity to light or sound)\n",
121
+ "\n",
122
+ "Please answer as accurately as possible. Remember, there are no wrong answers.\n",
123
+ "User: My pain is located on the right head, and the scale is 2, the pain is sharp, the pain started 2 days ago, and the pain is not radiating. Cold will trigger the pain, and no other symptoms. \n",
124
+ "Model: Excellent. Now, let's gather some information about your medical history. Do you have any existing medical conditions, allergies, current medications, or a history of surgeries? Please include dates where applicable.\n",
125
+ "User: I had sinus, diagnosed in 2001-01-01, I did not have any surgery. I am taking ibprofin, no allergies.\n",
126
+ "Model: We're making good progress. Next, I need some information about your family medical history, social history, and a brief systems review. Could you tell me about any significant medical conditions in your family? What is your occupation, and are there any lifestyle factors like smoking, alcohol, or drug use that I should be aware of? Also, describe your living situation and support system. Finally, have you experienced any recent changes in your weight, sleep patterns, gastrointestinal or urinary function, or any constitutional symptoms like fever, chills, or night sweats?\n",
127
+ "User: My mom had a lung cancer at 45.\n",
128
+ "Model: Thank you. Could you please answer the rest of the questions regarding your social history and systems review? This information is crucial for a complete picture of your health.\n",
129
+ "User: I am a data scientist, I am a viggie. I don't use tobbaco or alcohol. My stress level is midium. \n",
130
+ "Model: Okay. And what about your sleep patterns, gastrointestinal and urinary function, and any constitutional symptoms?\n",
131
+ "User: I sleep well, and no other symptoms.\n",
132
+ "Model: To complete the intake, let's briefly discuss your pain management history and functional assessment. Are you currently taking any pain medication for your headache? Have you consulted any specialists for your headache or explored any alternative therapies? How would you rate the effectiveness of any treatments you've tried? Finally, how has this headache affected your quality of life, your ability to perform daily activities, and your overall mood?\n",
133
+ "User: No, I am not taking any other medication, and I haven't tried any alternative therapies. \n",
134
+ "Model: And how has this headache impacted your daily life, activities, and mood?\n",
135
+ "User: I am okay on my mood, and my quality of life is also good. I want to fix my headache.\n",
136
+ "Model: Finally, let's talk about your treatment goals and expectations. What are your hopes for resolving this headache? Are there any alternative treatments you'd consider?\n",
137
+ "User: I want to fix my headache.\n",
138
+ "Model: Before we finalize this record, let me summarize the information we've gathered. Please confirm if everything is accurate:\n",
139
+ "\n",
140
+ "Patient Name: Frank\n",
141
+ "DOB: 1986-01-01\n",
142
+ "Gender: Male\n",
143
+ "Contact: 12345\n",
144
+ "Emergency Contact: Zoe, 67890\n",
145
+ "\n",
146
+ "Main Symptom: Headache\n",
147
+ "Symptom Duration: Two days\n",
148
+ "\n",
149
+ "Pain Location: Right head\n",
150
+ "Pain Intensity: 2/10\n",
151
+ "Pain Characteristics: Sharp\n",
152
+ "Pain Onset: Two days ago\n",
153
+ "Radiation: No\n",
154
+ "Triggers: Cold\n",
155
+ "Associated Symptoms: None\n",
156
+ "\n",
157
+ "Medical History: Sinus (diagnosed 2001-01-01), taking ibuprofen, no allergies, no surgeries.\n",
158
+ "\n",
159
+ "Family History: Mother had lung cancer at age 45.\n",
160
+ "\n",
161
+ "Social History: Data scientist, no smoking, alcohol, or drug use. Living situation and support system unknown. Moderate stress levels.\n",
162
+ "\n",
163
+ "Systems Review: Good sleep, normal gastrointestinal and urinary function, no fever, chills, or night sweats, no recent weight changes.\n",
164
+ "\n",
165
+ "Pain Management History: No current pain medication, no specialist consultations, no alternative therapies.\n",
166
+ "\n",
167
+ "Functional Assessment: Good quality of life, no activity limitations, okay mood.\n",
168
+ "\n",
169
+ "Treatment Goals: Resolve headache. No alternative treatment considerations.\n",
170
+ "\n",
171
+ "\n",
172
+ "Is all of this information correct? Please let me know if any corrections are needed.\n",
173
+ "User: Yes\n",
174
+ "Your input data:\n",
175
+ "{'ID': {'name': 'Frank', 'DOB': '1986-01-01', 'gender': 'male', 'contact': '12345', 'emergency_contact': 'Zoe, 67890'}, 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'}, 'pain': {'pain_location': 'right head', 'pain_side': 'right', 'pain_intensity': 2.0, 'pain_description': 'sharp', 'start_time': '2 days ago', 'radiation': False, 'triggers': 'cold', 'symptom': 'headache'}, 'medical_hist': {'medical_condition': 'sinus', 'first_time': '2001-01-01', 'surgery_history': 'None', 'medication': 'ibprofin', 'allergy': 'None'}, 'family_hist': {'family_history': 'Mom had lung cancer at 45'}, 'social_hist': {'occupation': 'data scientist', 'smoke': False, 'alcohol': False, 'drug': False, 'support_system': 'unknown', 'living_condition': 'unknown'}, 'review_system': {'weight_change': 'None', 'fever': False, 'chill': False, 'night_sweats': False, 'sleep': 'well', 'gastrointestinal': 'normal', 'urinary': 'normal'}, 'pain_manage': {'pain_medication': 'None', 'specialist': False, 'other_therapy': 'None', 'effectiveness': 'unknown'}, 'functional': {'life_quality': 'good', 'limit_activity': 'None', 'mood': 'okay'}, 'plan': {'goal': 'fix headache', 'expectation': 'fix headache', 'alternative_treatment': 'None'}}\n",
176
+ "Saving the data!\n",
177
+ "{'ID': {'name': 'Frank', 'DOB': '1986-01-01', 'gender': 'male', 'contact': '12345', 'emergency_contact': 'Zoe, 67890'}, 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'}, 'pain': {'pain_location': 'right head', 'pain_side': 'right', 'pain_intensity': 2.0, 'pain_description': 'sharp', 'start_time': '2 days ago', 'radiation': False, 'triggers': 'cold', 'symptom': 'headache'}, 'medical_hist': {'medical_condition': 'sinus', 'first_time': '2001-01-01', 'surgery_history': 'None', 'medication': 'ibprofin', 'allergy': 'None'}, 'family_hist': {'family_history': 'Mom had lung cancer at 45'}, 'social_hist': {'occupation': 'data scientist', 'smoke': False, 'alcohol': False, 'drug': False, 'support_system': 'unknown', 'living_condition': 'unknown'}, 'review_system': {'weight_change': 'None', 'fever': False, 'chill': False, 'night_sweats': False, 'sleep': 'well', 'gastrointestinal': 'normal', 'urinary': 'normal'}, 'pain_manage': {'pain_medication': 'None', 'specialist': False, 'other_therapy': 'None', 'effectiveness': 'unknown'}, 'functional': {'life_quality': 'good', 'limit_activity': 'None', 'mood': 'okay'}, 'plan': {'goal': 'fix headache', 'expectation': 'fix headache', 'alternative_treatment': 'None'}}\n"
178
+ ]
179
+ }
180
+ ],
181
+ "source": [
182
+ "# The default recursion limit for traversing nodes is 25 - setting it higher means you can try a more complex order with multiple steps and round-trips.\n",
183
+ "config = {\"recursion_limit\": 1000}\n",
184
+ "\n",
185
+ "# Uncomment this line to execute the graph:\n",
186
+ "# Clear output before running new states\n",
187
+ "clear_output(wait=True)\n",
188
+ "\n",
189
+ "# Ensure messages print immediately\n",
190
+ "print(\"Executing the chatbot graph...\", flush=True)\n",
191
+ "state = graph_with_order_tools.invoke({\"messages\": []}, config)\n",
192
+ "# display(state) # Ensures state is shown in Jupyter\n",
193
+ "# sys.stdout.flush()\n",
194
+ "\n",
195
+ "# pprint(state)"
196
+ ]
197
+ },
198
+ {
199
+ "cell_type": "code",
200
+ "execution_count": 4,
201
+ "metadata": {
202
+ "trusted": true
203
+ },
204
+ "outputs": [
205
+ {
206
+ "data": {
207
+ "text/plain": [
208
+ "{'ID': {'name': 'Frank',\n",
209
+ " 'DOB': '1986-01-01',\n",
210
+ " 'gender': 'male',\n",
211
+ " 'contact': '12345',\n",
212
+ " 'emergency_contact': 'Zoe, 67890'},\n",
213
+ " 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'},\n",
214
+ " 'pain': {'pain_location': 'right head',\n",
215
+ " 'pain_side': 'right',\n",
216
+ " 'pain_intensity': 2.0,\n",
217
+ " 'pain_description': 'sharp',\n",
218
+ " 'start_time': '2 days ago',\n",
219
+ " 'radiation': False,\n",
220
+ " 'triggers': 'cold',\n",
221
+ " 'symptom': 'headache'},\n",
222
+ " 'medical_hist': {'medical_condition': 'sinus',\n",
223
+ " 'first_time': '2001-01-01',\n",
224
+ " 'surgery_history': 'None',\n",
225
+ " 'medication': 'ibprofin',\n",
226
+ " 'allergy': 'None'},\n",
227
+ " 'family_hist': {'family_history': 'Mom had lung cancer at 45'},\n",
228
+ " 'social_hist': {'occupation': 'data scientist',\n",
229
+ " 'smoke': False,\n",
230
+ " 'alcohol': False,\n",
231
+ " 'drug': False,\n",
232
+ " 'support_system': 'unknown',\n",
233
+ " 'living_condition': 'unknown'},\n",
234
+ " 'review_system': {'weight_change': 'None',\n",
235
+ " 'fever': False,\n",
236
+ " 'chill': False,\n",
237
+ " 'night_sweats': False,\n",
238
+ " 'sleep': 'well',\n",
239
+ " 'gastrointestinal': 'normal',\n",
240
+ " 'urinary': 'normal'},\n",
241
+ " 'pain_manage': {'pain_medication': 'None',\n",
242
+ " 'specialist': False,\n",
243
+ " 'other_therapy': 'None',\n",
244
+ " 'effectiveness': 'unknown'},\n",
245
+ " 'functional': {'life_quality': 'good',\n",
246
+ " 'limit_activity': 'None',\n",
247
+ " 'mood': 'okay'},\n",
248
+ " 'plan': {'goal': 'fix headache',\n",
249
+ " 'expectation': 'fix headache',\n",
250
+ " 'alternative_treatment': 'None'}}"
251
+ ]
252
+ },
253
+ "execution_count": 4,
254
+ "metadata": {},
255
+ "output_type": "execute_result"
256
+ }
257
+ ],
258
+ "source": [
259
+ "state[\"data\"]"
260
+ ]
261
+ },
262
+ {
263
+ "cell_type": "code",
264
+ "execution_count": null,
265
+ "metadata": {},
266
+ "outputs": [],
267
+ "source": []
268
+ }
269
+ ],
270
+ "metadata": {
271
+ "colab": {
272
+ "name": "day-3-building-an-agent-with-langgraph.ipynb",
273
+ "toc_visible": true
274
+ },
275
+ "kaggle": {
276
+ "accelerator": "none",
277
+ "dataSources": [],
278
+ "dockerImageVersionId": 30786,
279
+ "isGpuEnabled": false,
280
+ "isInternetEnabled": true,
281
+ "language": "python",
282
+ "sourceType": "notebook"
283
+ },
284
+ "kernelspec": {
285
+ "display_name": "paintrek",
286
+ "language": "python",
287
+ "name": "python3"
288
+ },
289
+ "language_info": {
290
+ "codemirror_mode": {
291
+ "name": "ipython",
292
+ "version": 3
293
+ },
294
+ "file_extension": ".py",
295
+ "mimetype": "text/x-python",
296
+ "name": "python",
297
+ "nbconvert_exporter": "python",
298
+ "pygments_lexer": "ipython3",
299
+ "version": "3.10.13"
300
+ }
301
+ },
302
+ "nbformat": 4,
303
+ "nbformat_minor": 4
304
+ }
paintrek-chat-v2.ipynb CHANGED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 1,
6
  "metadata": {
7
  "execution": {
8
  "iopub.execute_input": "2025-01-29T20:09:11.440091Z",
@@ -21,6 +21,7 @@
21
  "from modules.nodes import chatbot_with_tools, human_node, maybe_exit_human_node, maybe_route_to_tools\n",
22
  "\n",
23
  "from langgraph.graph import StateGraph, START, END\n",
 
24
  "\n",
25
  "from IPython.display import Image, display\n",
26
  "from pprint import pprint\n",
@@ -35,7 +36,7 @@
35
  },
36
  {
37
  "cell_type": "code",
38
- "execution_count": 2,
39
  "metadata": {
40
  "execution": {
41
  "iopub.execute_input": "2025-01-29T20:09:11.906458Z",
@@ -62,6 +63,7 @@
62
  ],
63
  "source": [
64
  "graph_builder = StateGraph(DataState)\n",
 
65
  "\n",
66
  "# Nodes\n",
67
  "graph_builder.add_node(\"chatbot_healthassistant\", chatbot_with_tools)\n",
@@ -77,14 +79,14 @@
77
  "graph_builder.add_edge(\"documenting\", \"chatbot_healthassistant\")\n",
78
  "\n",
79
  "graph_builder.add_edge(START, \"chatbot_healthassistant\")\n",
80
- "graph_with_order_tools = graph_builder.compile()\n",
81
  "\n",
82
  "Image(graph_with_order_tools.get_graph().draw_mermaid_png())"
83
  ]
84
  },
85
  {
86
  "cell_type": "code",
87
- "execution_count": 3,
88
  "metadata": {
89
  "execution": {
90
  "iopub.execute_input": "2025-01-29T20:09:38.185616Z",
@@ -103,30 +105,85 @@
103
  "text": [
104
  "Executing the chatbot graph...\n",
105
  "Model: Welcome to the Paintrek world. I am a health assistant, an interactive clinical recording system. I will ask you questions about your pain and related symptoms and record your responses. I will then store this information securely. At any time, you can type `q` to quit.\n",
106
- "Model: First, let's collect some basic information. What is your full name, date of birth, gender, and contact number? And could you also provide the name and contact information for someone who can be reached in case of emergency?\n",
107
- "Model: Thank you. Now, can you describe your main complaint or the reason for your visit today? And how long have you been experiencing this?\n",
108
- "Model: Okay. Let's assess the headache. Where exactly is the pain located? Is it on the left, right, or both sides? And on a scale of 0 to 10, with 0 being no pain and 10 being the worst pain imaginable, what would you rate the intensity? Can you describe the characteristics of the pain – is it sharp, dull, throbbing, etc.? When did it start? Does the pain radiate anywhere else? What, if anything, seems to trigger it? Are there any other symptoms associated with the headache, such as nausea, vomiting, or visual disturbances?\n",
109
- "Model: To continue, could you please provide information on your medical history, including any existing medical conditions, when they first appeared, any surgeries you've had and when, your current medications, and any known allergies?\n",
110
- "Model: Thank you. Now, let's move on to your family medical history. Are there any significant medical conditions that run in your family?\n",
111
- "Model: Could you tell me a little about your social history, including your occupation, your living situation, and whether you smoke, drink alcohol, or use drugs? Also, who is in your support system?\n",
112
- "Model: Let's do a quick systems review. Have you experienced any recent weight changes, fever, chills, night sweats, changes in sleep patterns, or any gastrointestinal or urinary issues?\n",
113
- "Model: Now, regarding pain management, what pain medications are you currently using, have you consulted any specialists for your pain, have you tried any alternative therapies, and if so, how effective have they been?\n",
114
- "Model: Finally, let's assess the impact of your headache on your daily life. How has it affected your quality of life, your ability to perform activities, and your mood or emotional state?\n",
115
- "Model: What are your treatment goals for this headache? What are your expectations for treatment, and are there any alternative treatments you'd like to consider?\n",
116
- "Model: To summarize: You are Frank, born on 01/01/1986, experiencing a sharp headache on the right side of your head for two days, rated at a 2 on a scale of 0-10. The pain is triggered by cold. You have a history of sinusitis diagnosed in 2001. Your mother had lung cancer at age 45. You are a data scientist, and do not smoke or drink alcohol. You sleep well and have no other symptoms. You are currently taking ibuprofen. You have not seen a specialist for this headache nor tried alternative therapies. Your mood and quality of life are currently good, but you want your headache resolved.\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  "\n",
118
- "Is this information correct?\n",
 
119
  "Your input data:\n",
120
- "{'ID': {'name': 'Frank', 'DOB': '1986-01-01', 'gender': 'male', 'contact': '12345', 'emergency_contact': 'Zoe, 67890'}, 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'}, 'pain': {'pain_location': 'right head', 'pain_side': 'right', 'pain_intensity': 2.0, 'pain_description': 'sharp', 'start_time': '2 days ago', 'radiation': False, 'triggers': 'cold', 'symptom': 'None'}, 'medical_hist': {'medical_condition': 'sinus', 'first_time': '2001-01-01', 'surgery_history': 'None', 'medication': 'ibprofin', 'allergy': 'None'}, 'family_hist': {'family_history': 'Mother had lung cancer at 45'}, 'social_hist': {'occupation': 'data scientist', 'smoke': False, 'alcohol': False, 'drug': False, 'support_system': 'medium stress level', 'living_condition': 'viggie'}, 'review_system': {'weight_change': 'None', 'fever': False, 'chill': False, 'night_sweats': False, 'sleep': 'well', 'gastrointestinal': 'None', 'urinary': 'None'}, 'pain_manage': {'pain_medication': 'None', 'specialist': False, 'other_therapy': 'None', 'effectiveness': False}, 'functional': {'life_quality': 'good', 'limit_activity': 'None', 'mood': 'okay'}, 'plan': {'goal': '', 'expectation': '', 'alternative_treatment': ''}}\n",
121
  "Saving the data!\n",
122
- "{'ID': {'name': 'Frank', 'DOB': '1986-01-01', 'gender': 'male', 'contact': '12345', 'emergency_contact': 'Zoe, 67890'}, 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'}, 'pain': {'pain_location': 'right head', 'pain_side': 'right', 'pain_intensity': 2.0, 'pain_description': 'sharp', 'start_time': '2 days ago', 'radiation': False, 'triggers': 'cold', 'symptom': 'None'}, 'medical_hist': {'medical_condition': 'sinus', 'first_time': '2001-01-01', 'surgery_history': 'None', 'medication': 'ibprofin', 'allergy': 'None'}, 'family_hist': {'family_history': 'Mother had lung cancer at 45'}, 'social_hist': {'occupation': 'data scientist', 'smoke': False, 'alcohol': False, 'drug': False, 'support_system': 'medium stress level', 'living_condition': 'viggie'}, 'review_system': {'weight_change': 'None', 'fever': False, 'chill': False, 'night_sweats': False, 'sleep': 'well', 'gastrointestinal': 'None', 'urinary': 'None'}, 'pain_manage': {'pain_medication': 'None', 'specialist': False, 'other_therapy': 'None', 'effectiveness': False}, 'functional': {'life_quality': 'good', 'limit_activity': 'None', 'mood': 'okay'}, 'plan': {'goal': '', 'expectation': '', 'alternative_treatment': ''}}\n"
123
  ]
124
  }
125
  ],
126
  "source": [
127
- "# The default recursion limit for traversing nodes is 25 - setting it higher\n",
128
- "# means you can try a more complex order with multiple steps and round-trips.\n",
129
- "config = {\"recursion_limit\": 1000}\n",
130
  "\n",
131
  "# Uncomment this line to execute the graph:\n",
132
  "# Clear output before running new states\n",
@@ -164,34 +221,36 @@
164
  " 'start_time': '2 days ago',\n",
165
  " 'radiation': False,\n",
166
  " 'triggers': 'cold',\n",
167
- " 'symptom': 'None'},\n",
168
  " 'medical_hist': {'medical_condition': 'sinus',\n",
169
  " 'first_time': '2001-01-01',\n",
170
  " 'surgery_history': 'None',\n",
171
  " 'medication': 'ibprofin',\n",
172
  " 'allergy': 'None'},\n",
173
- " 'family_hist': {'family_history': 'Mother had lung cancer at 45'},\n",
174
  " 'social_hist': {'occupation': 'data scientist',\n",
175
  " 'smoke': False,\n",
176
  " 'alcohol': False,\n",
177
  " 'drug': False,\n",
178
- " 'support_system': 'medium stress level',\n",
179
- " 'living_condition': 'viggie'},\n",
180
  " 'review_system': {'weight_change': 'None',\n",
181
  " 'fever': False,\n",
182
  " 'chill': False,\n",
183
  " 'night_sweats': False,\n",
184
  " 'sleep': 'well',\n",
185
- " 'gastrointestinal': 'None',\n",
186
- " 'urinary': 'None'},\n",
187
  " 'pain_manage': {'pain_medication': 'None',\n",
188
  " 'specialist': False,\n",
189
  " 'other_therapy': 'None',\n",
190
- " 'effectiveness': False},\n",
191
  " 'functional': {'life_quality': 'good',\n",
192
  " 'limit_activity': 'None',\n",
193
  " 'mood': 'okay'},\n",
194
- " 'plan': {'goal': '', 'expectation': '', 'alternative_treatment': ''}}"
 
 
195
  ]
196
  },
197
  "execution_count": 4,
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": null,
6
  "metadata": {
7
  "execution": {
8
  "iopub.execute_input": "2025-01-29T20:09:11.440091Z",
 
21
  "from modules.nodes import chatbot_with_tools, human_node, maybe_exit_human_node, maybe_route_to_tools\n",
22
  "\n",
23
  "from langgraph.graph import StateGraph, START, END\n",
24
+ "from langgraph.checkpoint.memory import MemorySaver\n",
25
  "\n",
26
  "from IPython.display import Image, display\n",
27
  "from pprint import pprint\n",
 
36
  },
37
  {
38
  "cell_type": "code",
39
+ "execution_count": null,
40
  "metadata": {
41
  "execution": {
42
  "iopub.execute_input": "2025-01-29T20:09:11.906458Z",
 
63
  ],
64
  "source": [
65
  "graph_builder = StateGraph(DataState)\n",
66
+ "memory = MemorySaver()\n",
67
  "\n",
68
  "# Nodes\n",
69
  "graph_builder.add_node(\"chatbot_healthassistant\", chatbot_with_tools)\n",
 
79
  "graph_builder.add_edge(\"documenting\", \"chatbot_healthassistant\")\n",
80
  "\n",
81
  "graph_builder.add_edge(START, \"chatbot_healthassistant\")\n",
82
+ "graph_with_order_tools = graph_builder.compile(checkpointer=memory)\n",
83
  "\n",
84
  "Image(graph_with_order_tools.get_graph().draw_mermaid_png())"
85
  ]
86
  },
87
  {
88
  "cell_type": "code",
89
+ "execution_count": null,
90
  "metadata": {
91
  "execution": {
92
  "iopub.execute_input": "2025-01-29T20:09:38.185616Z",
 
105
  "text": [
106
  "Executing the chatbot graph...\n",
107
  "Model: Welcome to the Paintrek world. I am a health assistant, an interactive clinical recording system. I will ask you questions about your pain and related symptoms and record your responses. I will then store this information securely. At any time, you can type `q` to quit.\n",
108
+ "User: Let's start\n",
109
+ "Model: First, I'll need some basic information for identification. What is your full name, date of birth, gender, and contact number? Also, please provide the name and contact information for an emergency contact.\n",
110
+ "User: I am Frank, DOB 1986-01-01, male, phone number is 12345, emergency name is Zoe, number is 67890.\n",
111
+ "Model: Thank you. Now, can you describe your main symptom and how long you've been experiencing it?\n",
112
+ "User: I had a headache, and it started two days ago.\n",
113
+ "Model: Okay. Let's move on to a pain assessment. To help me understand your headache, please tell me:\n",
114
+ "\n",
115
+ "1. Where is the pain located on your head? (e.g., forehead, temple, back of head)\n",
116
+ "2. On which side of your head is the pain located? (left, right, or both)\n",
117
+ "3. On a scale of 0 to 10, with 0 being no pain and 10 being the worst pain imaginable, how intense is your headache right now?\n",
118
+ "4. Can you describe the characteristics of your pain? (e.g., sharp, dull, throbbing, aching)\n",
119
+ "5. When did the headache begin?\n",
120
+ "6. Does the pain radiate to any other areas? If so, where?\n",
121
+ "7. Are there any triggers that seem to make the headache worse?\n",
122
+ "8. Do you have any other symptoms associated with the headache? (e.g., nausea, vomiting, sensitivity to light or sound)\n",
123
+ "\n",
124
+ "Please answer as accurately as possible. Remember, there are no wrong answers.\n",
125
+ "User: My pain is located on the right head, and the scale is 2, the pain is sharp, the pain started 2 days ago, and the pain is not radiating. Cold will trigger the pain, and no other symptoms. \n",
126
+ "Model: Excellent. Now, let's gather some information about your medical history. Do you have any existing medical conditions, allergies, current medications, or a history of surgeries? Please include dates where applicable.\n",
127
+ "User: I had sinus, diagnosed in 2001-01-01, I did not have any surgery. I am taking ibprofin, no allergies.\n",
128
+ "Model: We're making good progress. Next, I need some information about your family medical history, social history, and a brief systems review. Could you tell me about any significant medical conditions in your family? What is your occupation, and are there any lifestyle factors like smoking, alcohol, or drug use that I should be aware of? Also, describe your living situation and support system. Finally, have you experienced any recent changes in your weight, sleep patterns, gastrointestinal or urinary function, or any constitutional symptoms like fever, chills, or night sweats?\n",
129
+ "User: My mom had a lung cancer at 45.\n",
130
+ "Model: Thank you. Could you please answer the rest of the questions regarding your social history and systems review? This information is crucial for a complete picture of your health.\n",
131
+ "User: I am a data scientist, I am a viggie. I don't use tobbaco or alcohol. My stress level is midium. \n",
132
+ "Model: Okay. And what about your sleep patterns, gastrointestinal and urinary function, and any constitutional symptoms?\n",
133
+ "User: I sleep well, and no other symptoms.\n",
134
+ "Model: To complete the intake, let's briefly discuss your pain management history and functional assessment. Are you currently taking any pain medication for your headache? Have you consulted any specialists for your headache or explored any alternative therapies? How would you rate the effectiveness of any treatments you've tried? Finally, how has this headache affected your quality of life, your ability to perform daily activities, and your overall mood?\n",
135
+ "User: No, I am not taking any other medication, and I haven't tried any alternative therapies. \n",
136
+ "Model: And how has this headache impacted your daily life, activities, and mood?\n",
137
+ "User: I am okay on my mood, and my quality of life is also good. I want to fix my headache.\n",
138
+ "Model: Finally, let's talk about your treatment goals and expectations. What are your hopes for resolving this headache? Are there any alternative treatments you'd consider?\n",
139
+ "User: I want to fix my headache.\n",
140
+ "Model: Before we finalize this record, let me summarize the information we've gathered. Please confirm if everything is accurate:\n",
141
+ "\n",
142
+ "Patient Name: Frank\n",
143
+ "DOB: 1986-01-01\n",
144
+ "Gender: Male\n",
145
+ "Contact: 12345\n",
146
+ "Emergency Contact: Zoe, 67890\n",
147
+ "\n",
148
+ "Main Symptom: Headache\n",
149
+ "Symptom Duration: Two days\n",
150
+ "\n",
151
+ "Pain Location: Right head\n",
152
+ "Pain Intensity: 2/10\n",
153
+ "Pain Characteristics: Sharp\n",
154
+ "Pain Onset: Two days ago\n",
155
+ "Radiation: No\n",
156
+ "Triggers: Cold\n",
157
+ "Associated Symptoms: None\n",
158
+ "\n",
159
+ "Medical History: Sinus (diagnosed 2001-01-01), taking ibuprofen, no allergies, no surgeries.\n",
160
+ "\n",
161
+ "Family History: Mother had lung cancer at age 45.\n",
162
+ "\n",
163
+ "Social History: Data scientist, no smoking, alcohol, or drug use. Living situation and support system unknown. Moderate stress levels.\n",
164
+ "\n",
165
+ "Systems Review: Good sleep, normal gastrointestinal and urinary function, no fever, chills, or night sweats, no recent weight changes.\n",
166
+ "\n",
167
+ "Pain Management History: No current pain medication, no specialist consultations, no alternative therapies.\n",
168
+ "\n",
169
+ "Functional Assessment: Good quality of life, no activity limitations, okay mood.\n",
170
+ "\n",
171
+ "Treatment Goals: Resolve headache. No alternative treatment considerations.\n",
172
+ "\n",
173
  "\n",
174
+ "Is all of this information correct? Please let me know if any corrections are needed.\n",
175
+ "User: Yes\n",
176
  "Your input data:\n",
177
+ "{'ID': {'name': 'Frank', 'DOB': '1986-01-01', 'gender': 'male', 'contact': '12345', 'emergency_contact': 'Zoe, 67890'}, 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'}, 'pain': {'pain_location': 'right head', 'pain_side': 'right', 'pain_intensity': 2.0, 'pain_description': 'sharp', 'start_time': '2 days ago', 'radiation': False, 'triggers': 'cold', 'symptom': 'headache'}, 'medical_hist': {'medical_condition': 'sinus', 'first_time': '2001-01-01', 'surgery_history': 'None', 'medication': 'ibprofin', 'allergy': 'None'}, 'family_hist': {'family_history': 'Mom had lung cancer at 45'}, 'social_hist': {'occupation': 'data scientist', 'smoke': False, 'alcohol': False, 'drug': False, 'support_system': 'unknown', 'living_condition': 'unknown'}, 'review_system': {'weight_change': 'None', 'fever': False, 'chill': False, 'night_sweats': False, 'sleep': 'well', 'gastrointestinal': 'normal', 'urinary': 'normal'}, 'pain_manage': {'pain_medication': 'None', 'specialist': False, 'other_therapy': 'None', 'effectiveness': 'unknown'}, 'functional': {'life_quality': 'good', 'limit_activity': 'None', 'mood': 'okay'}, 'plan': {'goal': 'fix headache', 'expectation': 'fix headache', 'alternative_treatment': 'None'}}\n",
178
  "Saving the data!\n",
179
+ "{'ID': {'name': 'Frank', 'DOB': '1986-01-01', 'gender': 'male', 'contact': '12345', 'emergency_contact': 'Zoe, 67890'}, 'symptom': {'main_symptom': 'headache', 'symptom_length': 'two days'}, 'pain': {'pain_location': 'right head', 'pain_side': 'right', 'pain_intensity': 2.0, 'pain_description': 'sharp', 'start_time': '2 days ago', 'radiation': False, 'triggers': 'cold', 'symptom': 'headache'}, 'medical_hist': {'medical_condition': 'sinus', 'first_time': '2001-01-01', 'surgery_history': 'None', 'medication': 'ibprofin', 'allergy': 'None'}, 'family_hist': {'family_history': 'Mom had lung cancer at 45'}, 'social_hist': {'occupation': 'data scientist', 'smoke': False, 'alcohol': False, 'drug': False, 'support_system': 'unknown', 'living_condition': 'unknown'}, 'review_system': {'weight_change': 'None', 'fever': False, 'chill': False, 'night_sweats': False, 'sleep': 'well', 'gastrointestinal': 'normal', 'urinary': 'normal'}, 'pain_manage': {'pain_medication': 'None', 'specialist': False, 'other_therapy': 'None', 'effectiveness': 'unknown'}, 'functional': {'life_quality': 'good', 'limit_activity': 'None', 'mood': 'okay'}, 'plan': {'goal': 'fix headache', 'expectation': 'fix headache', 'alternative_treatment': 'None'}}\n"
180
  ]
181
  }
182
  ],
183
  "source": [
184
+ "# This is for the checkpointer to have a thread id to remember for each user, and I don't know if letter mix with number will work here \n",
185
+ "# The default recursion limit for traversing nodes is 25 - setting it higher means you can try a more complex order with multiple steps and round-trips.\n",
186
+ "config = {\"configurable\": {\"thread_id\": \"1\"}, \"recursion_limit\": 1000}\n",
187
  "\n",
188
  "# Uncomment this line to execute the graph:\n",
189
  "# Clear output before running new states\n",
 
221
  " 'start_time': '2 days ago',\n",
222
  " 'radiation': False,\n",
223
  " 'triggers': 'cold',\n",
224
+ " 'symptom': 'headache'},\n",
225
  " 'medical_hist': {'medical_condition': 'sinus',\n",
226
  " 'first_time': '2001-01-01',\n",
227
  " 'surgery_history': 'None',\n",
228
  " 'medication': 'ibprofin',\n",
229
  " 'allergy': 'None'},\n",
230
+ " 'family_hist': {'family_history': 'Mom had lung cancer at 45'},\n",
231
  " 'social_hist': {'occupation': 'data scientist',\n",
232
  " 'smoke': False,\n",
233
  " 'alcohol': False,\n",
234
  " 'drug': False,\n",
235
+ " 'support_system': 'unknown',\n",
236
+ " 'living_condition': 'unknown'},\n",
237
  " 'review_system': {'weight_change': 'None',\n",
238
  " 'fever': False,\n",
239
  " 'chill': False,\n",
240
  " 'night_sweats': False,\n",
241
  " 'sleep': 'well',\n",
242
+ " 'gastrointestinal': 'normal',\n",
243
+ " 'urinary': 'normal'},\n",
244
  " 'pain_manage': {'pain_medication': 'None',\n",
245
  " 'specialist': False,\n",
246
  " 'other_therapy': 'None',\n",
247
+ " 'effectiveness': 'unknown'},\n",
248
  " 'functional': {'life_quality': 'good',\n",
249
  " 'limit_activity': 'None',\n",
250
  " 'mood': 'okay'},\n",
251
+ " 'plan': {'goal': 'fix headache',\n",
252
+ " 'expectation': 'fix headache',\n",
253
+ " 'alternative_treatment': 'None'}}"
254
  ]
255
  },
256
  "execution_count": 4,