Skip to main content

datatrails-samples

Sample python code that uses the datatrails python SDK to manage particular types of assets such as 'doors', 'cards', 'containers' etc.

Only supplied as examples of python code that accesses the datatrails archivist.

No tests - released 'AS-IS'

Installing the samples code

Python 3.9 and later versions are supported.

Use the standard python pip utility:

python3 -m pip install --user datatrails-samples

and this will create 7 entry points:

  - archivist_samples_document
  - archivist_samples_door_entry
  - archivist_samples_estate_info
  - archivist_samples_signed_records
  - archivist_samples_synsation
  - archivist_samples_software_bill_of_materials
  - archivist_samples_wipp

Pre-requisites

Add a token to the file credentials/.auth_token and set some environment vars to specify the archivist endpoint:

export TEST_ARCHIVIST="https://app.datatrails.ai"
export TEST_AUTHTOKEN_FILENAME=credentials/.auth_token
export TEST_NAMESPACE="unique label"
export TEST_PARTNER_ID="acmecorp"
export TEST_VERBOSE=-v

If TEST_VERBOSE is "-v" debugging output will appear when running the examples. Otherwise leave blank or undefined.

Windows using Powershell - at the command prompt set values for environment variables:

$Env:TEST_ARCHIVIST="https://app.datatrails.ai"
$Env:TEST_AUTHTOKEN_FILENAME = '<path of token location>'
$Env:TEST_NAMESPACE = Get-Date -UFormat %s
$Env:TEST_PARTNER_ID = 'acmecorp'
$Env:TEST_VERBOSE = '-v'

TEST_NAMESPACE is set to the date and time value in Unix format, thus providing a unique id upon execution.

TEST_NAMESPACE

If TEST_NAMESPACE is blank or unspecified, any assets or events will be visible to other users running the same examples on the same URL.

Each example creates assets,events that are not visible to other examples. For example the door_entry assets,events etc are not visible to the synsation example.

Note: Assets are only created if they do not already exist according to namespace. If one wants to execute a sample multiple times, feel free to set TEST_NAMESPACE to a different unique id.

Due to restrictions attachments are always uploaded during every example execution.

Events are created every execution of an example - currently no check is done if the event already exists.

EXAMPLES

All examples use a common set of arguments:

export AUTH="-u $TEST_ARCHIVIST -t $TEST_AUTHTOKEN_FILENAME $TEST_VERBOSE"
export ARGS="$AUTH --namespace $TEST_NAMESPACE --partner_id=$TEST_PARTNER_ID"

Door Entry Control

Some commands to simply create and manage doors and cards:

archivist_samples_door_entry $ARGS --create
archivist_samples_door_entry $ARGS --list all
archivist_samples_door_entry $ARGS --list doors
archivist_samples_door_entry $ARGS --list cards
archivist_samples_door_entry $ARGS --list 'Courts of Justice front door'
archivist_samples_door_entry $ARGS --list 'access_card_1'

Execute opening doors with a card:

archivist_samples_door_entry $ARGS --open "Courts of Justice front door,access_card_1"
archivist_samples_door_entry $ARGS --open "Courts of Justice front door,access_card_3"
archivist_samples_door_entry $ARGS --open "Courts of Justice front door,access_card_4"
archivist_samples_door_entry $ARGS --open "Courts of Justice front door,access_card_0"
archivist_samples_door_entry $ARGS --open "Courts of Justice front door,access_card_2"
archivist_samples_door_entry $ARGS --open "Bastille front door,access_card_2"
archivist_samples_door_entry $ARGS --open "City Hall front door,access_card_2"
archivist_samples_door_entry $ARGS --open "Gare du Nord apartments side door,access_card_2"

Manage assets and events and check for any inconsistencies

NB no namespace required ...

archivist_samples_estate_info $AUTH --quick-count
archivist_samples_estate_info $AUTH --double-check

Signed Records

archivist_samples_signed_records $ARGS --create 'samples'
archivist_samples_signed_records $ARGS --sign-message 'signature' 'samples'
archivist_samples_signed_records $ARGS --bad-sign-message 'signature' 'samples'
archivist_samples_signed_records $ARGS --check 'samples'

Synsation

archivist_samples_synsation initialise  $ARGS --num-assets 100 --wait 1 --await-confirmation
archivist_samples_synsation charger     $ARGS --start-date 20190909 --stop-date 20191009 --fast-forward 9876
archivist_samples_synsation simulator   $ARGS --asset-name tcl.ccj.001 --wait 1.0
archivist_samples_synsation wanderer    $ARGS
archivist_samples_synsation analyze     $ARGS 

Software Bill of Materials

archivist_samples_software_bill_of_materials $ARGS

WIPP

archivist_samples_wipp $ARGS

Metadata

Release files for datatrails-samples 0.20.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datatrails-samples 0.20.0
File Size Uploaded Provenance Actions
datatrails_samples-0.20.0.tar.gz 19.1 MB With provenance Details for datatrails_samples-0.20.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datatrails-samples 0.20.0
File Interpreter ABI Platform Actions
datatrails_samples-0.20.0-py3-none-any.whl Python 3 none any Details for datatrails_samples-0.20.0-py3-none-any.whl

Total release size: 38.2 MB

Release files / datatrails_samples-0.20.0.tar.gz

Download URL datatrails_samples-0.20.0.tar.gz
Size 19.1 MB
Tags Source
SHA-256 checksum
How to use checksums
76de93e16fc4216b919e0813d763c013901939433bb8b4a6e764c59fc80ef3c3
BLAKE2b-256 checksum
How to use checksums
44a7a8a15746fc3f619be0a0054072eb652322ee339e5928b681e0eda0655d5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.

Transparency log

Release files / datatrails_samples-0.20.0-py3-none-any.whl

Download URL datatrails_samples-0.20.0-py3-none-any.whl
Size 19.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
62ef5c1afd38b482309571f0e04ca11441983a04c7f5247a259382d2ffd62740
BLAKE2b-256 checksum
How to use checksums
0b715dd7629ced7b84b658998d3d7feff148bbfd68f6914c34017dc8d5c343a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.

Transparency log

Security for datatrails-samples 0.20.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for datatrails_samples-0.20.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page