Skip to content

Commit b7c20c8

Browse files
Initial File checkin
0 parents  commit b7c20c8

29 files changed

+3466
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/node_modules
2+
tmp

.env.sample

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Service credentials
2+
# ===================
3+
4+
5+
# Security
6+
TDNS_SECRET=
7+
8+
9+
# NLU Instance Name: Natural Language Understanding Automation Anywhere | Org: wincart_org
10+
NLU_USERNAME=
11+
NLU_PASSWORD=
12+
13+
14+
# WKS Instance Name: Knowledge Studio-Shared | Org: wincart_org | Workspace Name: 10K Model
15+
WKS_MODEL_ID=
16+
17+
18+
# Discovery Instance Name: Discovery-shared-6 | Org: wincart_org
19+
DISCOVERY_USERNAME=
20+
DISCOVERY_PASSWORD=
21+
ENVIRONMENT_ID=
22+
COLLECTION_ID=
23+
24+
25+
# Entity Property File name
26+
ENTITY_TYPE_FILE_NAME=
27+
ENTITY_NAME_FILE_NAME=

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/old

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": ["standard"],
3+
"rules": {
4+
"max-len": "warn"
5+
}
6+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/node_modules
2+
/images
3+
/tmp
4+
/old
5+
.vscode

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# latest official node image
2+
FROM node:10
3+
4+
RUN apt-get update -y
5+
6+
# add project files
7+
WORKDIR /app
8+
ADD . /app
9+
10+
# add project files
11+
WORKDIR /app
12+
ADD . /app
13+
14+
RUN npm install --production
15+
16+
EXPOSE 3000
17+
18+
CMD ["npm", "start"]

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
# Automation Anywhere Document Classifier Service
3+
4+
It is a micro service which takes a PDF file as an input and return the type of the file. It first check the file name for the file type detection. If nothing matches then it analyze the first few words (1000 words) of the PDF file using Watson NLU to check the entities using Watson Knowledge Studio trained custom model id. If it find some value then it returns to the user as a text string (ex: File type detected as 'Consignment Agreement') else it says 'Could not detect the file type'.
5+
6+
7+
8+
## Included components
9+
10+
* [Watson Natural Language Understanding (NLU)](https://console.bluemix.net/catalog/services/natural-language-understanding):
11+
>A IBM Cloud service that can analyze text to extract meta-data from content such as concepts, entities, keywords, categories, sentiment, emotion, relations, semantic roles, using natural language understanding.
12+
13+
* [IBM Watson Knowledge Studio (WKS)](https://console.bluemix.net/catalog/services/knowledge-studio):
14+
>Teach Watson the language of your domain with custom models that identify entities and relationships unique to your industry, in unstructured text. Build your models in a collaborative environment designed for both developers and domain experts, without needing to write code. Use the models in Watson Discovery, Watson Natural Language Understanding, and Watson Explorer.
15+
16+
17+
18+
## Github
19+
20+
https://github.com/with-watson/aa-doc-classifier
21+
22+
23+
24+
## Local Run
25+
26+
* npm install
27+
* npm start
28+
29+
30+
31+
## API
32+
> URL: dc-micro-service.withwatson-std-cluster.us-south.containers.mybluemix.net
33+
`POST -> /api/adc`
34+
35+
36+
- HEADER:
37+
- key: {string} secret key
38+
39+
- FORM DATA:
40+
- file: PDF file only
41+
42+
- OUTPUT:
43+
- File_Type: text value
44+
45+
46+
47+
## Config
48+
49+
Environment Variables:
50+
51+
* PORT: the port that the application will listen on. Default `3000`
52+
53+
* TDNS_SECRET: simple key for auth control. Default key = `topsecret`
54+
55+
56+
## Docker Image Push
57+
58+
- IBM Cloud plugin & Namespaces
59+
- bx plugin list | List IBM Cloud installed plugin.
60+
- bx plugin update container-service | Update IBM Cloud plugin update.
61+
- bx login --sso | Log in to IBM Cloud
62+
63+
- IBM Cloud Namespaces
64+
- bx cr namespace-list | Namespaces list
65+
- bx cr namespace-rm dc-micro-service | Delete namespace named dc-micro-service
66+
- bx cr namespace-add dc-micro-service
67+
68+
- IBM Cloud clusters
69+
- bx cs clusters | List clusters.
70+
- bx cs cluster-config withwatson-std-cluster | configuration for withwatson-std-cluster is downloaded
71+
- export KUBECONFIG=/Users/abhi/.bluemix/plugins/container-service/clusters/withwatson-std-cluster/kube-config-dal13-withwatson-std-cluster.yml
72+
73+
- Mini Cube Configure:
74+
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.27.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ | Install minicube on local machine
75+
- minikube start
76+
- minikube status
77+
- minikube stop
78+
- minikube delete
79+
80+
- kubectl apply:
81+
- Goto doc-classifier/kubernetes folder and run following commands after modifying all the three files:
82+
- brew install kubectl
83+
- kubectl apply -f deployment.yaml
84+
- kubectl apply -f port-service.yaml
85+
- kubectl apply -f ingress.yaml
86+
87+
- Build docker image:
88+
- docker images | List of existing images.
89+
- docker rmi -f image_id | Remove an image with a numerical id 'image_id'.
90+
- docker pull node:10 | Pull the node version 10 image from docker hub.
91+
- docker build -t dc-micro-service . | Build local image
92+
- docker build -t registry.ng.bluemix.net/dc-micro-service/dc-micro-service:2018-05-23.0 . | Build image in IBM Cloud
93+
94+
- Push docker image:
95+
- docker push registry.ng.bluemix.net/dc-micro-service/dc-micro-service:2018-05-23.0 | Push image
96+
- bx cr image-list | Images list
97+
- The url is: http://dc-micro-service.withwatson-std-cluster.us-south.containers.mybluemix.net
98+
- bx cr image-rm registry.ng.bluemix.net/dc-micro-service/dc-micro-service:2018-05-23.0 | Delete one or more images from IBM Cloud Container Registry.
99+
100+
101+
102+
103+
## Demo
104+
105+
<img src="/readme-images/postman request.gif" width="100%"/>
106+

app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var http = require('http');
2+
3+
var port = (process.env.PORT || process.env.VCAP_APP_PORT || 8888);
4+
5+
http.createServer(function (req, res) {
6+
res.writeHead(200, {'Content-Type': 'text/plain'});
7+
res.end('Hello World!\n');
8+
}).listen(port);
9+
10+
console.log('Server running at http://127.0.0.1:'+port);

data/Test Files/CA 1.pdf

57.8 KB
Binary file not shown.
57.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)