pta-generator

Crates.iopta-generator
lib.rspta-generator
version
sourcesrc
created_at2025-04-07 04:11:03.450202+00
updated_at2025-04-13 16:43:36.534206+00
descriptionTest data generator for PTA applications
homepage
repositoryhttps://github.com/tackler-ng/pta-generator
max_upload_size
id1623639
Cargo.toml error:TOML parse error at line 25, column 1 | 25 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
35V LG84 (35VLG84)

documentation

README

Build Status Github Releases Crates.io Version GitHub Discussions Matrix

Test Data Generator for Plain Text Accounting

PTA-Generator generates plain text accounting data sets ("journals") for test and demo usage.

It creates journals with or without commodities and journals with audit data for tackler. PTA-Generator can also crete journals of different sizes, and it also supports different journal storing strategies.

Currently it has following features:

  • Support for following PTA tools
  • Three major modes:
    • comm: Journal with commodities
      • Tools: tackler, (h)ledger, beancount
    • plain: The simplest journal
      • Tools: tackler, (h)ledger
    • audit: Journal with transaction audit data
      • Tools: tackler
  • Three journal storage strategies:
    • single: Single journal
      • Tools: tackler, (h)ledger, beancount
    • month: Shard by transaction date
      • Tools: tackler
    • txn: Shard by transaction (each txn is in own file)
      • Tools: tackler

Usage

For full command line help, see help for each subcommands:

pta-generator help audit
pta-generator help plain
pta-generator help comm

Simple Journal

# Generate 10_000 (1e4) txns single file journals under `data` directory
pta-generator plain --path data --set-size 1e4 --shard-type single --flavor tackler
pta-generator plain --path data --set-size 1e4 --shard-type single --flavor ledger


# Run balance report with this test data
tackler    --config data/plain/set-1e4-single.toml
ledger -no-pager -f data/plain/set-1e4-single/txns/1e4.journal
hledger          -f data/plain/set-1e4-single/txns/1e4.journal

Journal with Commodities

# Generate 10_000 (1e4) txns single file journals under `data` directory
pta-generator comm --path data --set-size 1e4 --shard-type single --flavor tackler
pta-generator comm --path data --set-size 1e4 --shard-type single --flavor ledger
pta-generator comm --path data --set-size 1e4 --shard-type single --flavor beancount

# Run balance report with this test data
tackler    --config data/comm/set-1e4-single.toml
ledger -no-pager -f data/comm/set-1e4-single/txns/1e4.journal bal
hledger          -f data/comm/set-1e4-single/txns/1e4.journal bal
bean-query          data/comm/set-1e4-single/txns/1e4.beancount 'balances from year = 2024'

Journal with Tackler Audit Test Data

Tackler can produce cryptographic proofs of used accounting data with reports. Audit mode produce test data for this.

# Generate 10_000 (1e4) audit txns set ("journal") under `data` directory
pta-generator audit --path data --set-size 1e4 --shard-type month

# Run balance report with this test data
tackler --config data/audit/set-1e4-month.toml

To run full account auditing report, do following extra steps:

cd data/audit/set-1e4-month
git init .
git add .
git commit -m "Journal for year 2024"
cd ../../..

tackler --config data/audit/set-1e4-month.toml --input.storage git

This will produce following report:

Git Storage
         commit : bd3baa9204607d8ef556dcd480ff10703ccfc168
      reference : main
      directory : txns
         suffix : .txn
        message : Journal for year 2024

Txn Set Checksum
        SHA-256 : cd00114244ec332d3aac3c301c9c9d04bb2b4e64e7b0d9e336d59cde04e7693f
       Set size : 10000

**********************************************************************************
Account Selector Checksum
           None : select all


Tackler: 1e4 (10_000) Balance Report
------------------------------------
         -13568.0000848   a:ay2024:am01
...

The commit id will change but Txn Set Checksum will be the same. This identifies uniquely all transactions used to produce this report, and git commit id will verify the content of journal. The report is calculated directly from repository data, the working copy is not used for this and the repository could be even bare.

Installation

# Latest released version
cargo install --locked pta-generator

# Latest development version
cargo install --locked --git https://github.com/tackler-ng/pta-generator

How to install Tackler, Ledger, HLedger and Beancount

You can install tackler directly with cargo:

# Latest released version
cargo install --locked tackler

# Latest development version
cargo install --locked --git https://github.com/tackler-ng/tackler tackler

Full documentation how to install the tools can be found here:

Design

See Design Documentation for high level description of PTA-Generator and possible extension points.

Contributing

See Contributing Guidelines and Developer Documention how to work with the PTA-Generator project.

Security

See Security Policy how to report security findings.

License

PTA-Generator is licensed under the Apache License, version 2.0.

Commit count: 0

cargo fmt