babilonia.tools.report#
Generate cash flow reports from daily canonical cashflow files.
This script scans a target directory for daily cash flow CSV files
(previously generated from standardized bank statements), groups them
by year, and produces yearly cash flow reports using the CashFlow
analysis engine.
For each year found, the script:
Loads the daily cash flow file.
Retrieves the initial balance for the year from a balances table.
Computes a yearly cash flow report (summary and panel views).
Displays formatted tables in the terminal.
Processing can be restricted to a single year or applied to all available years. Terminal output is structured for quick inspection and logging.
Script Examples#
The script is intended for command-line execution.
Minimal PowerShell example (Windows)
Save as run_report.ps1 and execute from PowerShell.
# ! Warning -- change paths and parameters
# Paths
$REPO = "C:\path\to\repo"
$SCRIPT = "$REPO\babilonia\tools\report.py"
$DATA = "C:\data\bank_statements"
# Parameters
$TYPE = "bb-cc"
$YEAR = 2024
# Run script
python $SCRIPT `
--folder $DATA `
--type $TYPE `
--year $YEAR
Minimal shell example (Linux)
Save as run_report.sh and execute from a terminal.
#!/usr/bin/env bash
# ! Warning -- change paths and parameters
# Paths
REPO="/path/to/repo"
SCRIPT="$REPO/babilonia/tools/report.py"
DATA="/data/bank"
# Parameters
TYPE="bb-cc"
YEAR=2024
# Run script
python "$SCRIPT" --folder "$DATA" --type "$TYPE" --year "$YEAR"
Expected Folder Structure#
The input data is expected to follow a simple hierarchical layout:
bb/ # Bank
└── cc/ # Bank account
├── SALDOS_BB_CC.csv # Initial balances per year
├── 2023/
│ └── CAIXA_BB_CC_2023_DIARIO.csv
└── 2024/
└── CAIXA_BB_CC_2024_DIARIO.csv
Each CAIXA_*_DIARIO.csv file represents a daily canonical cashflow
dataset for a given year.
The balances file (SALDOS_*.csv) must contain, at minimum, the
columns:
Year: reference yearValue: initial balance at the start of the year
Data Levels#
Daily: Transaction-level canonical cashflow.
Report: Derived yearly report with summary and panel tables.
The script does not modify input files and does not write new CSV files; it only produces terminal reports.
Functions
|