๐ฉบ EHR Insider Threat Detection System
An advanced, multi-factor authentication-based system that detects insider threats in Electronic Health Records (EHR) using Machine Learning and Biometric Verification.
๐งช Features
- Secure Login with Multi-Factor Authentication
- OTP-based Email Verification
- Fingerprint Biometric Login
- EHR Dataset Anomaly Detection via SVM
- Custom Input Prediction Interface
- Activity Logging and Tracking
๐ง Project Workflow
The system enforces multi-factor authentication before granting access to sensitive EHR functionalities:
Login
The user enters their registered email and password.Email Verification
A 6-digit OTP is sent to the user's email address. If valid, the process continues.Fingerprint Verification
The system compares the scanned fingerprint with the registered template using minutiae-based matching via SecuGen SDK.EHR Threat Detection
After successful authentication, two options are available:
Load Preprocessed Dataset
View the table, SVM scatter plot, and statistics of suspicious vs. normal access.Predict New Entry
Input new EHR access fields to predict if the behavior is normal or suspicious using a pre-trained SVM model.
โณ๏ธ Note: New user registration is only available through
fingerprint/register_fingerprint.py.
๐ Project Structure
EHR_InsiderThreat_Detection/
โ
โโโ main.py # Entry point with GUI and workflow logic
โโโ EHR_system.py # EHR anomaly detection & ML logic
โโโ email_utils.py # OTP generation and email sender
โ
โโโ data/
โ โโโ EHR_dataset.csv # Original dataset
โ โโโ preprocessed_dataset.csv # Preprocessed for ML model
โ
โโโ Database/
โ โโโ db_config.json # DB connection credentials
โ โโโ db_connect.py # DB connection handler
โ โโโ EHR_DBQueries.sql # SQL schema
โ
โโโ fingerprint/
โ โโโ capture/ # Fingerprint capture logic
โ โโโ fingerprints/ # Stored .dat fingerprint files
โ โโโ match_template.py # Template matcher
โ โโโ match_utils.py # Matching helper functions
โ โโโ register_fingerprint.py # Used to register new user
โ โโโ store_template.py # Store fingerprint in DB
โ
โโโ GUI/
โ โโโ bg_image.jpg # Background image
โ โโโ gui.py # Main GUI logic
โ โโโ gui.ui # Qt Designer file
โ
โโโ models/
โ โโโ features.pkl
โ โโโ label_encoder.pkl
โ โโโ scaler.pkl
โ โโโ svm_model.pkl # Trained SVM model for detection
๐ ๏ธ Tech Stack
- Frontend/UI: PyQt5 + Qt Designer
- Backend: Python, C++
- Database: MySQL
- Fingerprint Verification: SecuGen SDK + Minutiae Matcher (Custom Logic)
๐ Multi-Factor Authentication
- Email + Password
- Email OTP
- Fingerprint Biometric
Stored securely in a MySQL database.
๐งฌ Database Schema
CREATE DATABASE EHR_Authentication;
CREATE TABLE Users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE Fingerprints (
fingerprint_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
fingerprint_data LONGBLOB NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES Users(user_id) ON DELETE CASCADE
);
CREATE TABLE Login_Logs (
log_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
login_time DATETIME DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(50),
ip_address VARCHAR(255),
user_agent VARCHAR(255),
FOREIGN KEY (user_id) REFERENCES Users(user_id) ON DELETE SET NULL
);
๐ป How to Run the Project
1. Clone the Repository
git clone https://github.com/ifra817/EHR_InsiderThreat_Detection.git
cd EHR_InsiderThreat_Detection
2. Install Requirements
pip install -r requirements.txt
3. [Optional] Disable Fingerprint (For Testing without Scanner)
If you do not have a fingerprint scanner:
- Open main.py
- Go to line 105 inside the verify_otp function.
Replace:
python self.stackedWidget.setCurrentWidget(self.Fingerprint_Authentication)with:python QTimer.singleShot(1500, self.start_loading_screen)
4. Start the Application
python main.py
๐ฆ Dependencies
From requirements.txt:
PyQt5==5.15.11
matplotlib==3.9.2
pandas==2.2.2
numpy==2.1.0
scikit-learn==1.5.2
sklearn-compat==0.1.3
joblib==1.4.2
scipy==1.14.1
opencv-python==4.11.0.86
scikit-image==0.25.2
pymysql==1.1.1
cryptography
๐ธ Fingerprint Matching
- Biometric Authentication using SecuGen SDK
- Templates matched via custom Minutiae Matching Algorithm
- Fingerprints stored securely in .dat format & saved in MySQL BLOBs
๐งโ๐ป Developer Notes
Project built & tested using VS Code For demo/testing without biometric hardware, follow the fingerprint bypass instructions above
๐ค Contributing
Pull requests and issue reports are welcome! For feature requests, bugs, or improvements, open an issue or contact the maintainer.
๐ค Author
Ifra Ahmed
LinkedIn Profile
Log in or sign up for Devpost to join the conversation.