Aiviro CLI

Aiviro comes with few CLI commands for creating, managing and inspecting your Aiviro scripts. For detailed information about available commands and theirs arguments, see:

$ aiviro-cli --help

Logs Management

Process Metadata Logs

As mentioned in the section Generate Images, you can generate images from Aiviro metadata.

This is done by aiviro-cli log generate command, see the example of it’s usage:

$ aiviro-cli log generate --help
$ aiviro-cli log generate --input logs/run-demo_test/log_img/metadata/ \\
    --output logs/run-demo_test/log_img/ \\
    --number 20
$ aiviro-cli log generate --input logs/run-demo_test/log_img/metadata/ \\
    --output logs/run-demo_test/log_img/ \\
    --since 1955.11.12-6:38
$ aiviro-cli log generate --input logs/run-demo_test/log_img/metadata/ \\
    --output logs/run-demo_test/log_img/ \\
    --before 2015.10.21-7:28
$ aiviro-cli log generate --input logs/run-demo_test/log_img/metadata/ \\
    --output logs/run-demo_test/log_img/ \\
    --since 1955.11.12-6:38 \\
    --before 2015.10.21-7:28 \\
    --number 100

Analyze Errors

Sometimes your scripts may encounter some errors, to find the exact error-message and corresponding images, in long running scripts may be time demanding. Therefore we created a helpful script, which automatically detects errors in the text logs and selects appropriate metadata based on the time the error occurred, which are then copied into separate sub-folders.

This is done by aiviro-cli log analyze command, see the example of it’s usage:

$ aiviro-cli log analyze --help
$ aiviro-cli log analyze --run logs/run-2021-02-10_10-25-456-main/ \\
    --number 30
$ aiviro-cli log analyze --logs logs/ --window 0:5:0 --number 50

Projects & Scenarios

Create Aiviro Project & Scenarios

To create a new Aiviro project, we predefined a repository structure how such a project should look like. This can be initialize by aiviro-cli create project. To add new scenario into already existing project, use aiviro-cli create scenario command:

Warning

This is experimental feature! Be wary that behaviour may change in future releases.

$ aiviro-cli create project --help
$ aiviro-cli create project --context path/to/project/folder
$ aiviro-cli create scenario --help
$ aiviro-cli create scenario --prefect-project Aiviro --prefect-flow "Invoice Processing" --prefect-env rdp

Reader Scripts

Note

It’s required to install reader and pdf from Optional dependencies section.

They are several scripts under aiviro-cli reader --help command, using which you can extract data from provided PDF files. Or calculate an accuracy of Aiviro Reader based on your ground-truth data export.

Currently supported items in Aiviro Reader

Name

Identification (Column name)

Company Name

company_name

Supplier Vat Number

supplier_vat_number

Supplier ID

supplier_id

Subscriber Vat number

subscriber_vat_number

Subscriber ID

subscriber_id

Tax Date

tax_date

Invoice Date

invoice_date

Due Date

due_date

Invoice Number

invoice_number

Order Number

order_number

Variable Symbol

variable_symbol

Currency

currency

Vat Rate

vat_rate

Total Amount

total_amount

Total Amount Without Vat

total_amount_without_vat

Bank Account Number

bank_account_number

Bank Name

bank_name

IBAN

iban

SWIFT Code

swift_code

To extract all supported items from pdf files, use a following command:

$ aiviro-cli reader extract --help
$ aiviro-cli reader extract --input folder/pdfs/ --output output/folder/

For calculating reader’s accuracy, use a command below. This calculation can be configured (this is optional) by providing a configuration file, see example of it below. Download reader_config.yaml

required_column:
  - supplier_vat_number
  - invoice_number
  - order_number

map_column:
  supplier_vat_number: "DIČ DPH"
  total_amount_without_vat: "Č.celk. bez DPH d."
  invoice_date: "Datum případu (DMR)"
  invoice_number: "Dodavatelská faktura"
  currency: "Měna"
  tax_date: "DUZP"
  file_name: "Párovací znak"
  order_number: "Číslo objednávky"

export_value:
  - supplier_vat_number
  - invoice_date
  - invoice_number
  - currency
  - order_number
  • required_column - columns which must be contained in both input csv files

  • map_column - used for renaming ground-truth csv file columns to standard name format

  • export_value - [optional] values to export from pdf-files, if not specified all values are exported

$ aiviro-cli reader stats --help
$ aiviro-cli reader stats --input export_data.csv --ground-truth gt_data.csv --output folder/ --config path/reader_config.yaml

To check whether the exported data is also present in corresponding pdf files, use reader find.

$ aiviro-cli reader find --help
$ aiviro-cli reader find --input pdf-folder/ --ground-truth gt_data.csv --output folder/ --config path/reader_config.yaml

Deployment as Web App

Note

It’s required to install deploy from Optional dependencies section.

To test certain Aiviro functionality you can deploy it as a web application.

$ aiviro-cli deploy --help
$ aiviro-cli deploy reader
$ aiviro-cli deploy recognition
../_images/deploy_reader.png

Deployed Aiviro Reader as an interactive web application.

../_images/deploy_recognition.png

Deployed Aiviro Recognition as an interactive web application.

Testing

Using aiviro-cli test --help command, you can run tests for various Aiviro components. For example to test and select the best configuration for Aiviro email module, use a following command:

# Test IMAP email module
$ aiviro-cli test email imap --host imap.server.com --username <username> --password <password>

# Test SMTP email module
$ aiviro-cli test email smtp --host smtp.server.com --username <username> --password <password>