Skip to content
Permalink
Browse files

Merge pull request #308 from axa-group/feature/abbyy

Abbyy + UI
  • Loading branch information
marianorodriguez committed Jan 24, 2020
2 parents 1da6949 + d7d5e30 commit 490af3b42a7d0396432e650475ce6581e800130c
@@ -29,15 +29,20 @@ export class ProcessManager {
docName: string,
outputPath: string,
credentials: {
googleVision: string,
googleVision: string;
msCognitiveServices: {
apiKey: string,
endpoint: string,
},
apiKey: string;
endpoint: string;
};
amazonTextract: {
accessKeyId: string,
secretAccessKey: string,
},
accessKeyId: string;
secretAccessKey: string;
};
abbyy: {
serverUrl: string;
serverVer: string;
serverWorkflow: string;
};
},
): void {
logger.info('Processing ' + doc);
@@ -48,9 +53,20 @@ export class ProcessManager {
} else if (credentials.msCognitiveServices.apiKey) {
process.env.OCP_APIM_SUBSCRIPTION_KEY = credentials.msCognitiveServices.apiKey;
process.env.OCP_APIM_ENDPOINT = credentials.msCognitiveServices.endpoint;
} else if (credentials.amazonTextract.accessKeyId && credentials.amazonTextract.secretAccessKey) {
} else if (
credentials.amazonTextract.accessKeyId &&
credentials.amazonTextract.secretAccessKey
) {
process.env.AWS_ACCESS_KEY_ID = credentials.amazonTextract.accessKeyId;
process.env.AWS_SECRET_ACCESS_KEY = credentials.amazonTextract.secretAccessKey;
} else if (
credentials.abbyy.serverUrl &&
credentials.abbyy.serverVer &&
credentials.abbyy.serverWorkflow
) {
process.env.ABBYY_SERVER_URL = credentials.abbyy.serverUrl;
process.env.ABBYY_SERVER_VER = credentials.abbyy.serverVer;
process.env.ABBYY_WORKFLOW = credentials.abbyy.serverWorkflow;
}

const args: string[] = [
@@ -344,6 +344,11 @@ export class ApiServer {
accessKeyId: 'awsAccessKeyId' in req.body && req.body.awsAccessKeyId,
secretAccessKey: 'awsSecretAccessKey' in req.body && req.body.awsSecretAccessKey,
},
abbyy: {
serverUrl: 'abbyyServerUrl' in req.body && req.body.abbyyServerUrl,
serverVer: 'abbyyServerVer' in req.body && req.body.abbyyServerVer,
serverWorkflow: 'abbyyServerWorkflow' in req.body && req.body.abbyyServerWorkflow,
},
};

this.fileManager.newBinder(docId, doc.path, config.path, outputPath, docName);
@@ -85,6 +85,15 @@ export default {
formData.append('awsAccessKeyId', credentials.awsAccessKeyId);
formData.append('awsSecretAccessKey', credentials.awsSecretAccessKey);
}
if (
credentials.abbyyServerUrl &&
credentials.abbyyServerVer &&
credentials.abbyyServerWorkflow
) {
formData.append('abbyyServerUrl', credentials.abbyyServerUrl);
formData.append('abbyyServerVer', credentials.abbyyServerVer);
formData.append('abbyyServerWorkflow', credentials.abbyyServerWorkflow);
}
return apiClient.post('/document', formData);
},
getDocumentStatus(docID) {
@@ -39,11 +39,10 @@
solo
></v-select>
<div
style="padding-left: 60px"
class="selectOptionExtractor"
class="selectOptionExtractor ocrParameters"
v-if="defaultConfig.extractor.img === 'google-vision'"
>
<legend><sup>*</sup>GOOGLE_APPLICATION_CREDENTIALS:</legend>
<legend>GOOGLE_APPLICATION_CREDENTIALS<sup>*</sup></legend>
<input
type="file"
@change="googleCredentialsChanged"
@@ -53,14 +52,13 @@
/>
</div>
<div
style="padding-left: 60px; text-align: left"
class="selectOptionExtractor"
class="selectOptionExtractor ocrParameters"
v-if="defaultConfig.extractor.img === 'ms-cognitive-services'"
>
<legend><sup>*</sup>Ocp-Apim-Subscription-Key:</legend>
<legend>Ocp-Apim-Subscription-Key<sup>*</sup></legend>
<input style="border-style: groove" id="MSAPIKEY" name="MSAPIKEY" v-model="msApiKey" />

<legend><sup>*</sup>Endpoint:</legend>
<legend>Endpoint<sup>*</sup></legend>
<input
style="border-style: groove"
id="MSENDPOINT"
@@ -69,26 +67,54 @@
/>
</div>
<div
style="padding-left: 60px; text-align: left"
class="selectOptionExtractor"
class="selectOptionExtractor ocrParameters"
v-if="defaultConfig.extractor.img === 'amazon-textract'"
>
<legend><sup>*</sup>access_key_id:</legend>
<legend>Access_key_id<sup>*</sup></legend>
<input
style="border-style: groove"
id="awsKeyId"
name="awsKeyId"
v-model="awsAccessKeyId"
/>

<legend><sup>*</sup>secret_access_key:</legend>
<legend>Secret_access_key<sup>*</sup></legend>
<input
style="border-style: groove"
id="awsSecretKey"
name="awsSecretKey"
v-model="awsSecretAccessKey"
/>
</div>

<div
class="selectOptionExtractor ocrParameters"
v-if="defaultConfig.extractor.img === 'abbyy'"
>
<legend>Abbyy_server_url<sup>*</sup></legend>
<input
style="border-style: groove"
id="abbyyServerUrl"
name="abbyyServerUrl"
v-model="abbyyServerUrl"
/>

<legend>Abbyy_server_ver<sup>*</sup></legend>
<input
style="border-style: groove"
id="abbyyServerVer"
name="abbyyServerVer"
v-model="abbyyServerVer"
/>

<legend>Abbyy_server_workflow<sup>*</sup></legend>
<input
style="border-style: groove"
id="abbyyServerWorkflow"
name="abbyyServerWorkflow"
v-model="abbyyServerWorkflow"
/>
</div>
</fieldset>

<fieldset>
@@ -145,6 +171,9 @@ export default {
msEndpoint: 'https://westeurope.api.cognitive.microsoft.com/',
awsAccessKeyId: null,
awsSecretAccessKey: null,
abbyyServerUrl: null,
abbyyServerVer: null,
abbyyServerWorkflow: null,
loading: false,
processStatus: [],
processStatusCompleted: false,
@@ -173,7 +202,9 @@ export default {
(this.customConfig.extractor.img === 'ms-cognitive-services' &&
!(this.msApiKey && this.msEndpoint)) ||
(this.customConfig.extractor.img === 'amazon-textract' &&
!(this.awsAccessKeyId && this.awsSecretAccessKey))
!(this.awsAccessKeyId && this.awsSecretAccessKey)) ||
(this.customConfig.extractor.img === 'abbyy' &&
!(this.abbyyServerUrl && this.abbyyServerVer && this.abbyyServerWorkflow))
);
},
/*
@@ -289,6 +320,9 @@ export default {
msEndpoint: this.msEndpoint,
awsAccessKeyId: this.awsAccessKeyId,
awsSecretAccessKey: this.awsSecretAccessKey,
abbyyServerUrl: this.abbyyServerUrl,
abbyyServerVer: this.abbyyServerVer,
abbyyServerWorkflow: this.abbyyServerWorkflow,
},
})
.then(() => {
@@ -435,4 +469,18 @@ label span {
.selectOptionExtractor div {
min-height: auto !important;
}
.ocrParameters {
padding-left: 60px;
text-align: left;
}
.ocrParameters legend {
font-size: 0.8em;
}
.ocrParameters input {
font-size: 0.8em;
width: 230px;
color: rgba(0, 0, 0, 0.87);
}
</style>
@@ -1,5 +1,5 @@
/**
* Copyright 2019 AXA Group Operations S.A.
* Copyright 2020 AXA Group Operations S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,9 +72,9 @@ export class AbbyyTools extends Extractor {
}

public run(inputFile: string): Promise<Document> {
const host: string = process.env.ABBYY_SERVER_URL || '172.23.132.137';
const serverVersion: string = process.env.ABBYY_SERVER_VER || '14';
const workflowName: string = process.env.ABBYY_WORKFLOW || 'workflow-hotfolder-d_drive';
const host: string = process.env.ABBYY_SERVER_URL; // 172.23.132.137
const serverVersion: string = process.env.ABBYY_SERVER_VER; // 14
const workflowName: string = process.env.ABBYY_WORKFLOW; // workflow-hotfolder-d_drive
const serverTimeout: number = 50000;
const jobPollingInterval: number = 1000;

0 comments on commit 490af3b

Please sign in to comment.
You can’t perform that action at this time.