abdibrahem commited on
Commit
d6ceda7
·
1 Parent(s): 46987b4
Files changed (1) hide show
  1. main.py +18 -14
main.py CHANGED
@@ -266,13 +266,26 @@ class HealthcareChatbot:
266
  - What type of operation are they requesting? (create, read, update, delete, search, etc.)
267
  - What entity/resource are they working with?
268
 
269
- STEP 2: ENDPOINT MATCHING
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  - Review each endpoint in the documentation
271
  - Match the user's intent to the endpoint's PURPOSE/DESCRIPTION
272
  - Consider the HTTP method (GET for retrieval, POST for creation, etc.)
273
  - Verify the endpoint can handle the user's specific request
274
 
275
- STEP 3: PARAMETER EXTRACTION
276
  - Identify ALL required parameters from the endpoint documentation
277
  - Extract parameter values from the user query
278
  - Convert data types as needed:
@@ -280,18 +293,7 @@ class HealthcareChatbot:
280
  - Numbers to integers
281
  - Set appropriate defaults for optional parameters if beneficial
282
 
283
- STEP 4: DATE/TIME PROCESSING
284
- - Identify any temporal expressions in the user query
285
- - Convert relative dates/times using the current context:
286
- * "اليوم" (today) = current date
287
- * "غدا" (tomorrow) = current date + 1 day
288
- * "أمس" (yesterday) = current date - 1 day
289
- * "الأسبوع القادم" (next week) = current date + 7 days
290
- * "بعد ساعتين" (in 2 hours) = current time + 2 hours
291
- * "صباحًا" (morning/AM), "مساءً" (evening/PM)
292
- - Handle different date formats and languages
293
- - Account for timezone differences
294
- - Convert to ISO 8601 format: YYYY-MM-DDTHH:MM:SS
295
 
296
  STEP 5: VALIDATION
297
  - Ensure ALL required parameters are provided or identified as missing
@@ -904,6 +906,8 @@ class HealthcareChatbot:
904
  if 'params' in parsed_route:
905
  if 'patient_id' in parsed_route['params']:
906
  parsed_route['params']['patient_id'] = self.user_id
 
 
907
 
908
  # Inject parsed date if available and a date parameter exists
909
  # date_params = ['appointment_date', 'date', 'schedule_date', 'date_time', 'new_date_time']
 
266
  - What type of operation are they requesting? (create, read, update, delete, search, etc.)
267
  - What entity/resource are they working with?
268
 
269
+ STEP 2: DATE/TIME PROCESSING
270
+ - Identify any temporal expressions in the user query
271
+ - Convert relative dates/times using the current context:
272
+ * "اليوم" (today) = current date
273
+ * "غدا" (tomorrow) = current date + 1 day
274
+ * "أمس" (yesterday) = current date - 1 day
275
+ * "الأسبوع القادم" (next week) = current date + 7 days
276
+ * "بعد ساعتين" (in 2 hours) = current time + 2 hours
277
+ * "صباحًا" (morning/AM), "مساءً" (evening/PM)
278
+ - Handle different date formats and languages
279
+ - Account for timezone differences
280
+ - Convert to ISO 8601 format: YYYY-MM-DDTHH:MM:SS
281
+
282
+ STEP 3: ENDPOINT MATCHING
283
  - Review each endpoint in the documentation
284
  - Match the user's intent to the endpoint's PURPOSE/DESCRIPTION
285
  - Consider the HTTP method (GET for retrieval, POST for creation, etc.)
286
  - Verify the endpoint can handle the user's specific request
287
 
288
+ STEP 4: PARAMETER EXTRACTION
289
  - Identify ALL required parameters from the endpoint documentation
290
  - Extract parameter values from the user query
291
  - Convert data types as needed:
 
293
  - Numbers to integers
294
  - Set appropriate defaults for optional parameters if beneficial
295
 
296
+
 
 
 
 
 
 
 
 
 
 
 
297
 
298
  STEP 5: VALIDATION
299
  - Ensure ALL required parameters are provided or identified as missing
 
906
  if 'params' in parsed_route:
907
  if 'patient_id' in parsed_route['params']:
908
  parsed_route['params']['patient_id'] = self.user_id
909
+ else:
910
+ parsed_route['params']['patient_id'] = self.user_id
911
 
912
  # Inject parsed date if available and a date parameter exists
913
  # date_params = ['appointment_date', 'date', 'schedule_date', 'date_time', 'new_date_time']