Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transport report

Extracting metadata and line items from transport report with examples in Python and Node.

Overview

This guide covers how to extract metadata and line items from multiple supplier transport documents with examples in Python and Node. For this example, we will use the Trainable model: it learns from the documents you add to its dataset. If you want to extract data from the first document without building a dataset and training, see Custom pretrained document.

You will extract the following metadata fields:

  • Name of the supplier

  • Name of the receiver

  • From address

  • To address

  • Document number

  • Shipment number

  • Purchase order number

  • Issue date

  • Load weight

  • Total amount

You will extract the following line item fields:

  • Product number

  • Product description

  • Quantity

  • Weight

  • Number of boxes

This guide shows you how to

Getting your API Key

The Authorization header for your API key is: Token YOUR-API-KEY (Login if you do not see one). You can also obtain the API key on the API Keys page (Settings → API Keys).

Getting your API key

1. Create a new document type

Before you start extracting data, you need to define a document type. Navigate to the Document types page and click on the New document type button in the top right corner. Next, click Select Trainable on the Trainable model card, and then Start Building on Build Custom Document Type. Under Basic info, enter transport-report as the name. The supplier_name field is already in Metadata fields; add the other metadata fields with Add field and the line item fields with Add line item field. Choose the data type that fits each extraction field, for example Date for issue_date and Number for amounts, weights and quantities. Read more about the document type configuration. Click on the Create document type button.

This will create a new document type with the name transport-report with the following fields:

  • supplier_name

  • receiver_name

  • from_address

  • to_address

  • document_number

  • shipment_number

  • purchase_order_number

  • issue_date

  • load_weight

  • total_amount

and the following line item fields:

  • product_number

  • product_description

  • quantity

  • weight

  • number_of_boxes

2. Add suppliers

Once your document type is created, you need to add data to the dataset of your document type. To do that, download the following bills of lading:

Each transport report is from a different supplier.

To add a document to the dataset, use the add-document endpoint or use training room, where you can easily upload a file and fill out the necessary information.

The dataset is created by uploading an original file with the correct value for each field defined inside the document type:

1 Open file as Base64 (Lines 4-6)

2 Specify payload (Lines 8-80)

3 Specify headers (Lines 84-88)

4 Send post request (Line 90)

Response:

As you can see, to achieve high accuracy, Typless only needs the values that are in the document. Nevertheless, there are some rules to keep in mind when providing values.

You will have two suppliers added to your document type after you run both code examples.

3. Execute training

To immediately see the results, you can trigger the training process on the Document types page. Look for the transport-report document type in the list, open its actions menu and choose Train models.

Need more information about training? Read more about it.

4. Extract data from documents

After the training is finished, you can start precisely extracting data from the documents of the trained suppliers. Here you have two new transport reports from the trained suppliers:

Download them and extract the data using the code:

1 Open file as base64 string (Lines 4-6)

2 Specify payload (Lines 8-11)

3 Specify headers (Lines 16-20)

4 Send POST request (Line 22)

Response:

Need a more in-depth explanation of the response? You can read about it here.

5. Continuously improve models

Typless embraces the fact that the world is changing all the time. That's why you can improve models on the fly by providing correct data after extraction. Let's say your company has a new partner, Best Supplier. You don't need to start over with building the dataset. You can simply extract and send the correct data after they are verified by your users. You can learn more about providing feedback on the building dataset page.

📘 Closed workflow loop - improve models live!

Use every action from your users to adapt and improve Typless models without any extra costs.

To send feedback, use the add-document-feedback with object_id. As with add-document, learning_fields must contain every field of the document type; send an empty string ("") for a field that isn't on the document.

Running Typless live

The only thing that you need to do to automate your manual data entry is to integrate those simple API calls into your system.

Have any questions or you need some help? Contact us in Messenger.

Typless usage is very easy and straightforward!

Last updated