Metadata-Version: 2.1
Name: ftmq
Version: 0.7.0
Summary: followthemoney query dsl and io helpers
Home-page: https://docs.investigraph.dev/lib/ftmq
License: MIT
Author: Simon Wörpel
Author-email: simon.woerpel@pm.me
Requires-Python: >=3.11,<4
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: PyICU (>=2.13.1,<3.0.0)
Requires-Dist: alephclient (>=2.4.1,<3.0.0)
Requires-Dist: anystore (>=0.2.0,<0.3.0)
Requires-Dist: banal (>=1.0.6,<2.0.0)
Requires-Dist: certifi (>=2024.2.2)
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: click-default-group (>=1.2.4,<2.0.0)
Requires-Dist: cryptography (>=42.0.7,<45.0.0)
Requires-Dist: followthemoney (>=3.7.9,<4.0.0)
Requires-Dist: nomenklatura (<3.13)
Requires-Dist: orjson (>=3.10.3,<4.0.0)
Requires-Dist: pantomime (>=0.6.1,<0.7.0)
Requires-Dist: pycountry (>=23.12.11,<25.0.0)
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
Requires-Dist: sqlalchemy (>=2.0.31,<3.0.0)
Requires-Dist: structlog (>=24.4.0,<25.0.0)
Requires-Dist: urllib3 (<3)
Project-URL: Bug Tracker, https://github.com/investigativedata/ftmq/issues
Project-URL: Documentation, https://docs.investigraph.dev/lib/ftmq
Project-URL: Repository, https://github.com/investigativedata/ftmq
Description-Content-Type: text/markdown

[![ftmq on pypi](https://img.shields.io/pypi/v/ftmq)](https://pypi.org/project/ftmq/) [![Python test and package](https://github.com/investigativedata/ftmq/actions/workflows/python.yml/badge.svg)](https://github.com/investigativedata/ftmq/actions/workflows/python.yml) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Coverage Status](https://coveralls.io/repos/github/investigativedata/ftmq/badge.svg?branch=main)](https://coveralls.io/github/investigativedata/ftmq?branch=main) [![MIT License](https://img.shields.io/pypi/l/ftmq)](./LICENSE)

# ftmq

This library provides methods to query and filter entities formatted as [Follow The Money](https://followthemoney.tech) data, either from a json file/stream or using a statement-based store backend from [nomenklatura](https://github.com/opensanctions/nomenklatura).

It also provides a `Query` class that can be used in other libraries to work with SQL store queries or api queries.

`ftmq` is the base layer for [investigativedata.io's](https://investigativedata.io) libraries and applications dealing with [Follow The Money](https://followthemoney.tech) data.

To get familiar with the _Follow The Money_ ecosystem, you can have a look at [this pad here](https://pad.investigativedata.org/s/0qKuBEcsM#).

## Installation

Minimum Python version: 3.11

    pip install ftmq

## Usage

### Command line

```bash
cat entities.ftm.json | ftmq -s Company --country=de --incorporationDate__gte=2023 -o s3://data/entities-filtered.ftm.json
```

### Python Library

```python
from ftmq import Query, smart_read_proxies

q = Query() \
    .where(dataset="ec_meetings", date__lte=2020) \
    .where(schema="Event") \
    .order_by("date", ascending=False)

for proxy in smart_read_proxies("s3://data/entities.ftm.json"):
    if q.apply(proxy):
        yield proxy
```

## Documentation

https://docs.investigraph.dev/lib/ftmq

## Support

This project is part of [investigraph](https://investigraph.dev)

In 2023, development of `ftmq` was supported by [Media Tech Lab Bayern batch #3](https://github.com/media-tech-lab)

<a href="https://www.media-lab.de/en/programs/media-tech-lab">
    <img src="https://raw.githubusercontent.com/media-tech-lab/.github/main/assets/mtl-powered-by.png" width="240" title="Media Tech Lab powered by logo">
</a>

