// readme

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)),โ€ฆ