This code snippet demonstrates how to digitize, classify, validate, and extract documents using UiPath Document Understanding API's.
UiPath Document Understanding offers standalone capabilities, allowing integration with external tools and systems through APIs. This release includes APIs for Discovery, Digitization, Classification, Extraction, and Validation. Please take a look at the Official Documentation.
- Python 3.11+
requests
librarypython-dotenv
library
-
Clone the repository to your local machine:
git clone https://github.com/nvpnathan/DU-Cloud-APIs.git
-
Navigate to the project directory:
cd DU-Cloud-APIs
-
Create a Python virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install the required dependencies:
pip3 install -r requirements.txt
-
Set up your environment variables by copying
.env.example
to.env
file in the root directory and provide theAPP_ID
andAPP_SECRET
from your Cloud Envirnment:
APP_ID=
APP_SECRET=
AUTH_URL=https://cloud.uipath.com/identity_/connect/token
BASE_URL=https://cloud.uipath.com/<Cloud Org>/<Cloud Tenant>/du_/api/framework/projects/
PROJECT_ID=00000000-0000-0000-0000-000000000000
-
Place the documents you want to process in the specified folder (
Example Documents
by default). -
Run the main script
main.py
to process the documents:python3 src/main.py
-
Monitor the console output for processing status and any errors.
-
Extracted results will be printed to the console and saved in CSV format in the same folder as the processed documents.
The project structure is organized as follows:
DU-Cloud-APIs/
│
├── src/
│ ├── main.py # Main entry point for the application
│ ├── auth.py # Authentication module for obtaining bearer token
│ ├── digitize.py # Digitize module for initiating document digitization
│ ├── classify.py # Classify module for document classification
│ ├── extract.py # Extract module for document extraction
│ ├── validate.py # Validate module for document validation
│ └── result_utils.py # Utility module for printing and writing extraction results
│
├── .env.example # Example environment variables file
├── requirements.txt # Python modules configuration file
├── example_documents/ # Folder containing example documents
├── generative_prompts/ # Folder containing Extraction and Classification Prompt Templates
└── output_results/ # Folder containing the CSV's of the Document Extraction Results
- Write Tests
- Write Discovery API
- Add Black