hamnamughal commited on
Commit
f15b926
·
verified ·
1 Parent(s): 1f32533

Update appointment_agent.py

Browse files
Files changed (1) hide show
  1. appointment_agent.py +39 -8
appointment_agent.py CHANGED
@@ -1,8 +1,39 @@
1
- # appointment_agent.py
2
- from data_store import add_appointment
3
-
4
- def book_appointment(doctor: str, date: str, time: str) -> str:
5
- if not doctor or not date or not time:
6
- return "❌ Error: Missing appointment details."
7
- add_appointment(doctor, date, time)
8
- return f"✅ Appointment booked with Dr. {doctor} on {date} at {time}."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime
2
+
3
+ # Placeholder appointment data
4
+ appointments = {}
5
+
6
+ def book_appointment(doctor: str, date: str, time: str):
7
+ appointment_id = str(datetime.datetime.now().timestamp())[:10]
8
+ appointments[appointment_id] = {
9
+ "doctor": doctor,
10
+ "date": date,
11
+ "time": time,
12
+ "status": "Booked"
13
+ }
14
+ return f"Your appointment with {doctor} has been booked for {date} at {time}. Appointment ID: {appointment_id}"
15
+
16
+ def cancel_appointment(appointment_id: str):
17
+ if appointment_id in appointments:
18
+ appointments[appointment_id]["status"] = "Cancelled"
19
+ return f"Your appointment with {appointments[appointment_id]['doctor']} has been cancelled."
20
+ return "Appointment not found."
21
+
22
+ def follow_up_appointment(appointment_id: str):
23
+ if appointment_id in appointments:
24
+ appointment = appointments[appointment_id]
25
+ return f"Appointment with {appointment['doctor']} is scheduled for {appointment['date']} at {appointment['time']}. Status: {appointment['status']}"
26
+ return "Appointment not found."
27
+
28
+ def reschedule_appointment(appointment_id: str, new_date: str, new_time: str):
29
+ if appointment_id in appointments:
30
+ appointments[appointment_id]["date"] = new_date
31
+ appointments[appointment_id]["time"] = new_time
32
+ return f"Your appointment with {appointments[appointment_id]['doctor']} has been rescheduled to {new_date} at {new_time}."
33
+ return "Appointment not found."
34
+
35
+ def send_reminder(appointment_id: str):
36
+ if appointment_id in appointments:
37
+ appointment = appointments[appointment_id]
38
+ return f"Reminder: Your appointment with {appointment['doctor']} is scheduled for {appointment['date']} at {appointment['time']}."
39
+ return "Appointment not found."