SAHIL-SANGHVI(1)→ TERMINAL(1)

Medilink

CRUD operations with at-rest encryption over JSON storage, built for a software-engineering course.

project→ sourcePython

tech:

README

A medical clinic management system for managing patient records and appointments. Medilink offers both a command-line interface (CLI) and a graphical user interface (GUI) built with PyQt6, backed by a shared controller and persistence layer.


Features

  • User Authentication — Secure login/logout with SHA-256 password hashing and session management
  • Patient Management — Create, search, retrieve, update, and delete patient records
  • Medical Notes — Add, search, update, delete, and list notes per patient appointment
  • Dual Interface — Full-featured CLI and GUI sharing the same business logic
  • Data Persistence — Patient data stored as JSON; medical notes stored as Pickle files

Tech Stack

Layer Technology
Language Python 3
GUI PyQt6
Persistence JSON (patients), Pickle (notes)
Security SHA-256 password hashing
Testing Python unittest
Patterns MVC, DAO

Project Structure

Medilink/
├── clinic/
│   ├── __main__.py               # Entry point (selects CLI or GUI)
│   ├── controller.py             # Business logic
│   ├── patient.py                # Patient model
│   ├── note.py                   # Note model
│   ├── patient_record.py         # Patient record wrapper
│   ├── users.txt                 # Hashed user credentials
│   ├── patients.json             # Patient data (auto-created)
│   │
│   ├── cli/                      # Command-line interface
│   │   ├── clinic_cli.py
│   │   ├── main_menu_cli.py
│   │   └── appointment_menu_cli.py
│   │
│   ├── gui/                      # PyQt6 graphical interface
│   │   ├── clinic_gui.py
│   │   ├── mainmenu_gui.py
│   │   ├── style.qss             # Application stylesheet
│   │   └── ...                   # Per-feature windows
│   │
│   ├── dao/                      # Data Access Objects
│   │   ├── patient_dao_json.py
│   │   ├── note_dao_pickle.py
│   │   └── ...
│   │
│   ├── exception/                # Custom exception classes
│   │   └── ...
│   │
│   └── records/                  # Pickled note files (auto-created)
│       └── {phn}.dat
│
└── tests/
    ├── integration_test.py
    ├── patient_test.py
    ├── patient_record_test.py
    └── note_test.py

Prerequisites

  • Python 3.8+
  • PyQt6 (required for GUI mode only)

Installation

  1. Clone the repository:

    git clone https://github.com/sahil-sanghvi/Medilink.git
    cd Medilink
    
  2. Install the required dependency:

    pip install PyQt6
    

Running the Application

Run from the project root (the directory containing the clinic/ package).

GUI mode:

python -m clinic gui

CLI mode:

python -m clinic cli

Default Credentials

Username Password
user 123456
ali 123456
kala 123456

Running Tests

python -m pytest tests/

Or using unittest directly:

python -m unittest discover tests/

Data Storage

Data Format Location
Patient info JSON clinic/patients.json
Medical notes Pickle clinic/records/{phn}.dat
Credentials Text clinic/users.txt

Both storage directories are created automatically on first run.


Architecture

Medilink follows a clean MVC + DAO architecture:

  • Controller (controller.py) — Authentication, patient management, and note operations
  • Models (patient.py, note.py, patient_record.py) — Domain objects
  • DAO Layer (dao/) — Abstract interfaces with JSON and Pickle implementations
  • Presentation (cli/, gui/) — Two independent interfaces sharing the same controller
  • Exceptions (exception/) — Custom exceptions for all error conditions