System Diagram
The QMineProd data model, mapped — 37 models, 101 relationships
🔍 For serious exploration, open the Interactive Diagram Viewer — pan, mouse-wheel zoom, fit-to-screen, full-screen, per-module tabs, the full 101-relationship ERD, and a focus mode that draws one model and its neighbours at a chosen depth. UnitOfMeasure (23 links), Organisation (12) and Person (8) fan out to nearly everything, so the viewer hides those links by default — a toggle brings them back. The diagrams below are the readable, static summary of the principal links only.
Architecture Overview
Six areas mirror the sidebar menu. Every arrow means "one row of the left model is referenced by many rows of the right model".
flowchart LR
subgraph REF["📚 Reference data"]
Organisation --> Person
Commodity
RawMaterialType
ProductType
UnitOfMeasure
end
subgraph OPS["⛏️ Operations & tenements"]
MiningOperation --> MiningOperationOperatorHistory
MiningOperation --> MiningOperationTenement
Tenement --> MiningOperationTenement
MiningOperation --> Stockpile
end
subgraph RET["📋 Returns & lodgement"]
ProductionSalesReturn --> ReturnTenement
ReportingPeriod
ProductionSalesReturn --> Lodgement --> LodgementError
ProductionSalesReturn --> ReturnAmendment
end
subgraph PRD["🏭 Production & processing"]
RawMaterialMined --> RawMaterialMinedCommodity
RawMaterialTransfer --> RawMaterialTransferCommodity
ProcessingActivity --> ProductProcessed --> ProductProcessedCommodity
ProcessedProductTransfer
Stockpile --> StockpileTransaction
StockpileBalance
end
subgraph SAL["🚢 Sales & freight"]
Sale --> SaleCommodity
Sale --> FreightCost
end
subgraph CTL["✅ Control & assurance"]
Reconciliation
ValidationRule --> ValidationResult
ReturnReview
ReturnDeclaration
SourceRecord --> ReportedValueSource
end
Organisation --> MiningOperation
MiningOperation --> ProductionSalesReturn
ReportingPeriod --> ProductionSalesReturn
ProductionSalesReturn --> RawMaterialMined
ProductionSalesReturn --> ProcessingActivity
ProductionSalesReturn --> StockpileBalance
ProductionSalesReturn --> Sale
ProductionSalesReturn --> Reconciliation
ProductionSalesReturn --> ValidationResult
ProductionSalesReturn --> ReturnReview
ProductionSalesReturn --> ReturnDeclaration
The Return Spine
Operation + period → return → sections → declaration → lodgement.
erDiagram
MiningOperation ||--o{ ProductionSalesReturn : "mining_operation_id"
ReportingPeriod ||--o{ ProductionSalesReturn : "reporting_period_id"
ProductionSalesReturn ||--o{ ProductionSalesReturn : "supersedes_return_id"
ProductionSalesReturn ||--o{ ReturnTenement : "production_sales_return_id"
Tenement ||--o{ ReturnTenement : "tenement_id"
ProductionSalesReturn ||--o{ ReturnReview : "production_sales_return_id"
ProductionSalesReturn ||--o{ ReturnDeclaration : "production_sales_return_id"
ProductionSalesReturn ||--o{ Lodgement : "production_sales_return_id"
Lodgement ||--o{ LodgementError : "lodgement_id"
ProductionSalesReturn ||--o{ ReturnAmendment : "original_return_id"
Production, Stockpiles and Sales
erDiagram
ProductionSalesReturn ||--o{ RawMaterialMined : "production_sales_return_id"
RawMaterialType ||--o{ RawMaterialMined : "raw_material_type_id"
RawMaterialMined ||--o{ RawMaterialMinedCommodity : "raw_material_mined_id"
Commodity ||--o{ RawMaterialMinedCommodity : "commodity_id"
ProductionSalesReturn ||--o{ RawMaterialTransfer : "production_sales_return_id"
RawMaterialTransfer ||--o{ RawMaterialTransferCommodity : "raw_material_transfer_id"
ProductionSalesReturn ||--o{ ProcessingActivity : "production_sales_return_id"
ProcessingActivity ||--o{ ProductProcessed : "processing_activity_id"
ProductType ||--o{ ProductProcessed : "product_type_id"
ProductProcessed ||--o{ ProductProcessedCommodity : "product_processed_id"
Stockpile ||--o{ StockpileTransaction : "stockpile_id"
ProductionSalesReturn ||--o{ StockpileBalance : "production_sales_return_id"
Stockpile ||--o{ StockpileBalance : "stockpile_id"
ProductionSalesReturn ||--o{ Sale : "production_sales_return_id"
Sale ||--o{ Sale : "adjusts_sale_id"
Sale ||--o{ SaleCommodity : "sale_id"
Sale ||--o{ FreightCost : "sale_id"
Evidence, Validation and Assurance
erDiagram
SourceRecord ||--o{ ReportedValueSource : "source_record_id"
ProductionSalesReturn ||--o{ SourceRecord : "production_sales_return_id"
ProductionSalesReturn ||--o{ Reconciliation : "production_sales_return_id"
ValidationRule ||--o{ ValidationResult : "validation_rule_id"
ProductionSalesReturn ||--o{ ValidationResult : "production_sales_return_id"
Reading the Diagrams
A ||--o{ Bmeans one row of A is referenced by many rows of B (the label is the foreign-key column on B).- These static diagrams show principal links only — cross-cutting
references (
*_unit_idon nearly every quantity,organisation_idandperson_idroles) are omitted for readability. The interactive viewer's Full ERD shows all 101, with the unit/org/person noise toggleable. ProductionSalesReturnis the hub of the domain (19 direct children) — the viewer's Focus mode defaults to it.
Diagrams are derived from the generated schema metadata
(apps/qmineprod/generated/json/qmineprod_relationship_metadata.json).
If the DSL schema changes, regenerate the metadata (python -m codegen.cli
all qmineprod) and update this page and the viewer's embedded data.