## đź”§ Field Note 07: The Architecture of Provisions
### Running Multi-Scenario Forecasts Without Database Cloning.
*By Lund Consulting | Der Maschinenraum*
In traditional enterprise software, running parallel financial forecasts requires a massive infrastructure tax: Database Cloning.
Conceptually, this is the enterprise equivalent of copy-pasting a heavy spreadsheet and renaming it `_forecast_2026_v2_FINAL.xlsx`—except on an astronomical, system-wide scale.
To evaluate next year's liabilities under May's assumptions versus July's revised budgets, IT departments are typically forced to spin up separate database sandboxes, restore heavy snapshots from backups, and maintain isolated software clusters.
A bitemporal data model, as introduced in [[FN 06 - Implementing the Bitemporal Engine]], completely eliminates this environment sprawl. You only ever need to build, pay for, and maintain **one forecasting environment**.
Because your source data natively versions its history across two timelines, a single database instance can host and compare infinite projection scenarios side-by-side. Changing a corporate assumption baseline doesn't require a new server setup. It simply requires changing a query parameter.
## 1. The Case Study: Jane's Evolving Promotion
Consider Employee EMP_102 (Jane Doe), currently earning a base salary of $5,000. Over a three-month period, management schedules a future promotion for her, then later revises the amount due to market shifts.
On May 26, 2026, HR logs a future-dated promotion for Jane to take effect in January 2027, bumping her base salary to $12,000.
On July 15, 2026, management revises that upcoming January promotion upward to $15,000. Instead of overwriting the previous record, the system appends it.
By appending rather than overwriting, the production input table naturally tracks how our expectations of the future evolved over time without losing past plans:
*Table A: HR_Data State*
| employee | attribute | value | effective_date | knowledge_date | comment |
| -------- | ----------- | ----- | -------------- | -------------- | ------- |
| EMP_102 | Base_Salary | 5000 | 2026-03-31 | 2026-03-31 | |
| EMP_102 | Base_Salary | 12000 | 2027-01-31 | 2026-05-26 | Planned |
| EMP_102 | Base_Salary | 15000 | 2027-01-31 | 2026-07-15 | Revised |
---
## 2. Running Parallel Forecasts in One Environment
The forecasting routine sweeps the future timeline month-by-month.
Because our source data is bitemporal, the engine handles completely different corporate assumption sets inside the exact same environment simply by shifting the `target_knowledge_date` parameter.
To run the May baseline forecast, we pass `2026-05-26`. To run the revised July forecast, we pass `2026-07-15`. Both projection runs write their outputs directly into the same ledger table, cleanly segregated by their respective knowledge states.
```python title:provision_forecast.py
def run_provision_forecast(target_knowledge_date, start_future_date, projection_months=12):
# Generate the list of future month-end dates to project
future_periods = get_month_ends(start_future_date, projection_months)
for target_month in future_periods:
for emp_id in get_active_employee_ids():
# Layer 2 Helper: Evaluates the math at these exact coordinates
projected_amount = calculate_payout(
employee_id=emp_id,
target_effective_date=target_month,
target_knowledge_date=target_knowledge_date
)
# Append the calculated output directly to the provision ledger
db.execute("""
INSERT INTO Provision_Ledger (employee, projected_amount, provision_for, knowledge_date)
VALUES (:emp, :amt, :prov_for, :knowledge_dt)
""", emp=emp_id, amt=projected_amount, prov_for=target_month, knowledge_dt=target_knowledge_date)
```
Once executed, both forecast runs sit perfectly organized side-by-side within the same ledger table:
*Table B: Provision_Ledger*
| employee | projected_amount | provision_for | knowledge_date | Analysis Context |
| -------- | ---------------- | ------------- | -------------- | ---------------------------- |
| EMP_102 | $5,000 | 2026-06-30 | 2026-05-26 | May baseline run |
| EMP_102 | $12,000 | 2027-01-31 | 2026-05-26 | The May Version of Jan 2027 |
| EMP_102 | $5,000 | 2026-08-31 | 2026-07-15 | July baseline run |
| EMP_102 | $15,000 | 2027-01-31 | 2026-07-15 | The July Version of Jan 2027 |
---
## 3. Native Variance Analysis & Reconciliation
Because both versions of the forecast live inside the exact same table, running a variance analysis requires zero cross-database queries.
It is a simple self-join on the `knowledge_date` axis:
```sql title:variance_analysis.sql
SELECT
a.provision_for,
a.projected_amount AS may_forecast,
b.projected_amount AS july_forecast,
(b.projected_amount - a.projected_amount) AS forecast_drift
FROM Provision_Ledger a
JOIN Provision_Ledger b
ON a.employee = b.employee
AND a.provision_for = b.provision_for
WHERE a.knowledge_date = '2026-05-26'
AND b.knowledge_date = '2026-07-15'
AND a.provision_for = '2027-01-31';
```
*The Output:*
| provision_for | may_forecast | july_forecast | forecast_drift |
| ------------- | ------------ | ------------- | -------------- |
| 2027-01-31 | $12,000 | $15,000 | +$3,000 |
If the CFO asks why the January forecast jumped by $3,000 between the May and July runs, you do not have to spin up an old database backup to inspect past inputs.
You pass the ledger's own `knowledge_date` right back into the input tables to isolate the exact corporate assumptions that built it:
```python title:historical_assumptions.py
def get_historical_assumptions(employee_id, target_future_period, ledger_knowledge_date):
# Query the bitemporal input using the ledger's knowledge date as our boundary
return db.query("""
SELECT value FROM HR_Data
WHERE employee = :emp
AND attribute = 'Base_Salary'
AND effective_date <= :target_period
AND knowledge_date <= :knowledge_ceiling
ORDER BY knowledge_date DESC, effective_date DESC LIMIT 1
""", emp=employee_id, target_period=target_future_period, knowledge_ceiling=ledger_knowledge_date)
# Querying the evolution of our forecast model parameters:
print(get_historical_assumptions("EMP_102", "2027-01-31", "2026-05-26"))
# Returns: 12000
print(get_historical_assumptions("EMP_102", "2027-01-31", "2026-07-15"))
# Returns: 15000
```
## 4. The Conclusion: Forecasting as a Native Feature
In standard environments, variance analysis is an exercise in archaeology. To compare different scenarios, IT must clone the database multiple times, while Finance teams are forced to export that fragmented data into spreadsheets, piecing together why a January budget approved in May looks different from the one revised in July.
By extending our bitemporal engine into the future, we eliminate this friction entirely. You can run infinite parallel forecasts without cloning the database multiple times or exporting multiple spreadsheets.
You give the C-Suite the ability to answer their hardest question—"Why did our projections change?"—with the simplest process.
**Entering Season 3: Compliance & Operational Discipline**
In Season 3, we leave the codebase behind and enter the hard reality of Compliance, because an ironclad data architecture is only half the battle. A perfect database cannot survive a chaotic organization.
In the upcoming season, we focus on the back office—exploring the human processes, data governance, and operational discipline required to make a bitemporal system truly audit-proof.
We look forward to welcoming you back to the Maschinenraum.