Skip to content

Developer Architecture

This page provides a developer-focused view of MedUX's internal architecture. For the high-level overview, see Architecture.

Project Layout

medux/
├── src/
│   ├── manage.py
│   └── medux/
│       ├── common/          # Tenant, User, Auth, Admin framework
│       │   ├── api/
│       │   │   └── interfaces.py
│       │   ├── models/
│       │   ├── views/
│       │   ├── templates/
│       │   ├── menus.py
│       │   ├── scoped_settings.py
│       │   └── urls/
│       ├── core/            # Patient, Encounter, Dashboard
│       │   ├── api/
│       │   │   └── interfaces.py
│       │   ├── models/
│       │   ├── views/
│       │   ├── templates/
│       │   └── middleware.py
│       ├── employees/       # Employee, WorkingContract
│       │   └── middleware.py
│       ├── notifications/   # Alerts, WebSocket
│       ├── plugins/
│       │   └── wiki/        # Built-in wiki plugin
│       └── tests/
│           └── settings.py  # Test-specific Django settings
├── docs/
├── pyproject.toml
└── Makefile

App Responsibilities

medux.common

The foundation that every other app depends on:

  • Tenant model — the multi-tenancy anchor
  • CommonUser — the custom user model (AUTH_USER_MODEL = "core.User")
  • Administration frameworkIAdministrationURL, IAdministrationSection, URL collection, sidebar rendering
  • Interfaces — all common extension points
  • Menus — sidebar, administration rail, user menu entries
  • Scoped settings registration — base settings definitions

medux.core

The medical domain layer:

  • Patient — patient demographics
  • Encounter — clinical encounters
  • Geo models — addresses, geographic data
  • Medication — medication records
  • Observation — clinical observations (FHIR-inspired)
  • DashboardIDashboardSection for plugin widgets
  • DeviceMiddleware — tracks which device the user is on
  • ICommand — command palette registration

medux.employees

  • Employee — links to user model
  • WorkingContract — employment contracts
  • EmployeeMiddleware — attaches employee to request

medux.notifications

  • Alerts — notification model and management
  • WebSocket consumers — Django Channels consumers for push

Entry Points

Plugins register via Python entry points in pyproject.toml:

[project.entry-points."medux.plugins"]
core = "medux.core:apps.CoreConfig"

The plugin manager discovers these at startup and adds them to INSTALLED_APPS. URL patterns are collected similarly via PluginManager.urlpatterns().

Settings

  • Django settingssrc/medux/settings.py (production) and src/medux/tests/settings.py (tests)
  • Environment.env in src/ loaded via django-environ
  • Scoped settings — registered in scoped_settings.py modules, accessed via request.scoped_settings

Management Commands

Command Description
initialize Set up basic data (admin user, defaults)
syncplugins Sync plugin metadata to the database
collectstatic Collect static files
makemessages Generate translation files