How the-software-squad/hms-app works
Project type and purpose
• This is a Frappe-based Hospital Management System (HMS) app that plugs into a Frappe/ERPNext bench.
• It provides domain models (Doctypes) for patients, visits, billing, lab reports, inventory, dashboards, print formats, and APIs.
File structure
• Top-level: configuration files (.eslintrc, pyproject.toml, hooks.py), fixtures, API endpoints, tasks, public assets, templates.
• hms/hms/doctype/: each folder is a Frappe DocType (model + schema JSON + server-side Python + client JS + tests).
• hms/hms/dashboard_chart/, number_card/, workspace/ and print_format/: metadata JSON driving UI widgets and dashboards.
• hms/api/: custom REST routes (patient.py).
• fixtures/: seed data (roles, HTML blocks).
README
• Confirms this is a Frappe “app” installed via bench.
• No external infra—relies on Frappe’s server, database, web client.
Main components
a. Frappe Framework
• Python-based server, DocType engine, hooks system (hooks.py), background tasks (tasks.py), fixtures loader.
b. HMS App
• Doctype modules (business objects + logic)
• Dashboard / number card metadata
• Print format definitions
• API layer (hms/api/*.py)
• Frontend extensions (doctype/*.js + templates/pages)
c. Database
• MariaDB (stores DocType tables and app data)
d. Web Client
• Frappe desk UI, pages, forms, charts, dashboards
e. Bench CLI / Deployment
• bench get-app, bench install-app, pre-commit hooks
Relationships and interactions
• Web Client ↔ HTTP(S) ↔ Frappe Server
• Frappe Server loads HMS app modules via hooks.py, serves DocType form APIs, chart JSON endpoints, custom REST endpoints.
• Frappe Server ↔ ORM ↔ MariaDB
• fixtures → initial seed on “bench migrate”
• tasks.py → Celery/Worker (if configured) for background jobs
Architectural patterns and design principles
• MVC/MVVM: DocTypes = Model + Controller (Python) + View metadata (JSON + JS)
• Convention-over-configuration: folder structure maps to DocType names
• Extensibility via hooks and custom API
• Metadata-driven UI (dashboard_chart, number_card JSON)
Technologies and frameworks
• Python 3 + Frappe framework
• JavaScript (ESLint + Prettier) for client scripts
• MariaDB (or MySQL)
• Bench CLI
• pre-commit tooling: ruff, eslint, prettier, pyupgrade
Detail but keep focus
• HMS sub-modules (doctype, chart, card, print format, API)
• Do not clutter with every single Doctype–group them logically (e.g. “Clinical Doctypes”, “Administrative Doctypes”)
• Data flows: UI → API → Model → DB → UI