How Watson, Bluemix, Cloudant, and XPages Can Work Together In A Real
World ApplicationFrank van der Linden, elstar IT
Full stack Java Developer Track 3 - Session 1
EntwicklerCamp 2018
Me• Freelance Full stack Java developer
• Owner of elstar IT
• Curious of new technology
• IBM Champion 2013, 2014, 2017 and 2018
How do we proceed• HR Assistant
• Running it on IBM BlueMix
• Store it in Cloudant
• Analyse it with IBM Watson
• Show it with Charts
• Add new features
• Lessons learned
HR Assistant
Demo time
Frédéric Dehédin• At the time of the project: Senior Application developer
at Belsoft Collaboration AG
• @fdehedin
• http://www.fdehedin.ch/
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
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.
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
Roadmap
Running it on IBM BlueMix
Overview• BlueMix is IBM PaaS, with various services
• We picked a few services
Credentials
Deploy to IBM BlueMix• Fill the BlueMix Manifest file under
Application Configuration
• Will result in a yaml file
Deploy to IBM BlueMix• Set location of deployment
• Add shared-plugin folder
• Add the OSGi plugins
Deploy to IBM BlueMix• Deploy Application
Store it in Cloudant
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
What is Cloudant• Data stored as JSON
• View and Search ‘formula’ defined in javascript
• Replication
• Tasks
• Build in API
• No annoying limitations
Cloudant database
Design document• Special type of document
• Holds javascript for View and FT Search definition.
• It is JSON everywhere.
• _rev and _id are reserved parameters.
• doc{}, is the actual data from application
Document
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
Attachment @ Cloudant• AttachmentDAO
Attachment @ Cloudant• AttachmentController
• Convert upload to Attachment object
Attachment @ Cloudant• ControllerBase
• All controllers can use these methods
Attachment @ Cloudant• Servlet is called in application for download
• base64 data for the image tag
Analyse it with IBM Watson
Watson API explorer• Very useful to test input and see what is returned
Services we used• Tone analyser, to get the tone of the text
• Personality Insight, to determine the personality of the job applicant
• Natural Understanding Language, to get the keywords from the Job and Job application
tone analyser schema
Tone analyser• The same structure to call the Watson services
Tone analyser• ToneAnalyzerRequest contain the text to analyse
• ToneAnalyzerInjector gets text from model class
Tone analyser• Post the data to IBM Watson service (1)
• Convert the response back to Java class (2)
1
2
Tone analyser• ToneAnalyzerResponse holds the results
• Use @Annotations from Jackson to map JSON to properties
• Result is the source of the charts
Show it with charts
ChartJS• Open source HTML5 javascript based
• Responsive
• DataSets = Array of Objects
ChartJS• Factory to produce the chart data, accepts objects
• Factory set default Chart Type, like Radar or Bar
ChartJS
ChartJS• Custom control to display data
ChartJS• Custom control to display data.
Lessons learned
Lessons learned• No Single Sign On service on all datacenters
• Domino Designer and GIT are not an happy couple
• API’s are not consistent across Watson services, but it gets better
• Cloudant is a very reliable, flexible and fast NoSQL datastore
• IBM Watson services are really powerful.
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.
• IBM Watson keeps changing. For example the Document Conversion
New features (not on GitHub)
Multi language• Property with labels are stored in design
• Export of this labels
• Import of newly translated labels
• Everything is stored in datastore
Multi language
Multi language
Multi language
Multi language
Runs on Domino• ACL is enforced when run on Domino
• 3 Roles can be assigned to a NAB group
• Application ‘knows’ where it runs
Runs on Domino
NSF as datastore• Make use of the OpenNTF Domino API
• Stores data as JSON in 1 field
• ODA convert field to RichText as limit of field is reached
NSF as datastore
Document Conversion API• Spring Boot application runs on IBM Cloud
• Convert document as base64 encoded string
• Convert document as uploaded file
• Code is open source
• Swagger support
Document Conversion API
Settings• Settings stored in a custom property file
• Edit in the browser
• Only available on the Domino server
• Thanks to Sven Hasselbach (http://hasselba.ch/blog/?p=1763)
Settings
Settings
Questions
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
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/
• Document Conversion API
• https://bitbucket.org/flinden68/document-conversion-api
Reach out to me• @flinden68
• http://www.elstarit.nl
• https://nl.linkedin.com/in/flinden68