Repository navigation
Key Assumptions and Clarifications
The source requirements are strong, but several operational rules must be made explicit for implementation.
The following records are never physically deleted:
- Person
- Collaborator
- Current Account Entry
- Mine Well Production
- Gold Price
- Price List Items
- Reference Data
Instead, records are managed with status flags, activity flags, effective dates, or reversal records.
The recommended architecture is a modular monolith, not microservices, because:
- business rules are tightly coupled,
- SQLite is the requested database,
- deployment simplicity matters for remote operations,
- transaction safety across accounting workflows is easier in one process,
- future extraction to services remains possible.
Balances are derived from immutable current-account entries and reversals, not from mutable balance fields.
The system tracks accounting in two units:
- BRL (Real)
- Gold grams
A current-account entry belongs to exactly one currency. Summaries compute balances separately for each currency.
Because salary is specified as a monthly salary, but work planning operates in daily work periods, the design assumes:
- monthly salary is normalized to a daily accrual rate for daily projected earning calculations,
- the normalization formula is configurable,
- the default formula is
monthly_salary / 30.
Mine-well production is recorded by:
- date
- period
- well
Each period is a 12-hour shift. The plan/accrual engine uses a formal work_period entity to anchor planning and earnings.
Commissioned collaborators earn based on:
- assigned work well,
- work period,
- recorded well production,
- collaborator commission percentage.
If required production is missing, accrual status remains pending until production is recorded.
The specification implies substitution-based earnings transfer logic. The implementation will support explicit substitution links so every exception is auditable.
A collaborator journey has:
- start date,
- default end date = start date + 90 days,
- extension days,
- projected end date = default end + extension days,
- status transitions,
- closure workflow.
Initial recommended roles:
- Administrator: full access
- Planner: planning, accrual, production support
- Mercantile Operator: expense entry, read summaries
- Finance Viewer: read-only reports and ledgers