ftmq
ftmq queries and filters Follow The Money entities from json files / streams or from a statement-based nomenklatura store.
Its ftmq.Query is the backend-agnostic query object of the OpenAleph ecosystem: it filters FtM streams and stores, compiles to SQL, and converts to and from OpenAleph API params.
New to Follow The Money? See this introduction.
Installation
Minimum Python version: 3.11
pip install ftmq
Usage
Command line
cat entities.ftm.json | ftmq -q 'filter:schema=Company&filter:properties.country=de&filter:gte:properties.incorporationDate=2023' -o s3://data/entities-filtered.ftm.json
Python Library
from ftmq import Query, M, P, G, smart_read_proxies
# legal entities in `companies` based in Germany, or in Austria and incorporated
# since 2020, not dissolved: the 5 most recently incorporated
q = Query().where(
M(dataset="companies"),
M(schemata="LegalEntity"),
G(countries="de") | (G(countries="at") & P(incorporationDate__gte=2020)),
~P(status__ilike="%dissolved%"),
).order_by(P("incorporationDate"), ascending=False)[:5]
for proxy in smart_read_proxies("s3://data/entities.ftm.json", query=q):
print(proxy.caption)
Full-text search
ftmq.search indexes entities into full-text search stores backed by SQLite FTS5 or Tantivy (pip install ftmq[search]):
cat entities.ftm.json | ftmq search transform | ftmq search --uri sqlite:///ftmqs.db index
ftmq search --uri sqlite:///ftmqs.db "jane doe"
HTTP API
ftmq.api serves a store and its search index as a read-only FastAPI application speaking the Aleph filter grammar (pip install ftmq[api]):
granian --interface asgi ftmq.api.app:app
curl "localhost:8000/entities?filter:schema=Payment&filter:gte:properties.date=2023"
Documentation
https://docs.investigraph.dev/lib/ftmq
Support
This project is part of investigraph
In 2023, development of ftmq was supported by Media Tech Lab Bayern batch #3
License and Copyright
ftmq, (C) 2023 Simon Wörpel
ftmq, (C) 2024-2025 investigativedata.io
ftmq, (C) 2025 Data and Research Center – DARC
ftmq is licensed under the AGPLv3 or later license.
Prior to version 0.8.0, ftmq was released under the MIT license.
Metadata
Release files for ftmq 5.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ftmq-5.3.0.tar.gz | 91.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ftmq-5.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 206.9 kB
Release files / ftmq-5.3.0.tar.gz
| Download URL | ftmq-5.3.0.tar.gz |
|---|---|
| Size | 91.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cc2b6b9a2ee141bca5d7b3e9f4d3a7d9457493bae4c8039f8e2b3dc73492828
|
|
BLAKE2b-256 checksum How to use checksums |
b0bdaafcbcfe5105cda071f872735cf771c632f81588a827eb1ef776e3b1b343
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-31-generic
|
Release files / ftmq-5.3.0-py3-none-any.whl
| Download URL | ftmq-5.3.0-py3-none-any.whl |
|---|---|
| Size | 115.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c09011b2f7ee4cd061b79673b64e84064075e85fec961d47ab0525d8a5ba7e7d
|
|
BLAKE2b-256 checksum How to use checksums |
7322459c0724675fa614b6ee0b37e04d5a778b1276f2c7c661225b78cc8eb5c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-31-generic
|