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, or by LLMs with low risk of mistakes).

See Rossum Transaction Scripts in Rossum API Docs for reference documentation.

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" >annotation-5565949.json
curl -H "Authorization: Bearer ..." -H "Content-Type: application/json" https://us.api.rossum.ai/v1/schemas/1488014 >schema-1488014.json
time ./benchmark.py annotation-5565949.json schema-1448014.json

This is also an easy way to run txscript locally e.g. for debugging purposes.

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 fields, the field is added to the Fields._updates journal, together with the information about which attributes changed. The field's .attrs itself (also stored in the FlatData) is updated with the new value. Removed fields are removed from all_objects.
  • Newly added fields 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.1.0.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

txscript-1.1.0-py3-none-any.whl (39.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: txscript-1.1.0.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for txscript-1.1.0.tar.gz
Algorithm Hash digest
SHA256 05e367b012fdf90687c9e2649cf8157f21bcf33ee287f6e5afe90e52adf26b24
MD5 7232096478f6b0cb0185d192735978c3
BLAKE2b-256 7ed627ad876d462902fb1926c8dc126880bf02acd587a6cb80d4dae952d93aae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: txscript-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for txscript-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3868e8d5fb8d7b8a9911107d01a932f84c04e74a5a218ab5f4c55664758a9cb
MD5 31e0ebed7bf7080506238d945b6aad83
BLAKE2b-256 fb0f293c036eec4a98608bb9f5e7660c13f22c600100391faafc1374a3f8f367

See more details on using hashes here.

Supported by

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