8000 GitHub - gichukilevis20-hue/clinic-system: Django clinic management system: patients, POS dispensing, billing, debts, PDF invoices, inventory with expiry/low-stock tracking, audit log, Excel exports, backups, and a token-protected sync API. Local-first, runs on SQLite. · GitHub
[go: up one dir, main page]

Skip to content

About

Django clinic management system: patients, POS dispensing, billing, debts, PDF invoices, inventory with expiry/low-stock tracking, audit log, Excel exports, backups, and a token-protected sync API. Local-first, runs on SQLite.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Clinic Management System

Local-first Django clinic management system for a small clinic. It runs on a laptop with SQLite and keeps the operational data offline by default.

Features Built

  • Django authentication with login, logout, password change, groups, and permissions.
  • Admin and staff roles through the seed_roles management command.
  • Medicine, incoming stock, stock adjustment, low-stock, and expiry tracking.
  • Patient registration and patient medicine history.
  • One-screen dispensing that creates a bill, debt record, and optional payment.
  • Bills, printable invoices, PDF invoices, debts, and payments.
  • Dashboard cards and local canvas chart with no internet CDN dependency.
  • Excel exports for medicines and debts.
  • JSON and SQLite backup downloads, plus JSON restore.
  • Internal audit log for key model create, update, and delete events.
  • Token-protected phone/laptop sync API with device approval, change journal, idempotent pushes, and cursor pulls.

Local Install

Linux:

cd /home/levis/Desktop/clinic
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py seed_roles
python manage.py createsuperuser
python manage.py runserver 127.0.0.1:8000

If python3 -m venv says ensurepip is missing on Ubuntu/Debian, install the venv package first:

sudo apt install python3.14-venv

Windows:

py -m venv .venv
.venv\Scripts\activate
python -m pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py seed_roles
python manage.py createsuperuser
python manage.py runserver 127.0.0.1:8000

Open http://127.0.0.1:8000/ and log in with the superuser account.

Roles

Run this after migrations:

python manage.py seed_roles

Then assign users to groups in Django Admin:

  • Admin: full access.
  • Staff: view inventory, register patients, dispense medicines, record payments, and view bills/debts.

Staff users are intentionally not granted delete permissions or user-management permissions.

Workflow

  1. Create medicines under Medicines.
  2. Add stock under Stock In.
  3. Register patients under Patients.
  4. Use Dispense to select a patient, medicine, quantity, discount, and optional payment.
  5. View generated bills under Bills.
  6. Track pending balances under Debts.
  7. Export reports under Reports.
  8. Download backups under Backups.

Backup Notes

Use both backup types:

  • SQLite database backup: easiest full local restore when the app is stopped.
  • JSON backup: useful for Django data restore through the app.

Keep at least one backup copy outside the laptop, such as an encrypted USB drive.

Offline Sync Direction

The app is local-first on the laptop and now includes the Django sync backend under /api/.

Sync endpoints:

  • POST /api/devices/register/
  • POST /api/sync/push/
  • GET /api/sync/pull/?cursor=0
  • POST /api/sync/ack/

Use Tailscale first so the Android phone can reach the laptop privately. See docs/TAILSCALE_SYNC_GUIDE.md and docs/ANDROID_SYNC_SCHEMA.md.

clinic-system

clinic

clinic

clinic1

psychic-system

About

Django clinic management system: patients, POS dispensing, billing, debts, PDF invoices, inventory with expiry/low-stock tracking, audit log, Excel exports, backups, and a token-protected sync API. Local-first, runs on SQLite.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0