COMPUTER SCIENCE PROJECT
COMPUTER SCIENCE PROJECT
By : AKSHAT AND
FARHAN
ACKNOWLEDGMENT
I would like to express my sincere
gratitude to my Computer Science
teacher, ABHAY SIR, for their valuable
guidance and support throughout this
project.
PYTHON:
OVERVIEW AND
IMPORTANCE
Python is a high-level, interpreted
programming language known for
its simplicity and readability. It
supports multiple programming
paradigms, including procedural,
object-oriented, and functional
programming.
History of Python
Python was developed by Guido van
Rossum and first released in 1991.
Initially conceived as a successor to
the ABC language, Python was
designed with a strong emphasis on
code readability and simplicity. Over
the years, it has evolved through the
contributions of a vibrant and
growing community, becoming one
of the most widely used
programming languages in the
world. Python's success can be
attributed to its extensive standard
library, cross-platform capabilities,
and a commitment to open-source
principles, which have fostered
continuous improvement and
adaptation to emerging technologies.
History of MySQL
MySQL was initially released in 1995 by
Swedish developers Michael "Monty"
Widenius, David Axmark, and Allan
Larsson. The name "MySQL" combines
"My," the name of Monty's daughter,
with "SQL," the abbreviation for
Structured Query Language. The goal
was to develop a fast, reliable, and
easy-to-use RDBMS that would be
superior to existing solutions.
In 2008, Sun Microsystems acquired
MySQL AB, the company behind MySQL,
for $1 billion, recognizing its potential
and popularity. Later, in 2010, Oracle
Corporation acquired Sun Microsystems,
bringing MySQL under Oracle's
umbrella. Despite concerns about its
future, MySQL has continued to thrive,
with Oracle supporting its development
alongside the community-driven fork,
MariaDB, initiated by Monty Widenius to
ensure a free and open-source
alternative.
Over the years, MySQL has evolved
significantly, introducing features like
stored procedures, triggers, views, and
robust replication capabilities. Its
continuous development has kept it
relevant in the face of emerging
technologies and growing data
demands.
Uses of MySQL
MySQL's versatility makes it suitable for
a wide range of applications across
various industries:
Web Applications and Content
Management Systems (CMS):
o MySQL powers some of the most
popular websites and CMS
platforms, including WordPress,
Joomla, and Drupal.
o It efficiently handles user data,
content storage, and dynamic
page generation.
o Supports high-traffic websites by
enabling quick read/write
operations and scalable backend
infrastructure.
Data Warehousing:
o Utilized for storing and managing
large datasets for analytics and
business intelligence.
o MySQL's partitioning, indexing,
and replication features facilitate
efficient data retrieval and
reporting.
o Helps organizations make
informed decisions based on
historical and real-time data
analysis.
E-Commerce Applications:
o Forms the backbone of many e-
commerce platforms like Magento
and PrestaShop.
o Manages product catalogs,
customer information, order
processing, and inventory
management.
o Ensures secure transactions
through support for ACID
(Atomicity, Consistency, Isolation,
Durability) compliance.
Banking and Finance:
o Used for secure and reliable
handling of financial transactions
and customer data.
o Supports complex queries and
transaction processing essential
for banking operations.
o Offers robust security features to
protect sensitive financial
information.
Health Management Systems:
o Supports Electronic Health
Records (EHR) systems by storing
patient data, medical records,
and appointment scheduling.
o Enables secure sharing of
information among authorized
healthcare providers.
o Assists in data analysis for patient
care improvement and medical
research.
Education Sector:
o Manages student information
systems, including enrollment,
grading, and course
management.
o Facilitates e-learning platforms by
handling user data and course
content delivery.
o Supports library management
systems for cataloging and
resource tracking.
Social Media and Networking
Platforms:
o Used by social networks to handle
large volumes of user-generated
content and interactions.
o Manages real-time data
processing for messaging,
notifications, and activity feeds.
o Scales horizontally to
accommodate growing user bases
and data storage requirements.
Telecommunications:
o Assists in managing customer
relations, billing systems, and
network data.
o Supports operational support
systems (OSS) and business
support systems (BSS).
o Handles large-scale data
management for call detail
records and subscriber
information.
System
Requirements
Hardware
Requirements:
1. Processor: Intel Core i3 or higher
o A multi-core processor is
recommended to handle multiple
tasks smoothly and improve
performance.
2. RAM: 4GB or more
o Adequate RAM ensures efficient
processing of data and prevents
slowdowns during operation.
3. Storage: At least 500MB of free
space
o Additional space may be required
for storing databases, reports,
and log files generated by the
system.
4. Operating System: Windows,
macOS, or Linux
o Compatible with all major
operating systems to provide
flexibility and ease of
deployment.
Software Requirements:
1. Python 3.x
o The latest version of Python 3 is
preferred to utilize updated
features and security
improvements.
2. MySQL Database Server
o Essential for managing and
storing patient data reliably with
robust database capabilities.
3. MySQL Connector for Python
o Allows seamless communication
between the Python application
and the MySQL database.
4. Colorama (for colored
terminal output)
o Enhances the user interface by
enabling colored text in the
terminal for better readability.
5. Any Text Editor or IDE
(PyCharm, VS Code, etc.)
o An Integrated Development
Environment facilitates easier
coding, debugging, and project
management.
Similar Software
Some existing software solutions that
offer similar healthcare automation
include:
SOURCE CODE
import mysql.connector
from datetime import datetime
from colorama import Fore, Style,
init
import os
# Initialize colorama for colored
output
init()
# ✅ Connect to MySQL
try:
conn = mysql.connector.connect(
host="localhost",
user="root",
password="9C@akshat"
)
cursor = conn.cursor()
print(Fore.GREEN + "✅ Connected
to the database successfully!" +
Style.RESET_ALL)
except mysql.connector.Error as
err:
print(Fore.RED + f"❌ Error: {err}"
+ Style.RESET_ALL)
exit()
# ✅ Use database
cursor.execute("CREATE DATABASE
IF NOT EXISTS diagnosis_db")
cursor.execute("USE diagnosis_db")
# ✅ Create tables
cursor.execute("DROP TABLE IF
EXISTS symptoms") # Prevent
duplicate symptoms
cursor.execute("""
CREATE TABLE symptoms (
id INT PRIMARY KEY
AUTO_INCREMENT,
name VARCHAR(50),
category VARCHAR(50)
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS
patients (
name VARCHAR(50) NOT NULL,
age INT,
gender CHAR(1),
phone CHAR(10) PRIMARY KEY,
dob DATE
)
""")
# ✅ Insert Expanded Symptoms Data
cursor.execute("""
INSERT IGNORE INTO symptoms
(id, name, category) VALUES
(1, 'Fever', 'Respiratory'),
(2, 'Cough', 'Respiratory'),
(3, 'Sore Throat', 'Respiratory'),
(4, 'Shortness of Breath',
'Respiratory'),
(5, 'Sneezing', 'Respiratory'),
(6, 'Runny Nose', 'Respiratory'),
(7, 'Headache', 'Neurological'),
(8, 'Fatigue', 'Neurological'),
(9, 'Dizziness', 'Neurological'),
(10, 'Memory Loss',
'Neurological'),
(11, 'Blurred Vision',
'Neurological'),
(12, 'Nausea', 'Digestive'),
(13, 'Body Ache', 'Digestive'),
(14, 'Stomach Pain', 'Digestive'),
(15, 'Vomiting', 'Digestive'),
(16, 'Loss of Appetite', 'Digestive')
""")
conn.commit()
# ✅ Register a patient
def register_patient():
print(Fore.BLUE + "=== Register
Patient ===" + Style.RESET_ALL)
name = input("Enter patient's
name: ")
age = input("Enter age: ")
gender = input("Enter gender
(M/F): ").upper()
phone = input("Enter phone
number (10 digits): ")
dob = input("Enter date of birth
(YYYY-MM-DD): ")
cursor.execute(
"INSERT INTO patients (name,
age, gender, phone, dob) VALUES
(%s, %s, %s, %s, %s)",
(name, age, gender, phone,
dob)
)
conn.commit()
print(Fore.GREEN + "✅ Patient
registered successfully!" +
Style.RESET_ALL)
return {
"time_period": time_period,
"hunger": hunger,
"body_temp": body_temp,
"hydration": hydration,
"travel": travel
}
# ✅ Select symptoms
def select_symptoms():
print(Fore.BLUE + "\n=== Select
Symptoms ===" +
Style.RESET_ALL)
cursor.execute("SELECT DISTINCT
category FROM symptoms")
categories = cursor.fetchall()
selected = []
for category in categories:
print(Fore.CYAN + f"\
n{category[0]} Symptoms:" +
Style.RESET_ALL)
cursor.execute("SELECT id,
name FROM symptoms WHERE
category = %s", (category[0],))
symptoms = cursor.fetchall()
for symptom in symptoms:
print(f"{symptom[0]}.
{symptom[1]}")
selected.extend(input("Enter
symptom IDs (comma-separated, or
leave blank to skip): ").split(','))
cursor.execute("SELECT * FROM
diseases")
diagnoses = []
if health_data["hunger"] ==
"Y":
match += 10 # Increase
probability of digestive issues
if health_data["travel"] == "Y":
match += 10 # Increase
probability of infections
diagnoses.append({'name':
disease[1], 'prevention': disease[3],
'doctor': disease[4], 'match':
round(match, 2)})
return diagnoses
# ✅ Main menu
def main_menu():
while True:
print("\n1. Register Patient\n2.
Diagnose Patient\n3. Exit")
choice = input("Enter your
choice: ")
if choice == '1':
register_patient()
elif choice == '2':
patient_name = input("Enter
patient's name: ")
phone = input("Enter
patient's phone number: ")
symptoms =
select_symptoms()
health_data =
ask_health_questions()
diagnosed_diseases =
diagnose(symptoms, patient_name,
phone, health_data)
if diagnosed_diseases:
generate_report(patient_name,
phone, diagnosed_diseases,
health_data)
elif choice == '3':
break
# ✅ Run the program
if __name__ == "__main__":
main_menu()
conn.close()
OUTPUT
FLOW CHART’S
SYSTEM OVERVIEW
PATIENT REGISTRATION
DIAGNOSIS PROCESS
REPORT GENERATION
Potential Advancements
and Applications
As technology continues to
evolve, this diagnostic system
can be enhanced with several
advanced features to improve
its accuracy, efficiency, and
usability. Some key areas for
improvement include:
1. Integration with AI and
Machine Learning
oImplementing AI-driven
predictive analysis to
improve diagnostic
accuracy based on patient
history.
o Using machine learning
models to suggest
possible diseases based
on symptoms and health
data patterns.
2. Cloud-Based Data
Storage
o Shifting the database to
cloud services to allow
seamless access to patient
records from multiple
locations.
o Ensuring data security and
compliance with
healthcare regulations.
3. IoT and Wearable
Device Support
Integrating real-time
o
Limitations
Despite its advantages, the project has certain
limitations:
The accuracy of diagnosis depends on
predefined symptom-disease mapping.
The system does not yet integrate real-time
AI-based learning.
No graphical user interface (GUI) is currently
implemented, making it command-line
dependent.
Requires internet connectivity for cloud-based
enhancements.
Bibliography / References
The following resources were referred to while
developing this project:
Python Official Documentation:
https://docs.python.org/
MySQL Official Documentation:
https://dev.mysql.com/doc/
Online programming communities and forums
(Stack Overflow, GeeksforGeeks, W3Schools)
Books and resources on Database
Management Systems (DBMS) and Python
programme