Skip to main content

Make record linkages in followthemoney data.

Project description

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 new file, `entities.rslv.ijson` that contains de-duplication info.
$ nomenklatura dedupe entiites.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 entities.ijson
$ cat entities.ijson | wc -l 
468 merged.ijson

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.Loader - a general purpose access mechanism for entities. By default, a nomenklatura.FileLoader is used to access entity data stored in files, but the loader 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.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.

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

nomenklatura-2.6.5.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

nomenklatura-2.6.5-py3-none-any.whl (69.4 kB view details)

Uploaded Python 3

File details

Details for the file nomenklatura-2.6.5.tar.gz.

File metadata

  • Download URL: nomenklatura-2.6.5.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for nomenklatura-2.6.5.tar.gz
Algorithm Hash digest
SHA256 2d0c59b2b98374ca2d7e9586dd7f1f8fdb21fc2cc28be7d0709b745e457c12d0
MD5 6de5cdeeafab48e4feadc2e2fbbf8638
BLAKE2b-256 abc533b0ad5c68a942991131e0cfbe380643f8ba33a9d3ee08b53ae453cfa81d

See more details on using hashes here.

File details

Details for the file nomenklatura-2.6.5-py3-none-any.whl.

File metadata

  • Download URL: nomenklatura-2.6.5-py3-none-any.whl
  • Upload date:
  • Size: 69.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for nomenklatura-2.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d214757db3d8e292f216a0cb234341e4db966ef02d506669f21726e53c001f48
MD5 62aa00f3bd59b78eb1ee89f2edc4fa2a
BLAKE2b-256 20740ead77e8ef417f9b16d3eba746c3f095b7eab29ddfedcfc61bcd324e4ad7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page