Metadata-Version: 2.4
Name: dpm-tool
Version: 0.1.1
Summary: Textual TUI for EIOPA Solvency II DPM: ingest annotated-templates workbooks, diff versions, and roll deltas onto XBRL instances.
Author-email: ZvNico <nicolas.baconnier@efrei.net>
License-Expression: MIT
Project-URL: Homepage, https://github.com/ZvNico/michael
Project-URL: Repository, https://github.com/ZvNico/michael
Project-URL: Issues, https://github.com/ZvNico/michael/issues
Keywords: eiopa,solvency-ii,dpm,xbrl,regulatory-reporting,tui
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: duckdb>=1.1.0
Requires-Dist: lxml>=6.1.1
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: platformdirs>=4.0.0
Requires-Dist: polars>=1.42.1
Requires-Dist: pyarrow>=25.0.0
Requires-Dist: textual>=0.80.0
Requires-Dist: textual-fspicker>=1.0.1
Requires-Dist: xlsxwriter>=3.2.0
Dynamic: license-file

# dpm-tool

A terminal UI toolkit for working with the EIOPA Solvency II **Data Point Model
(DPM)**. It ingests the official annotated-templates workbooks into local
databases, compares two DPM versions to produce a reviewable delta, and rolls
that delta forward onto your XBRL instance documents.

Everything runs in a [Textual](https://textual.textualize.io/) TUI — no
subcommands to memorise.

---

## Install

```bash
uv tool install dpm-tool     # as a standalone tool
# or, inside a project
uv add dpm-tool
```

Requires Python ≥ 3.12.

## Run

```bash
dpm-tool
```

This launches the **EIOPA DPM Toolkit** home screen. Navigate with the arrow
keys, `Enter` to select, `Esc` to go back, `s` for settings, `q` to quit.

---

## What it does

The home screen exposes five workflows:

| Screen | What it does |
| --- | --- |
| **⇩ DPM Ingest** | Parse an EIOPA annotated-templates workbook into a versioned local database (`db/versions/<version>.duckdb`). |
| **Δ DPM Delta** | Compare two ingested versions and export a reviewable delta workbook (`Delta_DPM.xlsx`). |
| **⇄ XBRL Apply Delta** | Roll the delta between two versions forward onto an XBRL instance, writing a new file (the input is never modified). |
| **⌕ Explore Database** | Browse an ingested DPM database — templates, metrics, dimensions and their members. |
| **≠ Explore Delta** | Browse the computed changes between two versions interactively. |

### Typical flow

1. **Add the versions you track** in **Settings** (`s`). The tool can download
   the official workbooks straight from EIOPA, or you can supply an explicit URL
   for the odd hotfix build.
2. **Ingest** the old and new workbooks into versioned databases.
3. **Delta** the two versions to review what changed, or **Apply Delta** to
   update your XBRL instances.

---

## How the XBRL update works

When applying a delta to an XBRL instance:

- **Deleted** metric — matching facts are removed.
- **Modified** metric with a changed QName — the fact tag is renamed.
- **Added** metric — ignored (no value or context can be inferred).
- **Kept** metric — left unchanged.

The perimeter is auto-detected from the instance's `schemaRef`
(e.g. `.../mod/qrs.xsd` → `qrs`) and can be overridden. A dry-run mode reports
what *would* change without writing output.

---

## Data & config layout

Data and config live in per-user platform directories so the tool works from any
working directory (`~/.local/share/dpm-tool` and `~/.config/dpm-tool` on Linux;
the OS-appropriate equivalents on macOS/Windows).

| Path | Contents |
| --- | --- |
| `<data>/db/versions/` | Ingested DPM version databases (DuckDB). |
| `<data>/db/delta/` | Cached delta databases computed between two versions. |
| `<data>/downloads/` | Source workbooks downloaded from EIOPA. |
| `<config>/config.json` | Tracked versions and the selected UI theme. |

Set `DPM_TOOL_HOME` to override the root and keep everything under one directory.

---

## Development

```bash
uv sync          # install with dev dependencies
uv run dpm-tool  # run from source
uv run pytest    # run the test suite
```

## License

MIT — see [LICENSE](LICENSE).
