How to create variable with ExtractionResults to check confidence and pass automatically?

We have been using the document understanding invoice stuff for some time now and it works great. With the addition of the AI Fabric trained models we now have high enough confidence on most invoices in order to start automatically processing some with higher confidence scores on each field. We use a dispatcher workflow to read each invoice with OCR, run through the Machine Learning extractor, then save the results into a Uipath queue. We also have another performer workflow which the AP folks use to validate any invocies in that queue each day.

I would like to modify the dispatcher workflow to check the confidence scores for each invoices as they are read and put through the machine learning extractor. I cannot find the correct namespaces available so that I can create variables for the ExtractionResults.ResultsDocument.Fields.

I have searched the available namespaces in Studio and in the documentation but cannot find any good solution.

I created a ResultDocument object using :
var resultsDocument = extractionResults.ResultsDocument
I was thinking maybe something like this would work:
resultsDocument.Fields.Where(t => t.FieldName == "Invoice Number").Values.Confidence

How can I get the values of the confidence for each field in our object?

Here is the Confidence property I am trying to access in the ExtractionResults object:


I feel like I could help answer this if you gave me another month or two to create a project that utilizes the DU and ML models to understand the .net around it. :rofl:
@Lahiru.Fernando just presented a solution recently at DevCon where the confidence is checked. He might be able to assist.

1 Like

Hi @mtu,

you can find it by below code


where extractionResults is the extraction result variable :slight_smile:
i hope this works, if it mark this as a solution or else let me know for any queries :slight_smile:


@Shikhar_Tandon thanks for the response, but this value is not related to the actual confidence in the fields captured, which we need in order to see that every value has a good selection.

You can see from the entire ExtractionResults object that this confidence is only at the top of the object and is not related to the actual invoice values in the image below. What we need is to get access the the “Fields.Values.Confidence” properties for every field name in our taxonomy circled red below:

@ClaytonM, @Lahiru.Fernando That would be excellent, I would appreciate the help! I can’t seem to find any documentation or forum posts with clues to get further.

I actually found a way to access the object properties using the Newtonsoft.Json.Linq namespace. I don’t think there is any other way since the actual class objects for Extractionresults do not have all the properties available. Here is a screenshot of what I got working:


Yeah makes sense if it’s in a json format. So deserializing it can get the values from the json string.

By the way, here is a screenshot of what was used in an end to end project using the Classifier

appears he used the 0 index with the result

1 Like

Also, there was another part where he Exported the data and checked the confidence after manual validation:

Then, looped over it:

I’m just re-watching the presentation here:

1 Like

Awesome, thanks, man! I’ll take a look at the presentation as well.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.