How to write Custom Processing for each label?

We allow users to add custom processing along with a predefined list provided in the general tab.

Custom Processing:-

Important

  1. 'self' is replaced with a label name.

  2. No space between any function

  3. You can also combine function like UPPER(LEFT("docsumo",3))

While creating a function, anything inside single quotes is taken as variable name and double quotes is taken as string E.g: UPPER(LEFT("docsumo",3)) > "DOC" E.g: UPPER(LEFT('self', 3)) > we expect self to pass data as {'self': "docsumo") > "DOC"

Supported Functions

Function Name

Description

Example

LEFT

Returns the leftmost characters from a text value

=LEFT("docsumo",3)

RIGHT

Returns the leftmost characters from a text value

=RIGHT("docsumo",4)

SUM

Sum of all the values

d = {'a':1, 'b':4, 'self':5} =SUM('a', 'b')>5

=SUM('self')>5

SEARCHINLIST

Search the value in list provided SEARCHINLIST(text, text_to_search_with_separator, separator)

=SEARCHINLIST("hi" , "hi,hello", ",")

=SEARCHINLIST("bye" , "hi,hello", ",")

REMOVEFROMLIST

Remove words if in list REMOVEFROMLIST(text, text_to_search_with_separator, separator)

=REMOVEFROMLIST("hi world" , "hi,hello", ",")

GETDATAURL

Get value from url GETDATAURL("URL,AUTH,DATA, POST_PROESSING,METHOD")

=GETDATAURL("https://d.com/api/v1/eevee/apikey/limit/,X-API-KEY:1234,,,GET%22) > "value" =GETDATAURL(https://app.docsumo.com/api/v1/eevee/apikey/limit/,X-API-KEY:Ckyp8ZES,,data.document_types.0.title,GET) > "Auto Classify"

FINDANDREPLACE

Remove word from string FINDANDREPLACE(text, list, replacing_str, separator, strict)

=FINDANDREPLACE("hi hello world namaste", "hello, world", "apple,mango", ",", 1)

PARSEADDRESS

Parse any USA address into into its component parts, like a street number, street name, suffix, and others

=PARSEADDRESS("687 NW. Woodsman St. Wheaton, IL 60187")

>"{"AddressNumber": "687", "StreetNamePreDirectional": "NW.",

"StreetName": "Woodsman", "StreetNamePostType": "St.",

"PlaceName": "Wheaton", "StateName": "IL",

"ZipCode": "60187"}

IF

Write complete if and else logic. You can also nest the IF similar to excel. IF(condition, True_value, False_value)

= IF(LEN('self')>5, "this is good", "this is bad") {"self": "IN1234567"}

>this is good

DELTADATE

Compare two dates to find if range falls within given interval.

DELTADATE(date1, date2, interval: defaults 30, format: defaults "dd/mm/yyyy", available: "mm/dd/yyyy" )

DELTADATE("12/12/2020","15/12/2020",1,"dd/mm/yyyy") > False

DELTADATE("12/12/2020","15/12/2020",10,"dd/mm/yyyy") > True

MAKELIST

MAKELIST(str)

Get value as list on webhook or api response.

MAKELIST('self')

MAKELIST("abc123") => ["abc123"]

MAKELIST("abc123\ndef456") => ["abc123","def456"]

TABLEOPERATOR

TABLEOPERATOR("table_name, operator")

table_name is combination of section name, table name and column name with format: section_name___table_name___column_name

operator=any of the sum or count

TABLEOPERATOR("Table Section___Table 1___Amount, sum")

TABLEOPERATOR("Table Section___Table 1___Amount, count")

Get a dropdown from URL

You can add a dropdown from URL.

The output should be a list. E.g ["invoice", "bank statement"]

url,header,data,postprocessing,method
E.g: https://appdocsumo.com/api/v1/eevee/apikey/limit/,X-API-KEY:Ckypp36YES,,data.document_types.loop__title,GET
> ["invoice", "pan", "bs"]
Detail
- url: str
- Eg: *https://apptesting.docsumo.com/api/v1/eevee/apikey/limit/*
- header: str
- Eg: *X-API-Key:asdf1234*
- data: dict
- postprocessing: str
- get required datas from response of **url**
Let: response =
{data: {document_types:[{"title":"TITLE1","value":"VALUE1"},{"title":"TITLE2", "value":"VALUE2"}]}}
- to get all titles
Eg: *data.document_types.loop_title*
Output: ["TITLE1", "TITLE2"]
- use .loop_ to loop through lists or [int]. to get data from specific index
Eg: *data.document_types.1.title*
Output: "TITLE2"
- method: str
- only GET and POST methods are allowed

Happy Annotating!