Pythonn Mini Project
Pythonn Mini Project
Pythonn Mini Project
The Hospital Management System provides users with a simple, interactive, text-based
menu for performing basic tasks, making it easy to navigate and operate. Users can add
new patients and doctors, view existing records, and schedule and manage
appointments. The system also includes basic data validation to ensure that only valid
patient and doctor IDs are linked to appointments, enhancing the accuracy of the data.
Overview
This Hospital Management System project is a simple, menu-driven application built
using Python. It allows hospital staff to manage essential information, including patient
records, doctor schedules, and appointments. The system provides easy-to-use functions
for adding, viewing, and managing patients and doctors.
Key Features:
• Add and View Patients: Register new patients and access their information quickly.
• Add and View Doctors: Maintain a list of doctors and their specializations.
• Appointment Scheduling: Schedule appointments between patients and doctors.
• Data Management: Use Python's dictionaries and lists to store and retrieve data
efficiently.
Hardware Requirements
Processor:
• Minimum: 1 GHz or faster processor
• Recommended: Dual-core processor or better for faster performance and
multitasking
RAM:
• Minimum: 2 GB RAM
• Recommended: 4 GB RAM or higher to run smoothly alongside other applications
Storage:
• Minimum: 500 MB of free disk space (for Python installation, project files, and
dependencies)
• Recommended: 1 GB or more if additional Python packages or libraries are needed
Software Requirements
Python Interpreter
• Version: Python 3.x (latest stable version recommended)
• Download: Python Official Site
• Required to execute Python scripts and utilize built-in libraries for functions, data
structures, and file handling.
Command-Line Interface (CLI)
• Windows: Command Prompt or PowerShell
• macOS/Linux: Terminal
• Purpose: Execute the Python script by navigating to the project directory and
running it via the command line.
Operating System Compatibility
• Supported OS: Windows, macOS, or Linux
• Ensure the Python version and code editor are compatible with your operating
system.
Existing System
Description: The existing systems in hospitals often involve manual processes or basic
software for managing patient, doctor, and appointment data. These systems typically
rely on paper-based records or simple tools like Excel. They often lack integration,
efficiency, and scalability, leading to challenges such as:
Manual Record-Keeping: Hospitals often rely on paper-based records for managing
patient, doctor, and appointment details, which can be time-consuming and prone to
errors.
Basic Software: Some hospitals use simple tools like Excel or standalone databases for
record-keeping, but these systems lack integration and automation.
Lack of Integration: Different departments (e.g., billing, patient records, appointments)
often operate in silos, leading to data redundancy and inconsistency.
Limited Reporting and Data Access: Existing systems usually have poor data retrieval
and reporting capabilities, making it difficult to analyze trends or generate reports
quickly.
Proposed System
Centralized Database: A unified system to store patient, doctor, and appointment data
in one central location, ensuring consistent, accurate, and easy-to-access records across
departments.
Automation of Tasks: Automation of routine tasks such as appointment scheduling,
patient registration, and billing to reduce manual workload, minimize errors, and speed
up processes.
Improved Data Accessibility: A user-friendly interface that allows hospital staff to quickly
access, update, and search for patient and doctor information, facilitating smoother
operations and better decision-making.
Integration Across Departments: Integration of all hospital departments (e.g., patient
management, billing, inventory) into one system, reducing redundancy and enabling real-
time data sharing for more efficient operations.
Advanced Reporting and Analytics: Built-in reporting tools to generate insights on
hospital performance, patient statistics, and resource allocation, helping administrators
make informed decisions for better hospital management.
OUTPUT:
Code
patients = {}
doctors = {}
appointments = {}
# Patient Functions
def add_patient():
patient_id = input("Enter Patient ID: ")
name = input("Enter Patient Name: ")
age = input("Enter Patient Age: ")
patients[patient_id] = {"name": name, "age": age}
print("Patient added successfully.")
def view_patients():
if patients:
print("\n--- Patients ---")
for patient_id, info in patients.items():
print(f"ID: {patient_id}, Name: {info['name']}, Age: {info['age']}")
else:
print("No patients found.")
def update_patient():
patient_id = input("Enter Patient ID to update: ")
if patient_id in patients:
name = input("Enter new name: ")
age = input("Enter new age: ")
patients[patient_id] = {"name": name, "age": age}
print("Patient updated successfully.")
else:
print("Patient not found.")
# Doctor Functions
def add_doctor():
doctor_id = input("Enter Doctor ID: ")
name = input("Enter Doctor Name: ")
specialty = input("Enter Doctor Specialty: ")
doctors[doctor_id] = {"name": name, "specialty": specialty}
print("Doctor added successfully.")
def view_doctors():
if doctors:
print("\n--- Doctors ---")
for doctor_id, info in doctors.items():
print(f"ID: {doctor_id}, Name: {info['name']}, Specialty: {info['specialty']}")
else:
print("No doctors found.")
def update_doctor():
doctor_id = input("Enter Doctor ID to update: ")
if doctor_id in doctors:
name = input("Enter new name: ")
specialty = input("Enter new specialty: ")
doctors[doctor_id] = {"name": name, "specialty": specialty}
print("Doctor updated successfully.")
else:
print("Doctor not found.")
# Appointment Functions
def add_appointment():
appointment_id = input("Enter Appointment ID: ")
patient_id = input("Enter Patient ID: ")
doctor_id = input("Enter Doctor ID: ")
date = input("Enter Appointment Date: ")
def view_appointments():
if appointments:
print("\n--- Appointments ---")
for appointment_id, info in appointments.items():
patient_name = patients[info["patient_id"]]["name"]
doctor_name = doctors[info["doctor_id"]]["name"]
print(f"ID: {appointment_id}, Patient: {patient_name}, Doctor: {doctor_name},
Date: {info['date']}")
else:
print("No appointments found.")
def delete_appointment():
appointment_id = input("Enter Appointment ID to delete: ")
if appointment_id in appointments:
del appointments[appointment_id]
print("Appointment deleted successfully.")
else:
print("Appointment not found.")
# Main Menu
def main():
while True:
print("\n--- Hospital Management System ---")
print("1. Add Patient")
print("2. View Patients")
print("3. Update Patient")
print("4. Add Doctor")
print("5. View Doctors")
print("6. Update Doctor")
print("7. Schedule Appointment")
print("8. View Appointments")
print("9. Delete Appointment")
print("10. Exit")
choice = input("Enter choice: ")
if choice == "1":
add_patient()
elif choice == "2":
view_patients()
elif choice == "3":
update_patient()
elif choice == "4":
add_doctor()
elif choice == "5":
view_doctors()
elif choice == "6":
update_doctor()
elif choice == "7":
add_appointment()
elif choice == "8":
view_appointments()
elif choice == "9":
delete_appointment()
elif choice == "10":
print("Exiting the system.")
break
else:
print("Invalid choice. Try again.")
if __name__ == "__main__":
main()
Learning Outcomes
By completing this Hospital Management System project, learners will gain a solid
understanding of the following key programming and software development
concepts:
6. Code Organization: Organize code into modular functions for clarity and
maintainability.
10. Error Handling: Understand basic error handling techniques for robust
application design.
Conclusion
The Hospital Management System (HMS) project provides a practical introduction to
Python programming, focusing on data management, functional programming, and
user interaction. By implementing essential features like patient, doctor, and
appointment management, students learn key skills such as CRUD operations, input
validation, and error handling. The modular design ensures the system is scalable
and easy to extend, offering a solid foundation for future projects. This project
enhances problem-solving abilities and prepares students to develop real world
applications with Python.
References
• Python Software Foundation. (2024). Python Tutorial: Input and Output.
Retrieved from https://python.org/doc/tutorial/
• Python Software Foundation. (2024). Python 3 Documentation. Retrieved
from https://docs.python.org/3/
• TutorialsPoint. (2024). Python Input/Output. Retrieved from
https://www.tutorialspoint.com/python/python_basic_syntax.htm
• Stack Overflow. (2024). Python Error Handling. Retrieved from
https://stackoverflow.com/questions/tagged/python-error-handling