Professional Documents
Culture Documents
PROJECT FILE
(2023-24)
leaves
The system starts by storing information about doctors, including their names,
specializations, and experience. Each doctor is assigned based on their specialization. On the
patient’s side, the system maintains records of individuals, their ages, and the respective
doctors they have consulted or are scheduled to meet.
2. Patient Management:
3. Admin Console:
4. Appointment Booking:
- Differentiating between recurring and new patients.
1. Lists: Lists are arrays that allow you to store and manipulate collections
of items. Whether it's a sequence of numbers, strings, or a mix of
various data types. Elements in a list are ordered and can be accessed
by their index.
2. Dictionary: Dictionaries are key-value pairs, providing a way to store
and retrieve data using unique keys. Unlike lists, dictionaries are
unordered, and each key is associated with a specific value. This makes
them ideal for organizing and accessing information in a structured
manner.
3. Loops: Loops in Python, such as "for" and "while" loops, allow you to
repeat a set of instructions multiple times. They are invaluable for
automating repetitive tasks.
4. if/else/elif: Conditional statements, including "if," "else," and "elif"
(short for "else if"), enable the execution of different code blocks based
on specific conditions. These statements enhance the decision-making
capability of programs.
5. User-defined functions: Python allows you to define your functions,
defining a set of instructions under a chosen name. This allows code
reusability, and making the code more readable and maintainable.
Source Code
import random
#Let static input for doctors
doctor_info={100:{"Name":"Robert
Zane","Specialisation":"Cardiologist","Experience":5},101:{"Name":"Claire
Browne","Specialisation":"Paediatrician","Experience":2},102:{"Name":"Neil
Melendez","Specialisation":"Orthopaedic","Experience":8},103:{"Name":"Ray
Holt","Specialisation":"Radiologist","Experience":15}}
OPD={"Cardiologist":"OPD 1","Paediatrician":"OPD 2","Orthopaedic":"OPD
3","Radiologist":"OPD 4"}
def doctor_add():
doc_id=int(input("\nEnter Doctor ID: "))
name=input("Enter Doctor name: ")
spec=input("Enter Doctor specialisation
(Cardiologist/Paediatrician/Orthopaedic/Radiologist): ").capitalize()
exp=int(input("Enter Doctor experience(in years): "))
doctor_info[doc_id]={"Name":name,"Specialisation":spec,"Experience":exp}
print("\nDoctor data added successfully\n")
def doctor_display():
doc_id=int(input("\nEnter Doctor ID: "))
if doc_id in doctor_info:
print("\nDoctor Information: ")
print("Name:",doctor_info[doc_id]["Name"])
print("Specialisation:",doctor_info[doc_id]["Specialisation"])
print("Experience:",doctor_info[doc_id]["Experience"],"years\n")
else:
print("\nNo Doctor Found with the given ID\n")
def doctor_edit():
doc_id=int(input("\nEnter Doctor ID: "))
if doc_id in doctor_info:
name=input("Enter Doctor Name: ")
spec=input("Enter Doctor Specialisation
(Cardiologist/Paediatrician/Orthopaedic/Radiologist): ").capitalize()
exp=int(input("Enter Doctor Experience: "))
doctor_info[doc_id]={"Name":name,"Specialisation":spec,"Experience":exp}
print("\nDoctor information updated successfully\n")
else:
print("\nNo Doctor found with the given ID\n")
def doctor_delete():
doc_id=int(input("\nEnter Doctor ID: "))
if doc_id in doctor_info:
del doctor_info[doc_id]
print("\nDoctor data deleted successfully\n")
else:
print("\nNo Doctor Found with the given ID\n")
def doctor_search_admin():
search=input("\nEnter the name of Doctor: ")
Eligible_doctors=[]
for doc_key,doc_value in doctor_info.items():
if search.lower() in doc_value['Name'].lower():
Eligible_doctors.append({'ID': doc_key, 'Name': doc_value['Name'],
'Specialisation': doc_value["Specialisation"]})
print("\nDoctors found:")
for found in Eligible_doctors:
print(f"Name: {found['Name']}\nSpecialisation: {found['Specialisation']}\
nID: {found['ID']}\n")
elif ch_p_add==2:
patient_name=input("\nEnter patient name: ")
patient_age=int(input("Enter patient age: "))
sp_wanted=input("Field of doctor needed
(Cardiologist/Paediatrician/Orthopaedic/Radiologist): ").capitalize()
rid=random.randint(10004,99999)
patient_info[rid]={"Name":patient_name,"Age":patient_age,"Cardiologist":"","
Paediatrician":"","Orthopaedic":"","Radiologist":""}
print("\nPatient data added successfully your patient ID is:",rid,"\n")
Eligible_doctors=[]
for doc_key,doc_value in doctor_info.items():
if sp_wanted in doc_value["Specialisation"]:
Eligible_doctors.append({"ID": doc_key, "Name":
doc_value["Name"]})
ran=random.randint(0,len(Eligible_doctors)-1)
print("\nDr."+Eligible_doctors[ran]["Name"],"will be waiting
in",OPD[sp_wanted])
print("Please pay Rs500\n")
patient_info[rid][sp_wanted]=Eligible_doctors[ran]["Name"]
else:
print("\nInvalid input, Try again\n")
def doctor_Search():
patient_id=int(input("\nEnter patient ID: "))
if patient_id in patient_info:
Name=input("Name of Doctor: ")
Eligible_doctors=[]
for doc_key,doc_value in doctor_info.items():
if Name.lower() in doc_value["Name"].lower():
Eligible_doctors.append({"Name":
doc_value["Name"],"Specialisation": doc_value["Specialisation"]})
print("\nDoctors found:")
for found in Eligible_doctors:
print(f"Name: {found['Name']}\nSpecialisation:
{found['Specialisation']}\n")
else:
print("\nInvalid patient ID\n")
def patient_delete():
patient_id=int(input("\nEnter patient ID: "))
if patient_id in patient_info:
del patient_info[patient_id]
print("\nPatient data deleted successfully\n")
else:
print("\nNo patient Found with the given ID\n")
def patient_display():
patient_id=int(input("\nEnter patient ID: "))
if patient_id in patient_info:
print("\nPatient Information: ")
print("Name:",patient_info[patient_id]["Name"])
print("Age:",patient_info[patient_id]["Age"])
print("ID:",patient_id,"\n")
print("Cardiologist:",patient_info[patient_id]["Cardiologist"])
print("Paediatrician:",patient_info[patient_id]["Paediatrician"])
print("Orthopaedic:",patient_info[patient_id]["Orthopaedic"])
print("Radiologist:",patient_info[patient_id]["Radiologist"],"\n")
else:
print("\nNo patient Found with the given ID\n")
while True:
print("Press 1 to book an appointment")
print("Press 2 to search for a Doctor")
print("Press 3 to display patient details")
print("Press 4 to login to admin console")
print("Press 5 to shut down")
ch=int(input("Enter your choice: "))
if ch==1:
appointment()
elif ch==2:
doctor_Search()
elif ch==3:
patient_display()
elif ch==4:
print("\n#Password is admin")
password=input("Enter password: ")
if password=="admin":
print("\nPress 1 to add a Doctor")
print("Press 2 to display a Doctor's data")
print("Press 3 to edit a Doctor's data")
print("Press 4 to search for a Doctor's full credentials")
print("Press 5 to delete a Doctor's data")
print("Press 6 to delete a patients's data")
print("Press 7 to log out of admin console")
cha=int(input("Enter your choice: "))
if cha==1:
doctor_add()
elif cha==2:
doctor_display()
elif cha==3:
doctor_edit()
elif cha==4:
doctor_search_admin()
elif cha==5:
doctor_delete()
elif cha==6:
patient_delete()
elif cha==7:
print("\nLogging out of admin console\n")
else:
print("\nInvalid input, Logging out\n")
else:
print("Incorrect password, Locking database")
break
elif ch==5:
print("\nShutting Down")
break
else:
print("\nInvalid input, Try again\n")
Output
BIBLIOGRAPHY