# upstairs-aura/mfl_erp architecture

> Architecture diagram of the GitHub repository upstairs-aura/mfl_erp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/upstairs-aura/mfl_erp
- Repository: https://github.com/upstairs-aura/mfl_erp

## Overview

MORE FUEL ERP is a Django-based operations and project-management ERP with shared identity, authorization, audit, files, and background jobs. The main workflow is staff reporting operational work, domain services applying business rules and recording state, then dashboards, reports, alerts, or external delivery surfacing results. The README documents several capabilities whose source directories are absent from the supplied tree; those are represented only where their implementation path is supported. Edges use README statements or SOURCE INDEX references; unsampled wiring is not inferred.

Main entry points: [`maintenance/services.py`](https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/services.py) (Fault tickets and lifecycle), [`regulatory/services.py`](https://github.com/upstairs-aura/mfl_erp/blob/main/regulatory/services.py) (Regulatory documents), [`reporting/services.py`](https://github.com/upstairs-aura/mfl_erp/blob/main/reporting/services.py) (Module reports and exports), [`notifications/services.py`](https://github.com/upstairs-aura/mfl_erp/blob/main/notifications/services.py) (Notification outbox and delivery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Shared platform"]
  node_access["Authorization and scope<br/>[authz.py]"]
  node_shareddata[("Identity and shared records<br/>[models.py]")]
  node_audit["Access and activity audit<br/>[audit.py]"]
  node_files["Secure attachments<br/>[files.py]"]
  node_jobs["Background job queue<br/>[jobs.py]"]
end

subgraph group_operations["Operations"]
  node_maintenance["Fault tickets and lifecycle<br/>[services.py]"]
  node_sla["Provider SLA<br/>[services.py]"]
  node_repairs["Repairs and maintenance plans<br/>[services.py]"]
  node_forecourt["Genset and ECG monitoring<br/>[services.py]"]
  node_regulatory["Regulatory documents<br/>[services.py]"]
  node_calibration["Tank calibration<br/>[services.py]"]
  node_assets[("Asset register and inventory")]
end

subgraph group_insight["Reporting and oversight"]
  node_executive["Executive dashboard<br/>[services.py]"]
  node_analytics["Maintenance analytics<br/>[analytics.py]"]
  node_reporting["Module reports and exports<br/>[services.py]"]
end

subgraph group_engagement["Automation and messaging"]
  node_ai["AI assistant<br/>[services.py]"]
  node_aitools["AI tools<br/>[ai_tools.py]"]
  node_automation["Automation runtime<br/>[runtime.py]"]
  node_automationengine["Reusable automation engine<br/>[engine.py]"]
  node_notifications["Notification outbox and delivery<br/>[services.py]"]
  node_channels["Email and WhatsApp channels<br/>[channels.py]"]
end

subgraph group_projects["Projects and administration"]
  node_projecttracker["Project Tracker<br/>[views.py]"]
  node_itadmin["IT administration<br/>[views.py]"]
end

node_staff(("ERP staff"))

node_staff -->|"reports faults"| node_maintenance
node_staff -->|"records monitoring"| node_forecourt
node_staff -->|"manages documents"| node_regulatory
node_staff -->|"records calibrations"| node_calibration
node_staff -->|"manages projects"| node_projecttracker
node_staff -->|"administers access"| node_itadmin
node_maintenance -->|"confirms and dispatches"| node_sla
node_maintenance -->|"mirrors tickets"| node_repairs
node_maintenance -.->|"reads asset records"| node_assets
node_maintenance -->|"provides fault data"| node_analytics
node_maintenance -->|"supplies report data"| node_reporting
node_forecourt -->|"supplies dashboard data"| node_executive
node_maintenance -->|"supplies dashboard data"| node_executive
node_repairs -->|"supplies dashboard data"| node_executive
node_regulatory -->|"supplies dashboard data"| node_executive
node_maintenance -->|"stores attachments"| node_files
node_regulatory -->|"stores document versions"| node_files
node_calibration -->|"stores certificates"| node_files
node_maintenance -->|"enqueues work"| node_jobs
node_regulatory -->|"schedules expiry checks"| node_jobs
node_calibration -->|"publishes alerts"| node_notifications
node_regulatory -->|"publishes alerts"| node_notifications
node_maintenance -->|"publishes operational alerts"| node_notifications
node_notifications -->|"queues delivery"| node_jobs
node_notifications -->|"sends messages"| node_channels
node_automation -->|"uses rule engine"| node_automationengine
node_automation -->|"registers handlers"| node_jobs
node_ai -->|"loads maintenance tools"| node_aitools
node_ai -->|"filters available tools"| node_access
node_itadmin -->|"manages permissions"| node_access
node_access -->|"checks roles and grants"| node_shareddata
node_maintenance -->|"records changes"| node_audit
node_regulatory -->|"records changes"| node_audit
node_calibration -->|"records changes"| node_audit
node_access -->|"audits blocked changes"| node_audit
node_reporting -->|"reads maintenance data"| node_maintenance
node_reporting -->|"reads forecourt data"| node_forecourt
node_reporting -->|"reads document data"| node_regulatory
node_reporting -->|"reads plan data"| node_repairs

click node_access "https://github.com/upstairs-aura/mfl_erp/blob/main/core/authz.py"
click node_shareddata "https://github.com/upstairs-aura/mfl_erp/blob/main/core/models.py"
click node_audit "https://github.com/upstairs-aura/mfl_erp/blob/main/core/audit.py"
click node_files "https://github.com/upstairs-aura/mfl_erp/blob/main/core/files.py"
click node_jobs "https://github.com/upstairs-aura/mfl_erp/blob/main/core/jobs.py"
click node_maintenance "https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/services.py"
click node_sla "https://github.com/upstairs-aura/mfl_erp/blob/main/sla/services.py"
click node_repairs "https://github.com/upstairs-aura/mfl_erp/blob/main/mtracker/services.py"
click node_forecourt "https://github.com/upstairs-aura/mfl_erp/blob/main/forecourt/services.py"
click node_regulatory "https://github.com/upstairs-aura/mfl_erp/blob/main/regulatory/services.py"
click node_calibration "https://github.com/upstairs-aura/mfl_erp/blob/main/calibration/services.py"
click node_executive "https://github.com/upstairs-aura/mfl_erp/blob/main/executive/services.py"
click node_analytics "https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/analytics.py"
click node_reporting "https://github.com/upstairs-aura/mfl_erp/blob/main/reporting/services.py"
click node_projecttracker "https://github.com/upstairs-aura/mfl_erp/blob/main/tracker/views.py"
click node_itadmin "https://github.com/upstairs-aura/mfl_erp/blob/main/itadmin/views.py"
click node_ai "https://github.com/upstairs-aura/mfl_erp/blob/main/ai_app/services.py"
click node_aitools "https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/ai_tools.py"
click node_automation "https://github.com/upstairs-aura/mfl_erp/blob/main/automation_app/runtime.py"
click node_automationengine "https://github.com/upstairs-aura/mfl_erp/blob/main/packages/mf_automation/engine.py"
click node_notifications "https://github.com/upstairs-aura/mfl_erp/blob/main/notifications/services.py"
click node_channels "https://github.com/upstairs-aura/mfl_erp/blob/main/notifications/channels.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_access,node_shareddata,node_audit,node_files,node_jobs toneBlue
class node_maintenance,node_sla,node_repairs,node_forecourt,node_regulatory,node_calibration,node_assets toneAmber
class node_executive,node_analytics,node_reporting toneMint
class node_ai,node_aitools,node_automation,node_automationengine,node_notifications,node_channels toneRose
class node_projecttracker,node_itadmin,node_staff toneIndigo
```

## Components

### Shared platform

- [Authorization and scope](https://github.com/upstairs-aura/mfl_erp/blob/main/core/authz.py): `core/authz.py`
- [Identity and shared records](https://github.com/upstairs-aura/mfl_erp/blob/main/core/models.py): `core/models.py`
- [Access and activity audit](https://github.com/upstairs-aura/mfl_erp/blob/main/core/audit.py): `core/audit.py`
- [Secure attachments](https://github.com/upstairs-aura/mfl_erp/blob/main/core/files.py): `core/files.py`
- [Background job queue](https://github.com/upstairs-aura/mfl_erp/blob/main/core/jobs.py): `core/jobs.py`

### Operations

- [Fault tickets and lifecycle](https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/services.py): `maintenance/services.py`
- [Provider SLA](https://github.com/upstairs-aura/mfl_erp/blob/main/sla/services.py): `sla/services.py`
- [Repairs and maintenance plans](https://github.com/upstairs-aura/mfl_erp/blob/main/mtracker/services.py): `mtracker/services.py`
- [Genset and ECG monitoring](https://github.com/upstairs-aura/mfl_erp/blob/main/forecourt/services.py): `forecourt/services.py`
- [Regulatory documents](https://github.com/upstairs-aura/mfl_erp/blob/main/regulatory/services.py): `regulatory/services.py`
- [Tank calibration](https://github.com/upstairs-aura/mfl_erp/blob/main/calibration/services.py): `calibration/services.py`
- **Asset register and inventory**

### Reporting and oversight

- [Executive dashboard](https://github.com/upstairs-aura/mfl_erp/blob/main/executive/services.py): `executive/services.py`
- [Maintenance analytics](https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/analytics.py): `maintenance/analytics.py`
- [Module reports and exports](https://github.com/upstairs-aura/mfl_erp/blob/main/reporting/services.py): `reporting/services.py`

### Automation and messaging

- [AI assistant](https://github.com/upstairs-aura/mfl_erp/blob/main/ai_app/services.py): `ai_app/services.py`
- [AI tools](https://github.com/upstairs-aura/mfl_erp/blob/main/maintenance/ai_tools.py): `maintenance/ai_tools.py`
- [Automation runtime](https://github.com/upstairs-aura/mfl_erp/blob/main/automation_app/runtime.py): `automation_app/runtime.py`
- [Reusable automation engine](https://github.com/upstairs-aura/mfl_erp/blob/main/packages/mf_automation/engine.py): `packages/mf_automation/engine.py`
- [Notification outbox and delivery](https://github.com/upstairs-aura/mfl_erp/blob/main/notifications/services.py): `notifications/services.py`
- [Email and WhatsApp channels](https://github.com/upstairs-aura/mfl_erp/blob/main/notifications/channels.py): `notifications/channels.py`

### Projects and administration

- [Project Tracker](https://github.com/upstairs-aura/mfl_erp/blob/main/tracker/views.py): `tracker/views.py`
- [IT administration](https://github.com/upstairs-aura/mfl_erp/blob/main/itadmin/views.py): `itadmin/views.py`

### Other components

- **ERP staff**

## Connections

- ERP staff → Fault tickets and lifecycle: reports faults
- ERP staff → Genset and ECG monitoring: records monitoring
- ERP staff → Regulatory documents: manages documents
- ERP staff → Tank calibration: records calibrations
- ERP staff → Project Tracker: manages projects
- ERP staff → IT administration: administers access
- Fault tickets and lifecycle → Provider SLA: confirms and dispatches (evidence: `sla/services.py`)
- Fault tickets and lifecycle → Repairs and maintenance plans: mirrors tickets (evidence: `mtracker/services.py`)
- Fault tickets and lifecycle → Asset register and inventory: reads asset records (evidence: `maintenance/services.py`)
- Fault tickets and lifecycle → Maintenance analytics: provides fault data
- Fault tickets and lifecycle → Module reports and exports: supplies report data (evidence: `reporting/services.py`)
- Genset and ECG monitoring → Executive dashboard: supplies dashboard data (evidence: `executive/services.py`)
- Fault tickets and lifecycle → Executive dashboard: supplies dashboard data (evidence: `executive/services.py`)
- Repairs and maintenance plans → Executive dashboard: supplies dashboard data (evidence: `executive/services.py`)
- Regulatory documents → Executive dashboard: supplies dashboard data (evidence: `executive/services.py`)
- Fault tickets and lifecycle → Secure attachments: stores attachments (evidence: `maintenance/services.py`)
- Regulatory documents → Secure attachments: stores document versions (evidence: `regulatory/services.py`)
- Tank calibration → Secure attachments: stores certificates (evidence: `calibration/services.py`)
- Fault tickets and lifecycle → Background job queue: enqueues work (evidence: `maintenance/services.py`)
- Regulatory documents → Background job queue: schedules expiry checks (evidence: `regulatory/services.py`)
- Tank calibration → Notification outbox and delivery: publishes alerts (evidence: `calibration/services.py`)
- Regulatory documents → Notification outbox and delivery: publishes alerts (evidence: `regulatory/services.py`)
- Fault tickets and lifecycle → Notification outbox and delivery: publishes operational alerts (evidence: `maintenance/services.py`)
- Notification outbox and delivery → Background job queue: queues delivery (evidence: `notifications/services.py`)
- Notification outbox and delivery → Email and WhatsApp channels: sends messages (evidence: `notifications/services.py`)
- Automation runtime → Reusable automation engine: uses rule engine (evidence: `automation_app/runtime.py`)
- Automation runtime → Background job queue: registers handlers (evidence: `automation_app/runtime.py`)
- AI assistant → AI tools: loads maintenance tools (evidence: `ai_app/services.py`)
- AI assistant → Authorization and scope: filters available tools (evidence: `ai_app/services.py`)
- IT administration → Authorization and scope: manages permissions
- Authorization and scope → Identity and shared records: checks roles and grants (evidence: `core/authz.py`)
- Fault tickets and lifecycle → Access and activity audit: records changes (evidence: `maintenance/services.py`)
- Regulatory documents → Access and activity audit: records changes (evidence: `regulatory/services.py`)
- Tank calibration → Access and activity audit: records changes (evidence: `calibration/services.py`)
- Authorization and scope → Access and activity audit: audits blocked changes
- Module reports and exports → Fault tickets and lifecycle: reads maintenance data (evidence: `reporting/services.py`)
- Module reports and exports → Genset and ECG monitoring: reads forecourt data (evidence: `reporting/services.py`)
- Module reports and exports → Regulatory documents: reads document data (evidence: `reporting/services.py`)
- Module reports and exports → Repairs and maintenance plans: reads plan data (evidence: `reporting/services.py`)
