A beginner-friendly ETL (Extract, Transform, Load) project built with Python, Pandas, and MySQL.
The project reads patient records from a CSV file, validates the data using business rules, and loads clean records into a MySQL database using parameterized SQL queries.
- Read patient data from CSV
- Validate patient records before insertion
- Remove duplicate records
- Remove NULL values
- Validate patient age
- Validate Pakistani phone numbers
- Validate blood groups
- Validate gender values
- Validate registration dates
- Insert data into MySQL
- Import summary showing successful and failed records
- Python 3
- Pandas
- MySQL
- MySQL Connector for Python
Hospital-Management-System/
data/
python/
sql/
screenshots/
README.md
patients.csv
│
▼
Extract (Read CSV)
│
▼
Transform
- Remove duplicates
- Remove NULL values
- Validate age
- Validate phone
- Validate blood group
- Validate gender
- Validate dates
│
▼
Load (Insert into MySQL)
| Validation | Description |
|---|---|
| Duplicate Check | Removes duplicate records |
| NULL Check | Removes incomplete records |
| Age Validation | Accepts ages between 0 and 120 |
| Phone Validation | Accepts valid Pakistani mobile numbers |
| Blood Group Validation | Allows only valid blood groups |
| Gender Validation | Male, Female, Other |
| Date Validation | Registration date cannot be in the future |
git clone https://github.com/kmustajabjava/Hospital-Management-System.gitpip install -r requirements.txtEdit
python/config.pyUpdate
host
user
password
databaseRun SQL scripts
sql/
to create the database and tables.
cd python
python import_patients.py===== IMPORT SUMMARY =====
Successfully Imported : 5
Failed Imports : 0
Database connection closed.
- ETL Pipeline Development
- Python Programming
- Pandas Data Processing
- SQL
- MySQL
- Data Validation
- Database Connectivity
- Exception Handling
- Transaction Management
Kainat M Ahmed