SDK for the Ntropy API
Project description
Ntropy SDK
SDK for the Ntropy API
Installation:
$ pip install --upgrade 'ntropy-sdk[benchmark]'
Usage:
Programmatic usage for benchmarking:
Assuming you have a CSV file called testset.csv with the following fields set:
- iso_currency_code: The currency of the transaction
- amount: The amount (a positive number)
- entry_type: incoming for money coming into the account, outgoing for money going out of the account
- description: The transaction description string
- account_holder_id: A unique identifier for the account holder
- is_business: A boolean indicating if this is a business transaction (True) or a consumer transaction (False)
- (optional) correct_merchant: A string that should match the merchant output of the API. If you combine this with --ground-truth-merchant-field=correct_merchant you will be given an accuracy % for the API.
- (optional) correct_labels: The label that the transaction should be marked as. If you combine this with --ground-truth-label-field=correct_labels you will be given an F1 score for the API.
$ ntropy-benchmark --api-key=$NTROPY_API_KEY --in-csv-file=testset.csv --out-csv-file=enriched.csv --ground-truth-label-field=correct_labels
Using this as a python library:
import os
from ntropy_sdk.ntropy_sdk import SDK, Transaction
sdk = SDK(os.getenv("NTROPY_API_KEY"))
transaction = Transaction(
amount=1.0,
description="AMAZON WEB SERVICES AWS.AMAZON.CO WA Ref5543286P25S: Crd15",
is_business=True,
entry_type="outgoing",
account_holder_id="1",
country="US",
)
batch = sdk.enrich_batch([transaction])
enriched_list = batch.wait_with_progress()
print("BATCH", enriched_list.transactions[0].labels)
enriched = sdk.enrich(transaction)
print("REALTIME:", enriched.labels)
License:
Free software: MIT license
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ntropy_sdk-3.1.0.tar.gz
(12.0 kB
view hashes)
Built Distribution
Close
Hashes for ntropy_sdk-3.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ba27e37d374f756f24bfd5c2d806768d6df54e9b28e486ab14c8c59fcd9e2d9 |
|
MD5 | ec90606a81acaf5e7f03b67e431ac2d9 |
|
BLAKE2b-256 | cf19655f8b2f336ee0fdef14d26cdf6d8ac20c3b9703e5e1a3cb9981b7963ead |