Metadata-Version: 2.4
Name: solyanka
Version: 0.0.1
Summary: Transaction pattern utilities and dataset for statement generators
Author-email: Development Team <dev@company.com>
License:     MIT License
        
            Copyright (c) kvokka. All rights reserved.
        
            Permission is hereby granted, free of charge, to any person obtaining a copy
            of this software and associated documentation files (the "Software"), to deal
            in the Software without restriction, including without limitation the rights
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
            copies of the Software, and to permit persons to whom the Software is
            furnished to do so, subject to the following conditions:
        
            The above copyright notice and this permission notice shall be included in all
            copies or substantial portions of the Software.
        
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
            SOFTWARE
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: jsonschema>=4.23; extra == 'dev'
Requires-Dist: pytest>=8.2; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install solyanka
```

For local development (tests + linters):

```bash
pip install -e ".[dev]"
```

## Usage

```python
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

- `pytest` validates every YAML file against `schema.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

```bash
poetry run pytest
```
