Upload documents to a learning instance in Document Automation
Build a bot to upload documents to a specific learning instance for processing and extraction.
Pré-requisitos
Ensure you have the name of the destination learning instance.
Procedimento
-
Navigate to Automation > Private tab and click Create a bot.
Ensure you do not place the bot in the IQ Bot Processes folder.
-
Provide a name for the bot, such as
Extraction-Scheduler
. -
Create the following variables: Criar uma variável
Variable name Description Data type Value File_Count
Increments with each loop iteration to count the number of files uploaded for processing. Number 0 Extraction_DeviceCount
Number of Bot Runner devices connected to the Control Room Number Enter the number of connected Bot Runner devices Scheduler_Interval
Scheduling interval in minutes Number Enter the interval for which you will schedule this bot to run when you deploy it Average_Pages
Average number of pages per document Enter the approximate average number of pages in the documents FilesInFolder
Holds file name and extension Dictionary -- SourcePath
File path to the folder containing documents awaiting upload to IQ Bot String Enter the file path OutputPath
File path to the folder containing the extracted data and invalid or failed documents String Enter the file path where you want the IQ Bot output -
Insert a Loop
action to iterate through all the documents in a specific file
path.
- Double-click or drag the Loop action.
- Select the For each file in folder iterator.
-
Insert the
SourcePath
variable into the Folder path field. -
Insert the
FilesInFolder
variable into the Assign file name and extension to this variable field.
-
Insert an If
action to compare the number of documents uploaded for processing
to the number of Bot Runner devices multiplied by a scheduling
interval and divided by the average number of pages.
Nota: You must include this equation to limit the number of files uploaded for processing at one time to ensure that the Bot Runners are able to process the documents.
- Drag the If action into the Loop container.
- Select the Number condition.
-
Insert the
File_Count
variable into the Source value field. - Select the Less than operator.
-
Enter the following into the Target value field:
$Extraction_DeviceCount$*$Scheduler_Interval$/$
Average_Pages
$
-
Insert If: Else and Loop: Break
actions to end the loop if the condition is not met:
- Drag the If: Else action beside the If action in the Loop container.
- Drag the Loop: Break action into the If: Else container.
-
Insert an error handling mechanism to log any possible errors:
- Drag the Error handler: Try action into the If container.
- Drag the Error handler: Catch action beside the Error handler: Try action.
- Drag a Log to file action below the Error handler: Catch action.
- Provide the file name and path where to log the errors.
-
Enter the text to log if an error occurs, such as
Extraction-Request-Failed
. - Select the Append timestamp option.
- Drag a Delay action below the Log to file action.
- Set a delay of 10 seconds.
-
Configure actions to upload documents to the process associated
with a specific learning instance.
- Drag the AARI Web: Create a request action below the Error handler: Try action.
- Mark the Set LearningInstanceName option and provide the name of the learning instance where to send the documents.
-
Mark the Set InputFile option and enter
$SourcePath$/$FilesInFolder{name}$.$FilesInFolder{extension}$
. -
Mark the Set InputFileName option and enter
$FilesInFolder{name}$.$FilesInFolder{extension}$
. -
Mark the Set OutputFolder option and enter
$OutputPath$
. - Drag the Number: Increment action below the AARI Web: Create a request action.
-
Insert the
File_Count
variable into the Number and Assign output to variable fields.The Number action increases the value ofFile_Count
by one each time a file is uploaded to the learning instance. As long as the value inFile_Count
is less than the total in the equation you entered in step 5, the bot can run another loop iteration to upload another document to the learning instance.
-
Make a copy of the uploaded file to a different location
on your desktop to keep track of which documents were successfully
uploaded:
- Drag the File: Copy Desktop file action below the Number: Increment action.
-
Enter
$SourcePath$/$FilesInFolder{name}$.$FilesInFolder{extension}$
in the Source file field. - Provide the folder path where to copy the files.
-
Remove documents after they are uploaded to IQ Bot so they do
not get re-uploaded in the next iteration:
- Drag the File: Delete action.
-
Enter
$SourcePath$/$FilesInFolder{name}$.$FilesInFolder{extension}$
in the File field.
- Click Save.
The completed bot should resemble the one in the image below:
Próximas etapas
Publish the process and bot. See step 3 of Configure and publish the assets in Document Automation