# nomenklatura
Nomenklatura de-duplicates and integrates different [Follow the Money](https://followthemoney.rtfd.org/) entities. It serves to clean up messy data and to find links between different datasets.
![screenshot](./docs/screenshot.png)
## Usage
You can install `nomenklatura` via PyPI:
```bash
$ 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](https://followthemoney.rtfd.org/) 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:
```bash
# generate merge candidates using an in-memory index:
$ nomenklatura xref -r resolver.json entities.ijson
# note there is now a new file, `resolver.json` that contains de-duplication info.
$ nomenklatura dedupe -r resolver.json entites.ijson
# will pop up a user interface.
$ nomenklatura apply entities.ijson -o merged.ijson -r resolver.json
# de-duplicated data goes into `merged.ijson`:
$ cat entities.ijson | wc -l
474
$ cat merged.ijson | wc -l
468
```
### 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
* https://dedupe.readthedocs.org/en/latest/
* https://github.com/OpenRefine/OpenRefine/wiki/Reconcilable-Data-Sources
* https://github.com/OpenRefine/OpenRefine/wiki/Clustering-In-Depth
* https://github.com/OpenRefine/OpenRefine/wiki/Reconciliation-Service-API
## 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](https://opensanctions.org). Previous iterations of the package were developed with support from [Knight-Mozilla OpenNews](http://opennews.org) and the [Open Knowledge Foundation Labs](http://okfnlabs.org).
Raw data
{
"_id": null,
"home_page": "https://github.com/opensanctions/nomenklatura",
"name": "nomenklatura",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "data mapping identity followthemoney linkage record",
"author": "Friedrich Lindenberg",
"author_email": "friedrich@pudo.org",
"download_url": "https://files.pythonhosted.org/packages/d3/0e/5e54622e22e4896971522edcb57f491db49ce23ea4adbec520fa782bc878/nomenklatura-3.14.0.tar.gz",
"platform": null,
"description": "# nomenklatura\n\nNomenklatura de-duplicates and integrates different [Follow the Money](https://followthemoney.rtfd.org/) entities. It serves to clean up messy data and to find links between different datasets.\n\n![screenshot](./docs/screenshot.png)\n\n## Usage\n\nYou can install `nomenklatura` via PyPI:\n\n```bash\n$ pip install nomenklatura\n```\n\n### Command-line usage\n\nMuch 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](https://followthemoney.rtfd.org/) 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).\n\nWith 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:\n\n```bash\n# generate merge candidates using an in-memory index:\n$ nomenklatura xref -r resolver.json entities.ijson\n# note there is now a new file, `resolver.json` that contains de-duplication info.\n$ nomenklatura dedupe -r resolver.json entites.ijson\n# will pop up a user interface.\n$ nomenklatura apply entities.ijson -o merged.ijson -r resolver.json\n# de-duplicated data goes into `merged.ijson`:\n$ cat entities.ijson | wc -l \n474\n$ cat merged.ijson | wc -l \n468 \n```\n\n### Programmatic usage\n\nThe 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.\n\n* `nomenklatura.Dataset` - implements a basic dataset for describing a set of entities.\n* `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.\n* `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.\n* `nomenklatura.index.TantivyIndex` - a wrapper around Tantivy for indexing and matching FtM entities.\n* `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.\n\nAll of the API classes have extensive type annotations, which should make their integration in any modern Python API simpler.\n\n## Design\n\nThis package offers an implementation of an in-memory data deduplication framework centered around the FtM data model. The idea is the following workflow:\n\n* Accept FtM-shaped entities from a given loader (e.g. a JSON file, or a database)\n* Build an in-memory inverted index of the entities for dedupe blocking\n* Generate merge candidates using the blocking index and FtM compare\n* Provide a file-based storage format for merge challenges and decisions\n* Provide a text-based user interface to let users make merge decisions\n\nLater on, the following might be added:\n\n* A web application to let users make merge decisions on the web\n\n### Resolver graph\n\nThe key implementation detail of nomenklatura is the `Resolver`, a graph structure that\nmanages user decisions regarding entity identity. Edges are `Judgements` of whether\ntwo entity IDs are the same, not the same, or undecided. The resolver implements an\nalgorithm for computing connected components, which can the be used to find the best\navailable ID for a cluster of entities. It can also be used to evaluate transitive\njudgements, e.g. if A <> B, and B = C, then we don't need to ask if A = C.\n\n## Reading\n\n* https://dedupe.readthedocs.org/en/latest/\n* https://github.com/OpenRefine/OpenRefine/wiki/Reconcilable-Data-Sources\n* https://github.com/OpenRefine/OpenRefine/wiki/Clustering-In-Depth\n* https://github.com/OpenRefine/OpenRefine/wiki/Reconciliation-Service-API\n\n\n## Contact, contributions etc.\n\nThis codebase is licensed under the terms of an MIT license (see LICENSE).\n\nWe're keen for any contributions, bug fixes and feature suggestions, please use the GitHub issue tracker for this repository. \n\nNomenklatura is currently developed thanks to a Prototypefund grant for [OpenSanctions](https://opensanctions.org). Previous iterations of the package were developed with support from [Knight-Mozilla OpenNews](http://opennews.org) and the [Open Knowledge Foundation Labs](http://okfnlabs.org).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Make record linkages in followthemoney data.",
"version": "3.14.0",
"project_urls": {
"Homepage": "https://github.com/opensanctions/nomenklatura"
},
"split_keywords": [
"data",
"mapping",
"identity",
"followthemoney",
"linkage",
"record"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d3598bba3d91567e1bf5d798b296e0dd41acbeacd85cd2d4b34cec19dcd5e69e",
"md5": "366b502af02804e64d4040b8aab57557",
"sha256": "826131d516dfa88a87a83486b6f4e5e4fc0661a88b0344703daffaadebd93908"
},
"downloads": -1,
"filename": "nomenklatura-3.14.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "366b502af02804e64d4040b8aab57557",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 156449,
"upload_time": "2024-11-26T08:25:08",
"upload_time_iso_8601": "2024-11-26T08:25:08.640998Z",
"url": "https://files.pythonhosted.org/packages/d3/59/8bba3d91567e1bf5d798b296e0dd41acbeacd85cd2d4b34cec19dcd5e69e/nomenklatura-3.14.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d30e5e54622e22e4896971522edcb57f491db49ce23ea4adbec520fa782bc878",
"md5": "3e4196faadbb9d99d83022d928bce706",
"sha256": "bdb58658d9437db717d42cc12c9abe9193f6ff2f02c660fad049b724f4ae520d"
},
"downloads": -1,
"filename": "nomenklatura-3.14.0.tar.gz",
"has_sig": false,
"md5_digest": "3e4196faadbb9d99d83022d928bce706",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 86233,
"upload_time": "2024-11-26T08:25:11",
"upload_time_iso_8601": "2024-11-26T08:25:11.619134Z",
"url": "https://files.pythonhosted.org/packages/d3/0e/5e54622e22e4896971522edcb57f491db49ce23ea4adbec520fa782bc878/nomenklatura-3.14.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-26 08:25:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opensanctions",
"github_project": "nomenklatura",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nomenklatura"
}