Skip to main content

nomenklatura

Nomenklatura de-duplicates and integrates different Follow the Money entities. It serves to clean up messy data and to find links between different datasets.

screenshot

Usage

You can install nomenklatura via PyPI:

$ pip install nomenklatura

Command-line usage

Much of the functionality of nomenklatura can be used as a command-line tool. In the following example, we'll assume that you have a file containing Follow the Money entities in your local directory, named entities.ijson. If you just want try it out, you can use the file tests/fixtures/donations.ijson in this repository for testing (it contains German campaign finance data).

With the file in place, you will cross-reference the entities to generate de-duplication candidates, then run the interactive de-duplication UI in your console, and eventually apply the judgements to generate a new file with merged entities:

# generate merge candidates using an in-memory index:
$ nomenklatura xref entities.ijson
# note there is now a sqlite database, `nomenklatura.db` that contains de-duplication info.
$ nomenklatura dedupe entities.ijson
# will pop up a user interface.
$ nomenklatura apply entities.ijson -o merged.ijson
# de-duplicated data goes into `merged.ijson`:
$ cat entities.ijson | wc -l 
474
$ cat merged.ijson | wc -l 
468 

The resolver graph database location can be customised by setting the environment variable NOMENKLATURA_DB_URL

Programmatic usage

The command-line use of nomenklatura is targeted at small datasets which need to be de-duplicated. For more involved scenarios, the package also offers a Python API which can be used to control the semantics of de-duplication.

  • nomenklatura.Dataset - implements a basic dataset for describing a set of entities.
  • nomenklatura.Store - a general purpose access mechanism for entities. By default, a store is used to access entity data stored in files as an in-memory cache, but the store can be subclassed to work with entities from a database system.
  • nomenklatura.Index - a full-text in-memory search index for FtM entities. In the application, this is used to block de-duplication candidates, but the index can also be used to drive an API etc.
  • nomenklatura.index.TantivyIndex - a wrapper around Tantivy for indexing and matching FtM entities.
  • nomenklatura.Resolver - the core of the de-duplication process, the resolver is essentially a graph with edges made out of entity judgements. The resolver can be used to store judgements or get the canonical ID for a given entity.

All of the API classes have extensive type annotations, which should make their integration in any modern Python API simpler.

Design

This package offers an implementation of an in-memory data deduplication framework centered around the FtM data model. The idea is the following workflow:

  • Accept FtM-shaped entities from a given loader (e.g. a JSON file, or a database)
  • Build an in-memory inverted index of the entities for dedupe blocking
  • Generate merge candidates using the blocking index and FtM compare
  • Provide a file-based storage format for merge challenges and decisions
  • Provide a text-based user interface to let users make merge decisions

Later on, the following might be added:

  • A web application to let users make merge decisions on the web

Resolver graph

The key implementation detail of nomenklatura is the Resolver, a graph structure that manages user decisions regarding entity identity. Edges are Judgements of whether two entity IDs are the same, not the same, or undecided. The resolver implements an algorithm for computing connected components, which can the be used to find the best available ID for a cluster of entities. It can also be used to evaluate transitive judgements, e.g. if A <> B, and B = C, then we don't need to ask if A = C.

Reading

Contact, contributions etc.

This codebase is licensed under the terms of an MIT license (see LICENSE).

We're keen for any contributions, bug fixes and feature suggestions, please use the GitHub issue tracker for this repository.

Nomenklatura is currently developed thanks to a Prototypefund grant for OpenSanctions. Previous iterations of the package were developed with support from Knight-Mozilla OpenNews and the Open Knowledge Foundation Labs.

Metadata

Release files for nomenklatura-mpt 4.1.35

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nomenklatura-mpt 4.1.35
File Size Uploaded
nomenklatura_mpt-4.1.35.tar.gz 179.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nomenklatura-mpt 4.1.35
File Interpreter ABI Platform
nomenklatura_mpt-4.1.35-py3-none-any.whl Python 3 none any Details

Total release size: 422.6 kB

Release files / nomenklatura_mpt-4.1.35.tar.gz

Download URL nomenklatura_mpt-4.1.35.tar.gz
Size 179.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ba2457f27cf13fd09095391451bf5677ea5b8cc3b09806a1a6a79c1eaf9b88d9
BLAKE2b-256 checksum
How to use checksums
41e72482b03e9edb287b83d47752ec77eb35ecad638c4b3cfd469734190525c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / nomenklatura_mpt-4.1.35-py3-none-any.whl

Download URL nomenklatura_mpt-4.1.35-py3-none-any.whl
Size 242.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36abd1afb096308cab6706f4872db596adec3183a710d4fd2976f7bc5c193909
BLAKE2b-256 checksum
How to use checksums
1cc115c12e293f4d6a0a4a7b749712a570ca4b9f1b57f7fde9f65cbac63000ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

4.1.35 This release

2 release files

4.1.34

2 release files

4.1.32

2 release files

4.1.31

2 release files

4.1.30

2 release files

4.1.29

2 release files

4.1.28

2 release files

4.1.27

2 release files

4.1.26

2 release files

4.1.25

2 release files

4.1.24

2 release files

4.1.23

2 release files

4.1.22

2 release files

4.1.21

2 release files

4.1.20

2 release files

4.1.19

2 release files

4.1.18

2 release files

4.1.17

2 release files

4.1.15

2 release files

4.1.14

2 release files

4.1.13

2 release files

4.1.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page