Health Management System In Python With Source Code

The Health Management System In Python is a fully functional console-based application developed in Python that covers all of the features that IT students and computer-related courses will require for their college projects or assignments.

These can be helpful articles and projects that you are looking for.

This Health Management System is a project aimed at providing well-organized data management for health to provide patients with faster and more accurate data analysis.

Health Management System In Python : Project Output

Health Management System Project Output
Health Management System Project Output

What Is a Health Management System In Python?

A Health Management System records, stores, retrieves, and processes health data in order to make better decisions.

The quality of HMS data should be checked on a regular basis because the production of high-quality statistics is dependent on data quality evaluation and improvement measures.

Importance Of Health Management System

The Health Management System is important because it serves as evidence-based policymaking, informed decision-making throughout the planning, implementation, and evaluation of health initiatives, and efficient resource allocation at all levels of the health system.

Health Management System Project

This Health Management System’s main purpose is to help doctors look at a patient’s medical record and see what diseases they have, how they show up, and how to treat them. This also lets doctors keep the disease table up-to-date. This software lets doctors add a new patient or make changes to a patient’s medical record. The design is so easy to use that the user won’t have any trouble with it.

Benefits Of Health Management System

  • Results & Processing Time – The health management system adheres to standard operating protocols, and no deviations are possible in any of the effective HMS systems.
  • Better Patient Care – Faster and better healthcare judgments result from increased work productivity and greater patient data availability.
  • Data Retrieval and Data Security – They are one database where everything is interconnected in a health management system, thus there are no chances of data breaches because they have great data security.

About the Project: Health Management System In Python With Source Code

The Health Management System In Python is a console-based application written in the Python programming language.

The project is open source, and it was made for novices who wish to learn Python. This Health Management System In Python With Source Code can run in console mode, which means that you should input it manually.

Project Details and Technology: Health Management System In Python

Project Name:Health Management System In Python
Abstract:This Health Management System In Python is a Python project that aims to provide well-organized health data for clinics and hospitals. The system is also for IT students who want this project for their school or learning purposes.
Language/s Used:Python
Python version (Recommended):3.8 or 3.9
Type:Console Application
Developer:Source Code Hero
Updates:0
Health Management System In Python With Source Code – Project Information

The code given below is the full source code of the Health Management System.

COMPLETE SOURCE CODE!

import getpass
import sqlite3
connection=sqlite3.connect('hospital.db')
cursor=connection.cursor()
error=1
from os import system, name
def screen_clear():
   if name == 'nt':
      _ = system('cls')
   else:
      _ = system('clear')
cursor.execute("""select count(name) from sqlite_master where type='table' and name='doctor'""")
if cursor.fetchone()[0]==0:
    cursor.execute("""CREATE TABLE doctor ( 
    d_id number primary key, 
    dnamedfirst VARCHAR2(20), 
    dnamedlast VARCHAR2(30), 
    password varchar2(20) not null,
    speciality varchar2(40) not null,
    shift varchar2(10) not null,
    phone number(10) not null);""")
cursor.execute("""select count(name) from sqlite_master where type='table' and name='patient'""")
if cursor.fetchone()[0]==0:
    cursor.execute("""CREATE TABLE patient ( 
    p_id number primary key, 
    pfirst VARCHAR2(20), 
    pdlast VARCHAR2(30), 
    City varchar2(20) not null,
    DOB date not null,
    age number not null,
    DOA date not null,
    number number(10) not null);""")
    cursor.execute("""CREATE TABLE virus ( 
    p_id number not null, 
    dname VARCHAR2(20) primary key,
    vname VARCHAR2(20), 
    treatment VARCHAR2(50), 
    symptoms varchar2(50) not null);""")
    cursor.execute("""CREATE TABLE bacteria ( 
    p_id number not null, 
    dname VARCHAR2(20) primary key,
    bname VARCHAR2(20), 
    treatment VARCHAR2(50), 
    symptoms varchar2(50) not null);""")
    cursor.execute("""CREATE TABLE injury ( 
    p_id number not null, 
    iname VARCHAR2(20) primary key,
    idiagnosis VARCHAR2(50), 
    type varchar2(50) not null);""")
    cursor.execute("""insert into patient values(101,'Mohit','Nayak','Bangalore','15-March-2001',18,'08-March-2020',9078435952)""")
    cursor.execute("""insert into patient values(102,'Anikiat','Saraf','Kolkata','22-Dec-2000','19','15-Feb-2020',9674825476)""")
    cursor.execute("""insert into patient values(103,'Rishank','Pratik','Orissa','22-Dec-2001','18','19-Nov-2015',9117854569)""")
    cursor.execute("""insert into patient values(104,'Risav','Jana','Nepal','06-Jan-2001',18,'25-Oct-2010',7854963284)""")
    cursor.execute("""insert into patient values(105,'Wilson','Vidyut','Mumbai','23-Nov-2001',18,'23-Nov-2005',7854129645)""")
    cursor.execute("""insert into patient values(106,'Dinesh','Sharma','Rajasthan','23-Feb-2000',20,'23-Feb-2000',8476423858)""")
    cursor.execute("""insert into virus values(103,'Ebola','Ebov','Oxygen Therapy, IV Fluids','Muscle Pain, Fever, Bleeding')""")
    cursor.execute("""insert into virus values(105,'Measles','Paramyxo','Vitamin A','Cough, Skin Rash')""")
    cursor.execute("""insert into bacteria values(101,'TB','Mycobacterium','Antibiotics','Cough and Sneezes')""")
    cursor.execute("""insert into bacteria values(106,'Cholera','Vibrio','IV Fluids, Antibiotics','Seizures, Diarrhoea')""")
    cursor.execute("""insert into injury values(102,'Hair line Fracture','Plaster, Pain Killer','Toe Fracture')""")
    cursor.execute("""insert into injury values(104,'bullet wound','Removal of Bullet','Wound')""")
    print("Databse created successfully")
    
else:
    e=1
    while e!=0:
        e=int(input("1. Sign In\n2. Create a New Doctor Account\n"))
        if e==2:
            did=int(input('\nEnter id - '))
            dnf=input('Enter first name - ')
            dnl=input('Enter last name - ')
            pas=getpass.getpass('Enter password - ')
            spec=input('Enter speciality - ')
            shf=input('Enter working shift - ')
            ph=int(input('Enter phone number - '))
            cursor.execute("""insert into doctor values(?,?,?,?,?,?,?)""",(did,dnf,dnl,pas,spec,shf,ph))
            screen_clear()
            e=1
        elif e==1:
            while error==1:
                i=input("\nEnter your ID - ")
                p=getpass.getpass("Enter your Password - ")
                cursor.execute("""select count(d_id) from doctor where d_id=(?)""",(i,))
                if cursor.fetchone()[0]==1:
                    cursor.execute("""select count(password) from doctor where password=?""",(p,))
                    if cursor.fetchone()[0]==1:
                        print("\nSign in successful!")
                        screen_clear()
                        error=0
                        e=0
                        r=1
                        cursor.execute("""select d_id,dnamedfirst,dnamedlast,speciality,shift,phone from doctor where d_id=(?)""",(i,))
                        for row in cursor.fetchall():
                           print("ID -",row[0],"  Name -",row[1], row[2],"  Speciality -",row[3],"\nShift -",row[4],"  Phone Number -",row[5])
                        while r!=0:
                           print("\n1. View Patient details\n2. Add a New Patient\n3. Delete Patient Details\n0. Exit")
                           r=int(input())
                           if r==1:
                              access=input("\nEnter Patient ID:- ")
                              cursor.execute("""select count(*) from patient where p_id=(?)""",(access,))
                              if cursor.fetchone()[0]!=0:
                                 cursor.execute("""select * from patient where p_id=(?)""",(access,))
                                 print("\nPatient Details - ")
                                 for row in cursor.fetchall():
                                    print("Id: ", row[0])
                                    print("First Name: ", row[1])
                                    print("Last Name: ", row[2])
                                    print("City: ", row[3])
                                    print("Date of Birth: ", row[4])
                                    print("Age: ", row[5])
                                    print("Date of Admission: ", row[6])
                                 print("\nDiagnosis Report - ")
                                 cursor.execute("""select count(*) from virus where p_id=(?)""",(access,))
                                 if cursor.fetchone()[0]!=0:
                                    cursor.execute("""select * from virus where p_id=(?)""",(access,))
                                    for row in cursor.fetchall():
                                       print("Id: ", row[0])
                                       print("Disease Name: ", row[1])
                                       print("Virus Name: ", row[2])
                                       print("Treatment: ", row[3])
                                       print("Symptoms: ", row[4])
                                    print("\n")
                                 cursor.execute("""select count(*) from bacteria where p_id=(?)""",(access,))
                                 if cursor.fetchone()[0]!=0:
                                    cursor.execute("""select * from bacteria where p_id=(?)""",(access,))
                                    for row in cursor.fetchall():
                                       print("Id: ", row[0])
                                       print("Disease Name: ", row[1])
                                       print("Bacteria Name: ", row[2])
                                       print("Treatment: ", row[3])
                                       print("Symptoms: ", row[4])
                                    print("\n")
                                 cursor.execute("""select count(*) from injury where p_id=(?)""",(access,))
                                 if cursor.fetchone()[0]!=0:
                                    cursor.execute("""select * from injury where p_id=(?)""",(access,))
                                    for row in cursor.fetchall():
                                       print("Id: ", row[0])
                                       print("Injury Name: ", row[1])
                                       print("Diagnosis Name: ", row[2])
                                       print("Type: ", row[3])
                                    print("\n")
                              else:
                                 print("Incorrect Patient id")
                           elif r==2:
                              pid=int(input('\nEnter id - '))
                              pnf=input('Enter first name - ')
                              pnl=input('Enter last name - ')
                              pcity=input('Enter city - ')
                              pdob=input('Enter date of birth - ')
                              page=int(input('Enter age - '))
                              pdoa=input('Enter date of admission - ')
                              pnum=int(input('Enter phone number - '))
                              cursor.execute("""insert into patient values(?,?,?,?,?,?,?,?)""",(pid,pnf,pnl,pcity,pdob,page,pdoa,pnum))
                              print("\n1. Virus\n2. Bacteria\n3. Injury")
                              m=int(input())
                              if m==1:
                                 dname=input("\nEnter disease name - ")
                                 bname=input("Enter virus name - ")
                                 treatment=input("Enter treatment - ")
                                 symptoms=input("Enter symptoms - ")
                                 cursor.execute("""insert into virus values(?,?,?,?,?)""",(pid,dname,bname,treatment,symptoms))
                              elif m==2:
                                 dname=input("\nEnter disease name - ")
                                 bname=input("Enter bacteria name - ")
                                 treatment=input("Enter treatment - ")
                                 symptoms=input("Enter symptoms - ")
                                 cursor.execute("""insert into bacteria values(?,?,?,?,?)""",(pid,dname,bname,treatment,symptoms))
                              elif m==3:
                                 iname=input("\nEnter injury name - ")
                                 idiag=input("Enter diagnosis - ")
                                 itype=input("Enter injury type - ")
                                 cursor.execute("""insert into injury values(?,?,?,?)""",(pid,iname,idiag,itype))
                              print("\nPatient Added")
                              connection.commit()
                           elif r==3:
                              access=input("\nEnter Patient ID:- ")
                              cursor.execute("""select count(*) from patient where p_id=(?)""",(access,))
                              if cursor.fetchone()[0]!=0:
                                 cursor.execute("""delete from patient where p_id=(?)""",(access,))
                                 cursor.execute("""select count(*) from virus where p_id=(?)""",(access,))
                                 if cursor.fetchone()[0]!=0:
                                    cursor.execute("""delete from virus where p_id=(?)""",(access,))
                                 cursor.execute("""select count(*) from bacteria where p_id=(?)""",(access,))
                                 if cursor.fetchone()[0]!=0:
                                    cursor.execute("""delete from bacteria where p_id=(?)""",(access,))
                                 cursor.execute("""select count(*) from injury where p_id=(?)""",(access,))
                                 if cursor.fetchone()[0]!=0:
                                    cursor.execute("""delete from injury where p_id=(?)""",(access,))
                              else:
                                 print("Incorrect Patient id Patient does not exist")
                              print("\nPatient Deleted")
                              connection.commit()
                           elif r==0:
                              break
                    else:
                        print("Incorrect passoword. Please retry ")
                else:
                    print("Incorrect User ID. Please retry ")
            break
        elif e==2212:
            cursor.execute("""select * from doctor""")
            print(cursor.fetchall())
            cursor.execute("""select * from virus""")
            print(cursor.fetchall())
            cursor.execute("""select * from bacteria""")
            print(cursor.fetchall())
            cursor.execute("""select * from injury""")
            print(cursor.fetchall())
            break
connection.commit()
connection.close()
print("")
def progress(status, remaining, total):
    print(f'Copied {total-remaining} of {total} pages...')

try:
    sqliteCon = sqlite3.connect('hospital.db')
    backupCon = sqlite3.connect('hospital_backup.db')
    with backupCon:
        sqliteCon.backup(backupCon, pages=1, progress=progress)
    print("backup successful")
except sqlite3.Error as error:
    print("Error while taking backup: ", error)
finally:
    if(backupCon):
        backupCon.close()
        sqliteCon.close()

This Health Management System also includes a downloadable Project With Source Code for free, just find the downloadable source code below and click to start downloading.

By the way, if you are new to Python programming and don’t have any idea what Python IDE to use, I have here a list of the Best Python IDE for Windows, Linux, and Mac OS for you.

Additionally, I also have here How to Download and Install the Latest Version of Python on Windows.

To start executing a Health Management System, make sure that you have installed Python on your computer.

Steps on how to run the project:

Time needed: 5 minutes

These are the steps on how to run a Health Management System In Python

  • Step 1: Download Source Code

    First, find the downloadable source code below and click to start downloading the source code file.
    Online Shopping System Project in Python Download Button

  • Step 2: Extract File

    Next, after finished to download the file, go to the file location right-click the file and click extract.
    Health Management System In Python Extract File

  • Step 3: Open Project Path and Open CMD (Command Prompt).

    For you to run the project, you just need to open the project path and type CMD.
    The first thing you need to do is type py main.py in the command prompt.

    After that, just wait for a few seconds to load the system.
    Health Management System In Python Execute Project

Download the Source Code below!

Summary

This article is a way to enhance and develop our skills and logic ideas which is important in practicing the Python programming language which is the most well-known and most usable programming language in many companies.

Inquiries

If you have any questions or suggestions about the Health Management System in Python, please feel free to leave a comment below.

Leave a Comment