Skip to content

Docs ftmq on pypi PyPI Downloads PyPI - Python Version Python test and package pre-commit Coverage Status AGPLv3+ License Pydantic v2

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)

Support

This project is part of investigraph

In 2023, development of ftmq was supported by Media Tech Lab Bayern batch #3

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.

see NOTICE and LICENSE