Logistics Automation - Automate Document Classification
Tags: powerfuldevs, ai, logistics, automation
Published: 2023-04-03 01:58:46

**Intro**:
Document classification is the process of organizing and categorizing documents based on their content, characteristics, or other attributes. It involves analyzing the text of a document and assigning it to one or more predefined categories based on the content or context of the document.

**Logistics Inspiration**:
Logistics businesses often have complex supply chains with multiple partners, suppliers, and customers involved in the process. Also if the merchandise are moved across borders then because the compliance regulations the documentation are paper based. Many logistics businesses rely on outdated legacy systems and processes that have been in place for years and mostly paper based. 

List below are few list of Documentation with Logistics Process, depending on the type of shipment and the countries involved.


| Sl No | Document Type                              | Description                                                                                                                                       |
|-------|--------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| 1     | Bill of Lading (BOL)                       |  This document serves as a receipt   for the cargo being transported and contains information about the origin,   destination, and contents of the shipment  |
| 2     | Commercial Invoice                         |  This is a document that contains   information about the goods being shipped, including the quantity, value, and   description of the items.     |
| 3     | Packing List                               |  This document lists the contents   of a shipment and includes details such as the quantity, weight, and   dimensions of each item.               |
| 4     | Customs Declaration                        |  This document contains information   about the goods being imported or exported, including their value, origin,   and destination.               |
| 5     | Export License                             |  This is a government-issued   document that authorizes the export of certain goods, such as weapons or   other controlled items.                 |
| 6     | Import License                             |  This is a government-issued   document that authorizes the import of certain goods, such as food or   pharmaceuticals.                           |
| 7     | Certificate of Origin                      |  This document certifies the   country of origin of the goods being shipped.                                                                      |
| 8     | Dangerous Goods Declaration                |  This document is required for the   transport of hazardous materials and provides information about the type and   quantity of hazardous  goods being shipped.      |
| 9     | Freight Forwarder's Certificate of Receipt |  This document confirms that the   freight forwarder has received the goods for transport and contains details   about the shipment.                        |
| 10    | Delivery Note                              |  This document is used to confirm   the delivery of goods to a recipient and includes details such as the date, time, and location of delivery. |

**Conceptual Architecture View**:
The Idea here is automate the document classification. The below concept is based on when a file gets dropped in the custom AI builder would classify the document as Compliance document or Invoice document. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4h0kp86mx5tm86y4bfg.png)


**Building a Custom AI Model**:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19jgq0qb9in07r038scp.png)


_Platform Setup_

1. Building Custom AI Model:
The goal of this is to classify document into 2 categories. We would leverage Custom Entity Extraction and leverage the collection to categorically train and classify the document. We have defined a custom field named DocumentType to train the model

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sx6j6grnufqfzpobulet.png)

The next step is to provide the AI engine with some examples so that the model can be trained. We have created two collection, one for training Invoice document and another Cosmetic Compliance documentation. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/il5rm7l6sb3zm5jltf9o.png)

The next step is to tag the documents 

Example for cosmetic documentation tagging

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrl6rxxrj6vava5s3fq7.png)

Example for Invoice documentation tagging

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4w9nq29rni39c7aec6t.png)


2._Leverage the Custom AI builder in Power Automate Flow_


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95t3334vklb9kl7s391k.png)

An example workflow is as below: when a file is placed in onedrive, an automated trigger would call the AI builder to classify the document and notify the user on the file name and 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ubf5q0orm6fn9m98wnuq.png)


**Demo**:
![Image description](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExOGFmYmNmOGI1MGYxOTJjODU5M2YzOTA1YjQ4YzI0MTg4MThkMTI5ZCZjdD1n/gdne9jRT9SjXfu1w95/giphy.gif)


![Image description]
(https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMDgxNDJmMTU1Y2JmNzQwZjBiYTA4OTY4MTI1MmFkNWMwNDViOTkyNCZjdD1n/AsQb8gDlibhR3q61X9/giphy.gif)


**Conclusion**:
Overall, document classification is essential in logistics processing to improve efficiency, accuracy, compliance, and data analysis. By automating the process of document classification using AI, logistics companies can streamline their operations and make better use of the valuable data generated by logistics processing.