SmartExtractSimple API
Usage
Creating an Instance
import { SmartExtractSimple } from '@clik-ai/smart-extract';
const smex = new SmartExtractSimple({
baseUrl: 'https://app.clik.ai/smart-extract',
});import { SmartExtractSimple } from '@clik-ai/smart-extract';
const smex = new SmartExtractSimple({
baseUrl: 'https://app.clik.ai/smart-extract-stg',
});Extracting Document Data
const data = await smex.extractDocumentData({
session: {
mountNode: $('#smexWrapper')[0],
sessionAuthToken: token,
closeOnComplete: false,
},
file: fileDataUrl,
fileName: file.name,
options: {
disableRetry: true,
shouldPreProcessData: false,
preProcessFunction: someFunctionToPreProcessExtractedData,
// ...
}
});
// Note:
// -----
//
// If user clicked 'Cancel'
// data = null
// If user clicked 'Save'
// data = {
// meta: {
// assetType: '<The asset type of the document>',
// documentType: '<The document type>',
// osPeriod: [new Date('<start-date>'), new Date('<end-date>')],
// fileName: <The document file name>,
// ...
// },
// workbookData: {...},
// documentData: {
// // plain text data as detected in the document
// source: {
// rows: [
// // First value is S.N. on each row signifying a unique row-id for each row in the document
// ['S.N.', '', '', '', ....], // Each row is an array of all text-tokens detected in the row
// [1010, ..., ..., ..., ...],
// // ... rest of the data rows
// ],
// }
// // extracted document data as a list of object.
// extracted: {
// rows: [
// { '<column-name-1>': '<column-value>', '<column-name-2>': '<column-value>', /* ... ,*/}
// // ... rest of the data rows
// ]
// }
// },
// }Editing Previously Extracted Data
Ending SmartExtract Session
Last updated