DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application
-
Upload
frank-van-der-linden -
Category
Software
-
view
739 -
download
0
Transcript of DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application
![Page 1: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/1.jpg)
How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real
World ApplicationFrank van der Linden, elstar IT
Full stack Java Developer DEV03
Engage 2017
![Page 2: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/2.jpg)
Me• Freelance Full stack Java developer
• Owner of elstar IT
• Curious of new technology
• IBM Champion 2013, 2014 and 2017
![Page 3: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/3.jpg)
How do we proceed• HR Assistant
• Running it on IBM Bluemix
• Store it in Cloudant
• Analyse it with IBM Watson
• Show it with Charts
• Lessons learned
• The future
![Page 4: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/4.jpg)
HR Assistant
![Page 5: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/5.jpg)
![Page 6: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/6.jpg)
Demo time
![Page 7: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/7.jpg)
Frédéric Dehédin• At the time of the project: Senior Application developer
at Belsoft Collaboration AG
• @fdehedin
• http://www.fdehedin.ch/
![Page 8: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/8.jpg)
Facts• Winner of the ICS Developer Competition 2016
• Runs on the XSP runtime on IBM Bluemix
• Store all the data in Cloudant
• Analyse jobs and job applications with IBM Watson
• Backend is pure Java, no Java Notes objects
![Page 9: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/9.jpg)
Add ons• Cloudant connector OSGi plugin
• Take out the security issue
• Storing in and retrieving from Cloudant. JSON <—> POJO
• Can be accessed from Java backend.
• Do the heavy lifting. Don't reinvent the wheel.
![Page 10: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/10.jpg)
Add ons• Jackson Mapper OSGi plugin
• Take out the security issue
• Used with the IBM Watson services
• Conversion of JSON to POJO
• Makes @Annotations available in Java back end
![Page 11: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/11.jpg)
Roadmap
![Page 12: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/12.jpg)
Running it on IBM Bluemix
![Page 13: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/13.jpg)
Overview• Bluemix is IBM PaaS, with various services
• The services we used.
![Page 14: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/14.jpg)
Credentials
![Page 15: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/15.jpg)
Deploy to IBM Bluemix• Fill the Bluemix Manifest file under
Application Configuration
• Will result in a yaml file
![Page 16: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/16.jpg)
Deploy to IBM Bluemix• Set location of deployment
• Add shared-plugin folder
• Add the OSGi plugins
![Page 17: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/17.jpg)
Deploy to IBM Bluemix• Deploy Application
![Page 18: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/18.jpg)
Store it in Cloudant
![Page 19: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/19.jpg)
What is Cloudant• It is the cloud version of CouchDb
• It is document based
• CouchDb is created by Damien Katz
• Cloudant is bought by IBM
• Is like MongoDb or NSF a NoSQL datastore
![Page 20: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/20.jpg)
What is Cloudant• Data stored as JSON
• View and Search ‘formula’ defined in javascript
• Replication
• Tasks
• Build in API
• No annoying limitations
![Page 21: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/21.jpg)
Cloudant database
![Page 22: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/22.jpg)
Design document• Special type of document
• Holds javascript for View and FT Search definition.
![Page 23: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/23.jpg)
• It is JSON everywhere.
• _rev and _id are reserved parameters.
• doc{}, is the actual data from application
Document
![Page 24: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/24.jpg)
Attachment @ Cloudant• Stored as base64 encoded String
• Can be as standalone
• Or as part of Document (we choose this way)
• Store id as attachmentId, so it can be retrieved when needed
![Page 25: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/25.jpg)
Attachment @ Cloudant• AttachmentDAO
![Page 26: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/26.jpg)
Attachment @ Cloudant• AttachmentController
• Convert upload to Attachment object
![Page 27: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/27.jpg)
Attachment @ Cloudant• ControllerBase
• All controllers can use these methods
![Page 28: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/28.jpg)
Attachment @ Cloudant• Servlet is called in application for download
• base64 data for the image tag
![Page 29: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/29.jpg)
Analyse it with IBM Watson
![Page 30: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/30.jpg)
Watson API explorer• Very useful to test input and see what is returned
![Page 31: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/31.jpg)
Services we used• Tone analyser, to get the tone of the text
• Personality Insight, to determine the personality of the job applicant
• AlchemyLanguage, to get the keywords from the Job and Job application (now "Watson Natural Language Understanding”)
![Page 32: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/32.jpg)
tone analyser schema
![Page 33: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/33.jpg)
Tone analyser• The same structure to call the Watson services
![Page 34: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/34.jpg)
Tone analyser• ToneAnalyzerRequest contain the text to analyse
• ToneAnalyzerInjector gets text from model class
![Page 35: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/35.jpg)
Tone analyser• Post the data to IBM Watson service (1)
• Convert the response back to Java class (2)
1
2
![Page 36: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/36.jpg)
Tone analyser• ToneAnalyzerResponse holds the results
• Use @annotations from Jackson to map JSON to properties
• Result is the source of the charts
![Page 37: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/37.jpg)
Show it with charts
![Page 38: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/38.jpg)
ChartJS• Open source HTML5 javascript based
• Responsive
• DataSets = Array of Objects
![Page 39: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/39.jpg)
ChartJS• Factory to produce the chart data, accepts objects
• Factory set default Chart Type, like Radar or Bar
![Page 40: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/40.jpg)
ChartJS
![Page 41: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/41.jpg)
ChartJS• Custom control to display data
![Page 42: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/42.jpg)
ChartJS• Custom control to display data.
![Page 43: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/43.jpg)
Lessons learned
![Page 44: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/44.jpg)
Lessons learned• No Single Sign On service on all datacenters
• Manifest yaml file and GIT are not an happy couple
• API’s are not consistent across Watson services
• Cloudant is a very reliable, flexible and fast NoSQL datastore
• IBM Watson services are really powerful.
![Page 45: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/45.jpg)
Lessons learned• There is no RichText on the web, it is HTML
• Handling attachments on Cloudant was a challenge. Took some time get a robust solution.
• BTW the way, we won the competition ;-)
![Page 46: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/46.jpg)
The future
![Page 47: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/47.jpg)
The future• Move on as commercial service / solution (in progress)
• Let it work with Domino authentication (done)
• Change AlchemyLanguage service to Natural Language Understanding service. (done)
• Add Document Conversion service (in progress)
• Add support for more NoSQL datastores (NSF done, MongoDb in progress)
• More to come…..
![Page 48: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/48.jpg)
Questions
![Page 49: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/49.jpg)
Resources• HR Assistant on Bluemix
• https://hrassistant1.mybluemix.net/
• HR Assistant code on GitHub • https://github.com/flinden68/HR-Assistant
• IBM Watson services
• https://www.ibm.com/watson/developercloud/services-catalog.html
• IBM Cloudant documentation • https://docs.cloudant.com/
• HR Assistant Demo • https://youtu.be/yM5Foxn9Fvg
![Page 50: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/50.jpg)
Resources• OSGi Cloudant connector
• https://bitbucket.org/flinden68/cloudant-connector
• OSGi Jackson JSON Wrapper • https://bitbucket.org/flinden68/jackson-json-mapper-plugin
• ChartJS
• http://www.chartjs.org/
• Watson API Explorer
• https://watson-api-explorer.mybluemix.net/
![Page 51: DEV03 - How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real World Application](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6cf4327f8b9ade418b480d/html5/thumbnails/51.jpg)
Reach out to me• @flinden68
• http://www.elstarit.nl
• https://nl.linkedin.com/in/flinden68