docs(pipeline): define shared-snapshot five-statement orchestration contract
davoodmehraban89 committed
Oct 31, 2026 at 11:39 UTC
f78ce4a1812eff18ccaff8704b354a67cbacc7f6
1 file changed
+57
docs/FIVE_STATEMENT_PIPELINE.md
new
+57
@@ -0,0 +1,57 @@
1
+# ARAM — five-statement pipeline orchestrator (NOT APPROVAL)
2
+
3
+## Purpose
4
+
5
+`aram_backend.five_statement_pipeline.build_five_statement_pipeline(...)` is the single in-memory orchestration entry point for the five read-only engines:
6
+
7
+1. Balance sheet candidate
8
+2. Income statement candidate
9
+3. Statement of changes in equity candidate
10
+4. Direct-method cash flow candidate
11
+5. Trial balance diagnostic
12
+
13
+It invokes the existing builders; it does not replace their policies or calculations.
14
+
15
+## Snapshot guarantees
16
+
17
+- `workbook_bytes` must be an immutable Python `bytes` object.
18
+- The same bytes object is passed to all five builders.
19
+- Input collections are frozen to tuples once at the boundary.
20
+- The exact same frozen `NoteReference` tuple is passed to BS, IS and EQ.
21
+- The cross-statement reconciliation is run after all five candidate objects are produced.
22
+- If a candidate is blocked by a mismatch or missing transaction, the pipeline returns a blocked result with findings. Invalid workbook or policy preconditions raise `CoverageError`.
23
+
24
+## Example
25
+
26
+```python
27
+from aram_backend.five_statement_pipeline import build_five_statement_pipeline
28
+
29
+result = build_five_statement_pipeline(
30
+ workbook_bytes,
31
+ company_code="001",
32
+ fiscal_year=1404,
33
+ references=note_references,
34
+ balance_sheet_policies=bs_policies,
35
+ income_statement_policies=is_policies,
36
+ equity_movement_policies=equity_policies,
37
+ currency="IRR",
38
+ unit="Rial",
39
+ cash_accounts=cash_account_registry,
40
+ counterpart_policies=counterpart_activity_policies,
41
+ transactions=paired_cash_journal_lines,
42
+ cash_balance_notes=selected_bs_cash_notes,
43
+)
44
+
45
+if not result.eligible_for_analyst_review:
46
+ print(result.findings)
47
+
48
+payload = result.to_dict()
49
+```
50
+
51
+The result exposes all five candidates, the cross-statement report, source hash, eligibility and findings. It permanently keeps source completeness, accounting authorization, independent review, trusted approvals, official statement, export and release flags false.
52
+
53
+## Input responsibilities and limits
54
+
55
+The caller still owns the correctness and completeness of the source workbook, references, statement sign policies, equity movement classifications, cash-account registry, counterpart classifications, transaction population and cash-note selection. Tuple freezing prevents collection mutation during orchestration; it does not authenticate the values.
56
+
57
+This function is an in-memory library API, **not a desktop workflow or CLI**. It performs no filesystem access, database writes, posting, signing, approval, report export, GUI action or installer operation. No actual accounting-standard or statutory compliance is asserted.