GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Meaningful-Data/dpmcore: Your toolkit for DPM

BranchesTags
Open more actions menu

Latest commit

 

History

1,594 Commits
1,594 Commits

Folders and files

NameName
Last commit message
Last commit date
.agent
.agent
 
 
.claude
.claude
 
 
.github
.github
 
 
docs
docs
 
 
scripts
scripts
 
 
specification
specification
 
 
src/dpmcore
src/dpmcore
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
README.rst
README.rst
 
 
SECURITY.md
SECURITY.md
 
 
poetry.lock
poetry.lock
 
 
poetry.toml
poetry.toml
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

dpmcore

A Python library that implements the DPM (Data Point Model) 2.0 Refit standard for regulatory reporting. It provides an ORM, services layer, and REST API that can be used independently or together in three deployment modes.

Installation

pip install dpmcore

Optional extras:

pip install dpmcore[migration]   # Access database migration (pandas)
pip install dpmcore[data]        # Pandas support (semantic validation, scope calculation)
pip install dpmcore[server]      # FastAPI REST server
pip install dpmcore[django]      # Django integration
pip install dpmcore[postgres]    # PostgreSQL backend
pip install dpmcore[sqlserver]   # SQL Server backend
pip install dpmcore[cli]         # Command-line interface
pip install dpmcore[all]         # Everything

Quick Start

Mode 1 — Standalone Library

Use dpmcore as a plain Python library. No web framework or HTTP server required.

Connect to a database:

from dpmcore import connect

# SQLite
db = connect("sqlite:///path/to/dpm.db")

# PostgreSQL
db = connect("postgresql://user:pass@host:5432/dpm_db")

# With connection pool options
db = connect(
    "postgresql://user:pass@host:5432/dpm_db",
    pool_config={"pool_size": 20, "max_overflow": 10},
)

Validate a database (shallow shape + seed-data sanity check):

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    result = db.validate_schema()
    print(result.is_valid)                # True / False
    print(result.missing_tables)          # []
    print(result.empty_required_tables)   # []

Or from the command line (exits non-zero on failure, suitable for CI healthchecks):

dpmcore validate --database sqlite:///dpm.db
dpmcore validate --database sqlite:///dpm.db --json

Syntax validation (no database needed):

from dpmcore.services import SyntaxService

syntax = SyntaxService()

result = syntax.validate("{tC_01.00, r0100, c0010} + {tC_01.00, r0200, c0010}")
print(result.is_valid)       # True
print(result.error_message)  # None

result = syntax.validate("invalid {{{{")
print(result.is_valid)       # False
print(result.error_message)  # "offendingSymbol: ..."

Semantic validation (requires database):

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    result = db.services.semantic.validate(
        "{tC_01.00, r0100, c0010} + {tC_01.00, r0200, c0010}",
        release_code="4.2.1",       # or release_id=<int>
    )
    print(result.is_valid)
    print(result.warning)

Engine-ready validations script:

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    ast_svc = db.services.ast_generator

    script = ast_svc.script(
        expressions=[
            ("{tC_01.00, r0100, c0010} = {tC_01.00, r0200, c0010}", "v0001"),
            ("{tC_01.00, r0200, c0010} > 0",                        "v0002"),
        ],
        preconditions=[
            ("{is_reporting_entity}", ["v0001", "v0002"]),
        ],
        module_code="COREP_Con",
        module_version="2.0.1",
        severity="warning",                # global default (default: "warning")
        severities={"v0002": "error"},     # per-validation override
        release="4.2",                     # optional; latest available if omitted
    )
    # script["enriched_ast"] is keyed by the resolved module URI:
    #   {namespace_uri: {module_code, module_version, framework_code,
    #                    dpm_release, dates, operations, variables, tables,
    #                    preconditions, precondition_variables,
    #                    dependency_information, dependency_modules}}
    # script["failed_operations"] lists expressions that were skipped due to
    # semantic errors (e.g. grey cells): {validation_code: error_message}
    namespace, ns_block = next(iter(script["enriched_ast"].items()))
    print(ns_block["dpm_release"])          # {"release": "...", "publication_date": "..."}
    print(ns_block["operations"])           # {validation_code: {ast, severity, ...}}
    print(script["failed_operations"])      # {validation_code: error_message} or {}

preconditions, severities and release are all optional. Severity resolution per validation is severities.get(code, severity); values must be one of error, warning, info (case-insensitive). Codes in severities that are not present in expressions raise ValueError. When release is omitted, dpmcore resolves the latest release whose window contains the requested (module_code, module_version) and embeds it in the resulting dpm_release block.

The same script generation is exposed via the CLI and the REST API. The CLI input file mirrors the Python shape:

{
    "expressions": [
        ["{tC_01.00, r0100, c0010} = {tC_01.00, r0200, c0010}", "v0001"]
    ],
    "preconditions": [
        ["{is_reporting_entity}", ["v0001"]]
    ],
    "severities": {"v0001": "error"}
}
dpmcore generate-script \
    --expressions ./rules.json \
    --module-code COREP_Con --module-version 2.0.1 \
    --severity warning --release 4.2 \
    --database sqlite:///dpm.db --output ./script.json
curl -X POST http://localhost:8000/api/v1/scripts \
    -H 'content-type: application/json' \
    -d '{
          "expressions":[["{tC_01.00, r0100, c0010} = {tC_01.00, r0200, c0010}","v0001"]],
          "preconditions":[{"expression":"{is_reporting_entity}","validation_codes":["v0001"]}],
          "severities":{"v0001":"error"},
          "release":"4.2",
          "module_code":"COREP_Con",
          "module_version":"2.0.1"
        }'

Auto-discovered script (no expressions file needed):

generate-script requires the caller to already know every validation's expression text. export-script instead discovers the active validations, preconditions and severities for a module version directly from the database (OperationScope / OperationScopeComposition / OperationVersion):

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    script = db.services.ast_generator.script_for_module(
        module_code="COREP_Con",
        module_version="2.0.1",
        release="4.2",  # optional; latest available if omitted
        publication_date="2027-01-15",  # optional; latest release's date if omitted
    )
dpmcore export-script \
    --module-code COREP_Con --module-version 2.0.1 \
    --database sqlite:///dpm.db --output ./script.json

Unlike script(), the dpm_release block of an exported script names the database it was exported from: its latest Release row by date (e.g. 4.4 for the DPM 4.4 database), the same for every target in a sweep — whatever release the module version's content is resolved at. Its publication_date is that release's date unless --dpm-publication-date YYYY-MM-DD (publication_date= in Python) is given.

Severities come from OperationScope.Severity in the database rather than a manual --severity override. --output is optional for a single target; when omitted, the script is written to <module_code>-<module_version>.json in the current directory. Unlike script()'s Python return value above, the file export-script writes holds only enriched_ast's content — failed_operations is printed to the console instead (skipped-validation reasons, next to the discovered count), not written to the file.

Bulk export (--all-modules/--all-versions):

Sweep every module and/or every active version of a module. --output becomes a directory — one <module_code>-<module_version>.json file is written per discovered target (defaults to the current directory when omitted). A target that fails to resolve is skipped with a warning instead of aborting the whole sweep; the command exits non-zero if any target failed.

# Every version of every module
dpmcore export-script --all-modules --all-versions \
    --database sqlite:///dpm.db --output ./scripts/

# Every version of one module
dpmcore export-script --module-code COREP_Con --all-versions \
    --database sqlite:///dpm.db --output ./scripts/

# Every module, pinned to its version active at one release (no
# --all-versions: exactly one file per module)
dpmcore export-script --all-modules --release 4.2 \
    --database sqlite:///dpm.db --output ./scripts/

--module-code/--all-modules are mutually exclusive, and one is required. --module-version cannot be combined with --all-modules (a version number isn't portable across modules). Exactly one of --module-version, --all-versions, or --release is required, and the three are pairwise mutually exclusive — a bare --release (no --module-version/--all-versions) resolves each selected module to its single version active at that release, instead of naming a version directly.

Patching known EBA data-quality issues:

A fixed set of ~30 validations reproduce a source-data error faithfully — an empty/zero default that should be absent, a literal typed Integer where the engine expects Boolean, etc. — because the underlying DPM database data is wrong for them, not because of a generation bug. EBA doesn't amend already-published releases, so these stay wrong indefinitely; fix-script patches an already-generated script's JSON in place. Run it after every export-script/generate-script run, not just once:

# A single script file
dpmcore fix-script --input-path ./script.json

# Every script in a directory (e.g. after a bulk export-script sweep)
dpmcore fix-script --input-path ./scripts/ --bulk

Only rewrites a file when something in it actually matched a known issue; prints which validations were patched per file.

Calculations export:

Export a module version's calculations — the operations linked to it through OperationOutput, the ones that write into it — as the JSON the downstream deployment consumes. The calculations are parsed as one script, reordered so a calculation follows the ones it consumes, and serialized with every operand resolved to its datapoints. Two files are written: the export, with the module's URI in module_uri, and a companion datapoint map.

dpmcore export-calculations --module-code KRI \
    --reference-date 2026-12-31 \
    --database sqlite:///dpm.db --output ./kri.json

The reference date selects the module version: exactly one must be valid at it. Cells are read from each table's live version — open now and already published — rather than the version effective at the module's release, so a table version introduced only in a working (Playground) release never contributes datapoints. The command needs a database carrying the OperationOutput table, which the Access DPM 2.0 distribution only has from release 4.4 onwards (empty there as of 4.4).

Calculations dependency graph:

Turn DPM-XL operations into a single self-contained HTML dependency graph — one node per operation, one arrow per dependency, roots highlighted, click-to-inspect, search and re-layout. The rendering libraries are embedded inline so the file opens offline. Dependencies are always resolved by the engine against the DPM dictionary — ranges and wildcards expand to exact cells — so --database is required in every mode. Three input sources:

# A Code,Expression CSV, resolved against the dictionary
dpmcore generate-graph calculations_script.csv --database sqlite:///dpm.db -o graph.html

# Inline expressions (no file needed)
dpmcore generate-graph -e "calc1={tA, r1, c1} <- {tB, r1, c1}" --database sqlite:///dpm.db -o graph.html

# The DPM dictionary directly (filter to keep the graph readable)
dpmcore generate-graph --database sqlite:///dpm.db --table C_01.00 -o graph.html

Data dictionary queries:

Release-aware methods accept release_id (integer ID) or release_code (a code string like "4.2.1"). At most one may be supplied; passing both raises ValueError.

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    dd = db.services.data_dictionary

    releases = dd.get_releases()
    tables   = dd.get_tables(release_code="4.2.1")
    items    = dd.get_all_item_signatures(release_code="4.2.1")
    table    = dd.get_table_version("C_01.00", release_code="4.2.1")
    cats     = dd.get_item_categories(release_code="4.2.1")

    # Cell coordinates -> variable ids. Scope: a module version (resolved
    # to its release as script() does) or a release, not both. A missing
    # row/column/sheet matches a cell without that axis (no sheets, or the
    # open axis of an open table).
    cells = dd.resolve_cell_variables(
        [
            {"table": "C_67.00.a", "row": "0010", "column": "0060",
             "sheet": "0010"},
            {"table": "C_67.00.a", "row": "0010", "column": "0010",
             "sheet": "0010"},
        ],
        module_code="COREP_ALM",
        module_version="3.3.0",
    )
    # [{"table": "C_67.00.a", "row": "0010", "column": "0060",
    #   "sheet": "0010", "variable_id": 117387, "error": None},
    #  {"table": "C_67.00.a", "row": "0010", "column": "0010",
    #   "sheet": "0010", "variable_id": None, "error": "grey_cell"}]
    # "error" is None, "grey_cell" (the cell carries no variable),
    # "cell_not_found" (no such non-void cell at that scope) or
    # "table_not_in_module" (module scope only: the module version is not
    # composed of that table).

Operation scope calculation:

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    result = db.services.scope_calculator.calculate_from_expression(
        expression="{tC_01.00, r0100, c0010} = {tC_01.00, r0200, c0010}",
        release_code="4.2.1",       # or release_id=<int>
    )
    print(result.total_scopes)
    print(result.module_versions)

Expression metadata — tables / headers / frameworks touched by an expression:

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    meta = db.services.expression_metadata
    expr = "{tF_01.01, r0010, c0010} = 100"

    tables = meta.get_referenced_tables(expr, release_code="4.2.1")
    headers = meta.get_referenced_headers(expr, release_code="4.2.1")
    frameworks = meta.get_referenced_frameworks(expr, release_code="4.2.1")

    # Each entry is a plain dict — no ORM instances leak.
    # header_type reflects the axis USED in the expression
    # (r*→"Row", c*→"Column", s*→"Sheet"), not Header.direction.

Explorer — reverse lookups:

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    explorer = db.services.explorer

    var = explorer.get_variable_by_code("mi123", release_code="4.2.1")
    usage = explorer.get_variable_usage(variable_vid=99,
                                        release_code="4.2.1")
    tables = explorer.search_table("C_01", release_code="4.2.1")

Hierarchy — framework / module / table tree:

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    hierarchy = db.services.hierarchy

    # Flat framework rows (default) — every Framework, no filtering
    frameworks = hierarchy.get_all_frameworks()

    # Deep tree: framework -> module_versions -> table_versions
    tree       = hierarchy.get_all_frameworks(deep=True)

    # Filter by release code — preferred over numeric release_id,
    # which is opaque from DPM 4.2.1 onwards.
    by_code    = hierarchy.get_all_frameworks(
        deep=True, release_code="4.2.1"
    )

    # Filter by business date — resolves via ModuleVersion validity range
    today_tree = hierarchy.get_all_frameworks(deep=True, date="2025-06-30")

    module     = hierarchy.get_module_version("F_01.01", release_code="4.2")
    tables     = hierarchy.get_tables_for_module(
        "F_01.01", release_code="4.2"
    )
    details    = hierarchy.get_table_details(
        "tC_01.00", release_code="4.2"
    )

    # Per-header modelling metadata (main property + context property/item)
    modelling  = hierarchy.get_table_modelling(
        "tC_01.00", release_code="4.2"
    )

get_all_frameworks, get_table_details, and get_table_modelling accept up to one of release_id / release_code / date; get_module_version and get_tables_for_module accept release_id or release_code only (no date). Passing more than one raises ValueError, and an unknown release_code also raises. When no filter is supplied, get_module_version and get_all_frameworks fall back to the currently-active (end_release_id IS NULL) module versions, so results stay deterministic when a module has been republished across releases.

Tip. Prefer release_code for human input — the numeric ReleaseID is opaque from DPM 4.2.1 onwards. Both resolve to the same release, and any release code format is accepted.

Migration — import from Access:

from dpmcore import connect

# Via DpmConnection (uses the connection's engine)
with connect("sqlite:///dpm.db") as db:
    result = db.services.migration.migrate_from_access("/path/to/dpm.accdb")
    print(f"Migrated {result.tables_migrated} tables, {result.total_rows} rows")
# Standalone usage with any SQLAlchemy engine
from sqlalchemy import create_engine
from dpmcore.loaders.migration import MigrationService

engine = create_engine("postgresql://user:pass@host/dpm_db")
service = MigrationService(engine)
result = service.migrate_from_access("/path/to/dpm.accdb")

Or from the command line:

pip install dpmcore[cli,migration]
dpmcore migrate --source /path/to/dpm.accdb --database sqlite:///dpm.db

Migration — copy from another DPM database:

An existing DPM database (SQLite, PostgreSQL or SQL Server) can be the source instead of an Access file, for example to hand out a dictionary kept in SQL Server as a SQLite file:

from sqlalchemy import create_engine
from dpmcore.loaders.migration import MigrationService

source = create_engine(
    "mssql+pyodbc://user:pass@host/DPM?driver=ODBC+Driver+18+for+SQL+Server"
)
target = create_engine("sqlite:///dpm.db")

result = MigrationService(target).migrate_from_database(
    source,
    source_schema=None,  # the source's default schema when omitted
)
print(result.table_details, result.warnings)
dpmcore migrate --source-db "mssql+pyodbc://..." [--source-schema dbo] \
    --database sqlite:///dpm.db [--output dpm_draft.db]

Only the tables defined in the dpmcore ORM are copied, with the whole release history; other tables in the source are ignored. All tables are read in one transaction (SNAPSHOT isolation on SQL Server when the database has ALLOW_SNAPSHOT_ISOLATION ON; otherwise the copy still runs and a warning is reported). The target's tables are dropped and recreated, so the command refuses to run when source and target are the same database. See the migration guide for details.

Breaking change. Databases migrated with dpmcore 0.2.1rc3 or earlier are not readable by later versions. The ORM now maps TableAssociation.StartReleaseID/EndReleaseID, OperandReference.OperationVID and OperationOutput.OwnerID, added by the DPM 4.4 Access release, so queries on those tables fail against a database that lacks them. Regenerate the database from the Access file (dpmcore migrate or dpmcore update-db --access-file); dpmcore validate reports the missing columns.

Update database (requires migration extra):

Safely replace an existing DPM database with fresh data. Data is loaded into a temporary staging area and validated before the active database is touched. If anything fails the original database is left intact.

  • SQLite — loads into a temp file; the target .db is swapped only after validation passes.
  • PostgreSQL / SQL Server — loads into a staging schema; swapped atomically into the active position after validation.
from dpmcore.services.database_update import DatabaseUpdateService

result = DatabaseUpdateService().update(
    target="sqlite:///dpm.db",          # SQLite path or URL, PostgreSQL/SQL Server URL
    access_file="/path/to/dpm.accdb",   # or source_dir="..." for pre-exported CSVs
    ecb_validations_file="ecb.csv",     # optional
    dry_run=False,
    keep_staging=False,
)
print(f"Updated {result.target_type} database — "
      f"{result.migration_result.tables_migrated} tables, "
      f"{result.migration_result.total_rows} rows")

Or from the command line:

# Update a SQLite database from a pre-exported CSV directory
dpmcore update-db --target dpm.db --source-dir ./csv_export

# Update from an Access file
dpmcore update-db --target dpm.db --access-file /path/to/DPM_v4_2_1.accdb

# Dry run — validate only, do not replace active database
dpmcore update-db --target dpm.db --dry-run

# PostgreSQL
dpmcore update-db --target postgresql://user:pass@localhost:5432/dpm

# SQL Server
dpmcore update-db \
    --target "mssql+pyodbc://user:pass@server/dpm?driver=ODBC+Driver+17+for+SQL+Server"

The --target option accepts a bare SQLite filename (dpm.db, dpm.sqlite, dpm.sqlite3), a sqlite:/// URL, a postgresql:// URL, or a mssql+pyodbc:// URL. Use --keep-staging to retain the temporary file / schema for debugging.

Export Access to CSV (requires migration extra and mdb-tools):

Export every user table from an .accdb / .mdb file to individual CSV files. Tables are exported in parallel (up to 8 workers).

from pathlib import Path
from dpmcore.services.export_csv import ExportCsvService

result = ExportCsvService().export("/path/to/dpm.accdb", Path("data/DPM"))
print(f"Exported {result.tables_exported} tables to {result.output_dir}")

Or from the command line:

dpmcore export-csv /path/to/dpm.accdb --output-dir data/DPM

The --output-dir option defaults to data/DPM.

Build Meilisearch JSON (requires migration extra):

Generate a Meilisearch-ready JSON document that contains all DPM operation versions with their scopes, module assignments, operand references, and version history. The pipeline is: Access → CSV → in-memory SQLite → JSON (the CSV and SQLite steps are handled transparently when access_file is supplied).

from dpmcore.services.meili_build import MeiliBuildService

# From a directory of pre-exported CSV tables
result = MeiliBuildService().build(
    output_file="operations.json",
    source_dir="./csv_export",
)
print(f"Wrote {result.operations_written} operations to {result.output_file}")

# Directly from an Access file — CSV export is handled transparently
result = MeiliBuildService().build(
    output_file="operations.json",
    access_file="/path/to/dpm.accdb",
    ecb_validations_file="validation_versions.csv",  # optional
)

Or from the command line:

# From a pre-exported CSV directory
dpmcore build-meili-json --source-dir ./csv_export --output operations.json

# Directly from an Access file
dpmcore build-meili-json --access-file /path/to/dpm.accdb --output operations.json

# With optional ECB validations CSV
dpmcore build-meili-json --access-file /path/to/dpm.accdb \
    --ecb-validations-file validation_versions.csv \
    --output operations.json

The --output option defaults to operations.json. --source-dir and --access-file are mutually exclusive.

Export table layouts (Excel):

Export annotated table layouts to .xlsx for review or distribution. You can export all tables in a module, or a specific list of tables.

from dpmcore import connect
from dpmcore.services.layout_exporter.models import ExportConfig

config = ExportConfig(
    annotate=True,
    add_cell_comments=True,
    add_header_comments=True,
)

with connect("sqlite:///dpm.db") as db:
    svc = db.services.layout_exporter

    # Whole module
    svc.export_module("FINREP9", release_code="4.2", output_path="finrep9.xlsx",
                      config=config)

    # Specific tables
    svc.export_tables(["F_01.01", "F_01.02"], release_code="4.2",
                      output_path="finrep_subset.xlsx", config=config)

An abstract table code (e.g. F_16.07.1) exports its child tables valid in the release, one sheet per child (F_16.07.1.a, F_16.07.1.b), as in the annotated templates.

Or from the command line:

# Whole module
dpmcore export-layout --database sqlite:///dpm.db \
    --module FINREP9 --release 4.2 --output finrep9.xlsx

# Specific tables
dpmcore export-layout --database sqlite:///dpm.db \
    --tables F_01.01,F_01.02 --release 4.2 --output finrep_subset.xlsx

Use --no-annotate or --no-comments to disable annotations/comments, and --no-derive-missing-variables to leave the cells whose variable has not been generated yet empty instead of filling them in from the table structure.

Unified facade:

from dpmcore import connect

with connect("sqlite:///dpm.db") as db:
    dpm_xl = db.services.dpm_xl

    dpm_xl.validate_syntax("{tC_01.00, r0100, c0010}")
    dpm_xl.validate_semantic(
        "{tC_01.00, r0100, c0010}", release_code="4.2.1",
    )

Direct ORM access:

from dpmcore import connect
from dpmcore.orm.infrastructure import Release

with connect("sqlite:///dpm.db") as db:
    session = db.orm
    releases = session.query(Release).all()

Mode 2 — Web Application (REST API)

Requires the server extra: pip install dpmcore[server]

Start a ready-to-run FastAPI server exposing SDMX-inspired endpoints:

dpmcore serve --database sqlite:///dpm.db --port 8000

Then browse the interactive API docs at http://localhost:8000/api/v1/docs.

Mode 3 — Django Integration

Requires the django extra: pip install dpmcore[django]

Add dpmcore to your Django project:

# settings.py
INSTALLED_APPS = [
    "dpmcore.django",
    # ... your apps ...
]

This registers DPM models in Django admin, adds management commands, and exposes REST endpoints mountable in your URL configuration.

Architecture

+---------------------------------------------------------------+
|                   Consumer Applications                        |
|  (Django apps, CLI tools, Jupyter notebooks, scripts, ...)     |
+---------------------------------------------------------------+
|                                                                |
|  +-----------+  +----------------+  +-----------------------+  |
|  | REST API  |  |    Services    |  |     Direct ORM        |  |
|  | (FastAPI) |  |                |  |      access           |  |
|  |           |  |  SyntaxService |  |                       |  |
|  | SDMX-like |  |  SemanticSvc   |  |  session.query(...)   |  |
|  | endpoints |  |  ASTGenerator  |  |  select(Model).where  |  |
|  |           |  |  ScopeCalc     |  |                       |  |
|  +-----------+  +----------------+  +-----------------------+  |
|        |                |                     |                |
|  +-----+----------------+---------------------+----------+     |
|  |                     ORM Layer                          |    |
|  |                                                        |    |
|  |  Models . Relationships . Views . Session Management   |    |
|  |  Multi-DB: SQLite / PostgreSQL / SQL Server            |    |
|  +------------------------------+------------------------+    |
|                                  |                             |
+----------------------------------+-----------------------------+
                                   |
                           +-------+--------+
                           |    Database    |
                           +----------------+

Package Layout

src/dpmcore/
├── __init__.py            connect(), __version__
├── connection.py          DpmConnection
├── errors.py              Exception hierarchy
├── orm/
│   ├── base.py            DeclarativeBase, engine, session
│   ├── infrastructure.py  Concept, Organisation, Release, ...
│   ├── glossary.py        Category, Item, Property, Context, ...
│   ├── rendering.py       Table, TableVersion, Header, Cell, ...
│   ├── variables.py       Variable, VariableVersion, CompoundKey, ...
│   ├── operations.py      Operation, OperationVersion, Scope, ...
│   └── packaging.py       Framework, Module, ModuleVersion, ...
├── services/              read-only DPM dictionary services
│   ├── syntax.py          SyntaxService     (no DB)
│   ├── semantic.py        SemanticService
│   ├── ast_generator.py   ASTGeneratorService (engine-ready)
│   ├── scope_calculator.py ScopeCalculatorService
│   ├── expression_metadata.py ExpressionMetadataService
│   ├── data_dictionary.py DataDictionaryService
│   ├── explorer.py        ExplorerService
│   ├── hierarchy.py       HierarchyService
│   ├── dpm_xl.py          DpmXlService (facade)
│   ├── export_csv.py      ExportCsvService (Access → CSV)
│   ├── meili_build.py     MeiliBuildService (end-to-end pipeline)
│   ├── meili_json.py      MeiliJsonService (JSON generation)
│   ├── database_update.py DatabaseUpdateService (atomic DB update)
│   ├── layout_exporter/   LayoutExporterService (tables → .xlsx)
│   └── calculations_graph/ CalculationsGraphService (engine-resolved HTML graph)
├── loaders/               data-loading (mutates the DB)
│   └── migration.py       MigrationService (Access import)
├── server/                FastAPI REST app (optional, [server] extra)
│   ├── app.py             ASGI app factory + SDMX-inspired endpoints
│   └── routers/           scope, scripts, structure
├── django/                Django integration app (models, admin, views)
├── cli/
│   └── main.py            Click CLI (migrate, export-csv, build-meili-json, update-db, serve, generate-script, export-script, fix-script, export-layout)
└── dpm_xl/                DPM-XL engine internals
    ├── grammar/           ANTLR4 grammar + generated parser
    ├── ast/               AST nodes, visitor, operands
    ├── operators/         Arithmetic, comparison, boolean, ...
    ├── types/             Scalar, time, promotion
    ├── utils/             Serialization, scope calculator, ...
    └── model_queries.py   Query compatibility layer

Development

# Install all dependencies (including dev tools)
poetry install --all-extras

# Run tests
poetry run pytest

# Linting and formatting
poetry run ruff check src/ tests/
poetry run ruff format src/ tests/

# Type checking
poetry run mypy src/

License

Apache-2.0 — see LICENSE for details.

About

Your toolkit for DPM

docs.dpmcore.meaningfuldata.eu/

Topics

dpmeba

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

4 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.