Skip to main content

Transaction scripts for manipulating business transactions and documents in Rossum platform

Project description

Rossum Transaction Scripts

The Rossum platform for automating document-based business transactions can evaluate snippets of Python code that can manipulate such transactions: Transaction Scripts (or TxScripts). The principal use of these TxScript snippets is to automatically fill in computed values of formula type fields. The code can be also evaluated in serverless function based extensions.

This is a user-friendly Python "extended runtime" that allows for code snippets in the Rossum platform (formula fields or serverless functions) that are very short, easy to read and follow, and easy to write (possibly in a recipe-like way for non-programmers).

See https://elis.rossum.ai/api/docs/#rossum-transaction-scripts for reference documentation.

How it looks like in practice

Various examples are part of the test suite.

You can execute the runtime locally on a sample annotation by running the standalone.py script.

Python 3.8

Note that the module code must be compatible with Python 3.8, since that's the serverless runtime. This mainly means that | None and type[...] constructs are not available.

Benchmarking

curl -H "Authorization: Bearer ..." -H "Content-Type: application/json" "https://us.api.rossum.ai/v1/annotations/5565949/content" >examples/standalone/annotation-5565949.json
curl -H "Authorization: Bearer ..." -H "Content-Type: application/json" https://us.api.rossum.ai/v1/schemas/1488014 >examples/standalone/schema-1488014.json
time ./benchmark.py examples/standalone/annotation-5565949.json examples/standalone/schema-1448014.json

Fields data model

We have three levels of data:

  • attrs stored in FlatData._content dict indexed by schema_id.
  • Field (and descendants) instances that provide a typed interface to attrs as well as the logic to work with complex data types and generating values and tracking updates.
  • FieldValueBase (and descendants) instances that provide the user-facing interface to Field objects and emulate native Python types backed ultimately by attrs content.

User changes are tracked as such:

  • When changing datapoints, the datapoint is added to the Fields._updates backlog, together with the information about which attributes changed. The datapoint itself (that's also stored in the Fields._content dict) is updated with the new value. Removed datapoints are removed from all_objects.
  • Newly added datapoints can be identified by the missing id attribute.

Publishing updates to PyPI

In the txscript package root directory, run:

pip install build twine
python3 -m build

Next, inspect the dist/txscript*.tar.gz tarball of source distribution to make sure it looks sane and doesn't contain any surprising extra files.

Finally, run:

python3 -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

txscript-1.0.1.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

txscript-1.0.1-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file txscript-1.0.1.tar.gz.

File metadata

  • Download URL: txscript-1.0.1.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for txscript-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a8ca374503ad91b6d37753c4d0532b459389411a4b12633d46e248be8d6acecc
MD5 3fd2410da1ccca31aff737d352b6ca33
BLAKE2b-256 0e6557b10b29cc12e5b6509aed26f3962c8d516eb5737a17249e1f742cfe90f1

See more details on using hashes here.

File details

Details for the file txscript-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: txscript-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for txscript-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8bf68216490d6b8f9e3173f43b35d02a5d7d9f1fd24f75472ec8b75fe4476f9
MD5 9ee75e01d8b739fff58d9c8cf15a915b
BLAKE2b-256 e1812e9827d082f10d272109f4d8ed28ed68f829f22700006f165df6bebb5950

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page