Metadata-Version: 2.4
Name: agentdata
Version: 0.3.26
Summary: AgentData domain API SDK — corpus (hosted) + third-party enrichment (local, keyless); stdlib-only
Author-email: dicaria <contact@dicaria.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/dicaria/agentdata
Project-URL: Source, https://github.com/dicaria/agentdata
Project-URL: Issues, https://github.com/dicaria/agentdata/issues
Project-URL: Changelog, https://github.com/dicaria/agentdata/releases
Keywords: company-intelligence,open-data,sanctions,procurement,enrichment,government-data
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# agentdata

[![PyPI](https://img.shields.io/pypi/v/agentdata)](https://pypi.org/project/agentdata/)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/dicaria/agentdata/blob/main/LICENSE)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org)
[![Commands](https://img.shields.io/badge/117_commands-8_domains-teal)](https://github.com/dicaria/agentdata/blob/main/docs/domains/api.md)

Government registries, sanctions lists, procurement portals, and health-agency
databases hold the decisive facts about companies — scattered across 60+ public
APIs, each with its own pagination, rate limits, and undocumented quirks.

**agentdata puts 117 of those datasets behind one interface**: a
pure-standard-library Python client and CLI across 13 jurisdictions. No API
keys, no accounts — politeness and caching are built in, and every upstream
gotcha we hit live is already pinned.

## Two API families

| Family | Where it runs | Credentials | Cost |
|---|---|---|---|
| **Enrichment** | Locally — the SDK calls public government / open-data APIs from your machine | none | free |
| **Corpus** | Hosted service operated by dicaria | credentials issued by dicaria | per service agreement |

Most commands are enrichment: they need no configuration, no keys, no account.
Corpus commands are marked in the docs and require credentials issued by
dicaria under a separate service agreement — contact **contact@dicaria.com**.

## What can you ask it?

Commands follow `<domain> <source>_<dataset>` — one command per upstream
dataset, parameters kept under their upstream names. Every row below works as
`agentdata <domain> <command> …` from the shell, or
`c.<domain>.<command>(…)` from Python.

| Question | Commands |
|---|---|
| Is this company sanctioned? | `legal csl_screening_list` · `legal co_sic_sanctions` · `legal wb_debarred_firms` · `legal ca_sema_sanctions` |
| Who owns or controls it? | `company gleif_direct_parent` · `company no_brreg_roller` · `company fr_recherche_search` |
| Did it win public contracts? | `procurement br_pncp_contracts` · `procurement ungm_contract_awards` · `procurement wb_procnotices` |
| Is its drug or device approved — or recalled? | `healthcare fda_drug_approvals` · `healthcare gb_mhra_alerts` · `healthcare fda_drug_recalls` |
| What does this facility or fleet emit? | `esg climatetrace_sources` · `esg thetis_mrv_datasets` · `esg paris_mou_detentions` |
| Pull a company card from a national registry | `company ch_zefix_firm` · `company co_rues_companies` · `company kr_hometax_biz_status` |
| How big is the country it operates in? | `economy wb_wdi_values` · `economy eurostat_table` · `economy fred_series` |
| Convert an EUR amount, or read a bilateral trade flow | `economy ecb_fx_rates` · `economy un_comtrade_trade` |

## Why not just call the APIs yourself?

You can — and then you get to rediscover what is already pinned here:

- **Quirks are pre-solved, not rediscovered.** Every command encodes traps we
  hit against the live API: the UN Global Marketplace search behind an
  anti-forgery token dance; Socrata endpoints that silently ignore documented
  parameters; the gov.uk content API that 404s when you append `.json`;
  registries that clamp your page size without an error.
- **One envelope across all 117 commands.** Query echo, a plain-language
  `reason`, `evidence` rows with a checkable quote and source URL, source
  metadata, and a `jurisdiction` chapter — your code parses one shape.
- **Upstream parameter names, verbatim.** What the official API docs call a
  parameter is what the SDK takes — no invented vocabulary to unlearn.
- **Polite by default.** Per-source rate limits are enforced before every
  request ([rate-limits ledger](https://github.com/dicaria/agentdata/blob/main/docs/domains/rate-limits.md)); responses are
  cached locally, and a cache hit costs no rate budget.
- **Zero dependencies.** Python 3.10+ standard library only.

## Coverage

**117 datasets · 80 upstream providers · 13 jurisdictions:** global 39 · US 37 · EU 12 · UK 11 · Canada 5 · Colombia 3 · Australia 2 · Switzerland 2 · Norway 2 · Brazil 1 · Finland 1 · France 1 · Korea 1.

| Domain | Commands | Sources |
|---|---|---|
| `healthcare` | 31 | US FDA approvals & recalls, ClinicalTrials.gov, RxNav, DailyMed, AccessGUDID, UK MHRA alerts, Health Canada DPD & MDALL, EUDAMED, RASFF & Safety Gate (EU), TGA (AU), Europe PMC, MeSH |
| `company` | 21 | GLEIF, SEC EDGAR, FDIC, USAspending, TED, VIES, UK Contracts Finder & FTS, Zefix (CH), Brreg (NO), YTJ (FI), recherche-entreprises (FR), RUES (CO), Hometax (KR), ROR |
| `esg` | 12 | Climate TRACE, EITI, EU ETS (EUTL), THETIS-MRV (EU shipping), EPA FRS, Paris MoU, EU Air Safety List |
| `legal` | 19 | US consolidated screening list, eCFR, Federal Register, LDA filings, CourtListener, DG COMP, UK CMA cases, UK Electoral Commission, TNA case law, SIPRI, SIC sanctions (CO), MDB debarment rosters (WB/AfDB/IDB), Canada SEMA |
| `research` | 10 | OpenAlex, NIH RePORTER, NSF, Crossref, UKRI GtR, iCite, bioRxiv, OpenCitations |
| `procurement` | 7 | PNCP (BR), SECOP II (CO), UNGM, World Bank, New York Authorities / MTA / OGS (US) |
| `security` | 2 | OSV, CISA KEV |
| `economy` | 15 | World Bank WDI, Eurostat, ECB reference rates, FRED, WHO xMart, UN Comtrade, ILOSTAT |

## Show me a response

Real output of `agentdata healthcare rxnav_rxcui_by_name --name atorvastatin` —
every command returns this shape:

```json
{
  "ok": true,
  "domain": "healthcare",
  "tool": "rxnav_rxcui_by_name",
  "input": {
    "name": "atorvastatin"
  },
  "from_cache": false,
  "reason": "RxNav normalization: drug name 'atorvastatin' → RxCUI 83367 (ingredient level)",
  "result": {
    "rxcui": "83367",
    "normalized_name": "atorvastatin",
    "synonym": null,
    "tty": "IN",
    "suppress": "N"
  },
  "evidence": [
    {
      "quote": "RxCUI 83367 = atorvastatin",
      "url": "https://rxnav.nlm.nih.gov/REST/rxcui/83367/properties.json"
    }
  ],
  "source": {
    "provider": "rxnav",
    "execution": "local",
    "from_cache": false,
    "observed_at": "2026-11-02T03:28:22.213Z"
  },
  "request_id": "3f343e2f-3b08-46e8-ac69-8ee05adce548",
  "query": {
    "source": "raw",
    "upstream": {
      "name": "atorvastatin"
    }
  },
  "jurisdiction": "US"
}
```

## Install

From PyPI:

```bash
python -m pip install agentdata
```

For a reproducible install, pin the release: `python -m pip install agentdata==0.3.26`.

From a release tarball — no git required:

```bash
python -m pip install https://github.com/dicaria/agentdata/archive/refs/tags/v0.3.26.tar.gz
```

Or via git (pin a tag for reproducible installs):

```bash
python -m pip install git+https://github.com/dicaria/agentdata.git@v0.3.26
```

Or track the latest release (convenience for agents and scripts — a fresh
release does not trigger a reinstall under the same URL, so pass
`--force-reinstall` when you want the new one):

```bash
python -m pip install --force-reinstall https://github.com/dicaria/agentdata/releases/latest/download/agentdata-latest.tar.gz
```

## Quick start (Python)

```python
from agentdata import Client

c = Client()  # zero config: enrichment commands work immediately

c.healthcare.fda_drug_recalls(search='recalling_firm.exact:"SV Labs Toronto Corporation"')
c.company.gleif_lei_records(lei="5493001KJTIIGC8Y1R12")           # LEI -> entity identity card (GLEIF)
c.company.ch_zefix_firm_search(name="siemens")                    # Swiss commercial registry (Zefix)
c.esg.climatetrace_sources(owner_ids="E100000001492", year=2023)  # owner -> facility-level emissions
c.legal.csl_screening_list(name="VTB BANK")                       # sanctions screening (US CSL)
c.research.openalex_works(search="vaccine", ror="01xdqrp08")
c.procurement.br_pncp_contracts(data_inicial="20260901", data_final="20260930", pagina=1)
c.security.osv_vulns(package="lodash", ecosystem="npm", version="4.17.15")
c.economy.wb_wdi_values(country="CHN", indicator="NY.GDP.MKTP.CD", date="2020:2023")  # World Bank indicator values
c.economy.ecb_fx_rates(currency="USD", start="2026-10-01", end="2026-10-31")  # euro reference rate (1 EUR = X)
```

Corpus commands use the same shape with hosted credentials:

```python
c2 = Client(base_url="https://…", api_key="mk_live_…")  # PAT issued by dicaria
c2.company.read(id=1476, level="tier2")
```

## Quick start (CLI)

Nine entry points — `agentdata` plus one command per domain:

```bash
agentdata healthcare rxnav_rxcui_by_name --name atorvastatin
agentdata company gleif_lei_records_search --filter-entity-legal-name "Siemens" --page-size 3
agentdata legal csl_screening_list --name "VTB BANK"
agentdata esg climatetrace_sources --owner-ids E100000001492 --year 2023
agentdata procurement br_pncp_contracts --data-inicial 20260901 --data-final 20260930 --pagina 1
agentdata economy wb_wdi_values --country CHN --indicator NY.GDP.MKTP.CD --date 2020:2023
```

If a domain entry-point command (`company`, `legal`, …) collides with another tool
on your machine, `python -m agentdata <domain> …` is the equivalent invocation.

## Caching

Every response is cached in a per-user SQLite cache shared across virtual
environments and processes — cache hits cost no rate budget (see
[docs/domains/rate-limits.md](https://github.com/dicaria/agentdata/blob/main/docs/domains/rate-limits.md)). A fresh install
in a new virtual environment will therefore hit entries written by earlier
runs on the same machine; that is by design.

| | |
|---|---|
| Default location | `%LOCALAPPDATA%\agentdata\cache.db` on Windows; `~/.cache/agentdata/cache.db` on macOS/Linux |
| Override | `AGENTDATA_CACHE_DIR` environment variable (CLI: `--cache-dir`) |
| Bypass | `--no-cache` (CLI) / `no_cache=True` (Python) |
| Clear | delete the file — every entry re-fetches on demand |

Entry lifetimes follow the per-source TTL table in the rate-limits ledger;
immutable lookups (e.g. drug name → RxCUI) are cached permanently.

## Documentation

- [docs/domains/api.md](https://github.com/dicaria/agentdata/blob/main/docs/domains/api.md) — the API contract of the release
  you installed: the two families, request/response envelope, parameter
  conventions
- [docs/domains/rate-limits.md](https://github.com/dicaria/agentdata/blob/main/docs/domains/rate-limits.md) — per-source
  rate-limit facts this release enforces
- [docs/publishing.md](https://github.com/dicaria/agentdata/blob/main/docs/publishing.md) — maintainer setup, package checks, and PyPI releases
- Hosted-corpus per-domain guides: contact **contact@dicaria.com**

## License and terms

- The **code** in this repository is licensed under the license in
  [LICENSE](https://github.com/dicaria/agentdata/blob/main/LICENSE).
- The **data** returned by the SDK is governed by the terms of each upstream
  source; the SDK grants no data rights. See [TERMS.md](https://github.com/dicaria/agentdata/blob/main/TERMS.md).

## Contact

- Questions, bug reports, and data-coverage requests:
  [GitHub issues](https://github.com/dicaria/agentdata/issues) or
  **contact@dicaria.com** (see [CONTRIBUTING.md](https://github.com/dicaria/agentdata/blob/main/CONTRIBUTING.md))
- Hosted-corpus credentials and service inquiries: **contact@dicaria.com**
- Security reports: **contact@dicaria.com** — please don't open a public
  issue; see [SECURITY.md](https://github.com/dicaria/agentdata/blob/main/SECURITY.md)
- Conduct issues: **contact@dicaria.com** (see
  [CODE_OF_CONDUCT.md](https://github.com/dicaria/agentdata/blob/main/CODE_OF_CONDUCT.md))
