# Historical Load Plan

Date: 2026-03-23  
Status: executable in MVP mode

## 1. Objective

Build initial canonical baseline for analytics by loading a broad slice of entity sets.

## 2. Preconditions

1. OData access is healthy.
2. `entity_sets.json` or metadata is available.
3. Canonical DB is configured (`CANONICAL_DB_URL`).

## 3. Run command

Example:

```powershell
python scripts/run_refresh.py --mode historical --limit-per-set 500
```

Alternative explicit set list:

```powershell
python scripts/run_refresh.py --mode historical --entity-set DocumentSales --entity-set RegisterAccounting
```

## 4. Acceptance checks

1. `logs/refresh_last_run.json` exists.
2. Run status is `success` or `partial_success`.
3. `store_stats.entities_total > 0`.
4. `checkpoints_total > 0`.

## 5. Recovery rules

- If run is `failed`, fix connectivity/schema issue and rerun same command.
- If run is `partial_success`, rerun failed entity sets explicitly via `--entity-set`.

## 6. Post-load

After successful baseline load:

1. Freeze closed periods policy in ops notes.
2. Switch daily operations to incremental mode.
