Value · Cost
MineCost — zero-based cost
MiningIQ reads a separate first-principles cost-estimation engine read-only through dual-database routing, and manages access via a signed API and SSO — so the authoritative cost model is never mutated by accident.
See it
What it does
First-principles cost engine
MineCost builds capex and opex bottom-up in its own app and database; MiningIQ consumes it rather than assuming cost.
Dual-database, read-only
A router sends all cost models to the MineCost DB as unmanaged read-only proxies.
Chart-of-accounts mapping
Maps MineCost category names to a canonical CoA (exact/contains/startswith/regex).
Granularity-aware aggregation
Collapses monthly/quarterly periods to annual — sum for flows, last for stocks, tonnage-weighted for grades.
Staleness-guarded sync
Skips work unless MineCost has re-run; reconciles period changes and recomputes statements.
Signed access + SSO
An HMAC-SHA256-signed admin API and token SSO carry per-user finance permissions.
How it works — the engineeringTechnical detail
Dual-DB Django routing, managed=False proxy models, HMAC-SHA256 request signing and token SSO, AWS Secrets Manager, a name-to-CoA mapping engine and granularity-aware time-series aggregation. The cost link is read-only by design — MiningIQ consumes MineCost as the single source of truth and never mutates it.
financial/routers.py · minecost_api.py · minecost_sso.py · enterprise_finance/services/minecost_adapter.py