Transaction pattern utilities and dataset for statement generators
Project description
Solyanka
Shared helpers and datasets that power the statement generators and downstream synthetic-data pipelines (including LLM fine-tuning sets). The first module exported by this repository focuses on transaction patterns: the curated YAML files, the schema that keeps them in shape, and a tiny loader to consume them from any application (FastAPI, CLI tools, notebooks, etc).
Installation
pip install solyanka
For local development (tests + linters):
pip install -e ".[dev]"
Usage
from solyanka import PatternsService, EEA_COUNTRIES
service = PatternsService()
general = service.load_general_patterns()
eea = service.load_eea_patterns()
thailand_specific = service.load_country_patterns("Thailand")
# Preferred helper: auto-mix general + (eea) + country overrides
full_set = service.get_country_patterns("Germany")
# Advanced filtering (e.g. validation scripts)
custom = service.get_patterns(country="Germany", include="general,eea")
# API-friendly dicts
payload = service.get_pattern_dicts(country="Spain")
If you need to point the loader to different files (e.g. while editing YAML locally),
either pass PatternsService(base_dir=Path("./transaction_patterns")) or set the
TRANSACTION_PATTERNS_DIR environment variable.
Pattern sets
- General – always included via
load_general_patterns(). - EEA – supplement auto-applied for EEA countries via
load_eea_patterns(). - Country-specific – call
load_country_patterns("Germany"); the helper normalizes slugs internally.
get_country_patterns(country) mixes general + (EEA when applicable) + country-level patterns and accepts empty/None values.
get_patterns(country, include) exposes finer control when tooling needs only certain slices. include accepts a comma-separated subset of {"general", "eea", "country"}; invalid values raise ValueError.
get_pattern_dicts(...) mirrors these parameters but returns normalized dictionaries that are ready for JSON responses.
Development
pytestvalidates every YAML file againstschema.json.- GitHub Actions run tests on push/pull_request and build/publish artifacts when a semver tag is pushed.
Contributions should keep the dataset human-friendly: no generated UUIDs in the patterns, clear field names, and comments that help reviewers understand why a pattern exists.
Tests
poetry run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solyanka-0.0.1.tar.gz.
File metadata
- Download URL: solyanka-0.0.1.tar.gz
- Upload date:
- Size: 44.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
081c4c30b55bdf9d5de699f66a892fa527cf9f565c3aa3fc5d92cd8f2491fd09
|
|
| MD5 |
58ea2a299ff7d4f82a49ddcf10e39901
|
|
| BLAKE2b-256 |
b52c20f7ebf4549ed8ba0c3429dd690ff5192536b067ea7bc8225658660c78d3
|
File details
Details for the file solyanka-0.0.1-py3-none-any.whl.
File metadata
- Download URL: solyanka-0.0.1-py3-none-any.whl
- Upload date:
- Size: 54.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9833f5f803408dbdb2e15d1c5a7669db4d850e89f5f2116fa4e618d939eab417
|
|
| MD5 |
462437729a5ce6591cda8e7374da068f
|
|
| BLAKE2b-256 |
57a5b99c715d68813d1a9374f2c9532d0a15678f4ef22c439f10600c1a4de10f
|