(877) 224-7768 <>
sales@profoundlogic.com <mailto:sales@profoundlogic.com>

iModernize - The Profound Logic Software Blog

Building A Real-World Cognitive Solution with NodeRun

Posted by Alex Roytman on Mar 5, 2019 4:27:54 PM

af291e58892291.5a0d2fb66c93cRecently, I wrote an article for the Cognitive Computing and AI edition of the COMMON Connect digital magazine. They asked me to discuss my thoughts on cognitive solutions and how Profound Logic was tackling the use of AI in the real world. I broke down the three stages when it comes to developing a cognitive project and also gave an example of a Watson visual recognition app I created. This blog also includes an interactive NodeRun embed that allows you to explore the code and implement your own cognitive proof of concept application. 

For years, every single day, I would get into my car and drive to the office. But in recent years, something dramatic has happened. I am no longer the one that drives to the office - the artificial intelligence system in my car, a Tesla Model 3, does 90% of the driving for me.

So, now that it is 2019, it's time that you start thinking about implementing AI in your business. Sooner or later, AI is going to disrupt most industries as we know it and you don't want to get left behind. If you are wondering where to start, this article is for you.

At a high level, your cognitive project will generally come down to these three stages: imagine the solution, collect and provide the data, and implement the AI. Let's look at these stages in a bit of detail, and then I will show you how I built a working artificial intelligence proof of concept that uses Watson's visual recognition service.

Imagine It

You start by envisioning how cognitive and AI can help your business. This may seem rather obvious but for many organizations, this may be the most difficult step. Fist, it takes an understanding of what the technology is capable of. This understanding allows you to brainstorm ideas and see the potential of how you can transform your business processes. Once you have several ideas, you may want to ask the following questions:

  • Does my idea bring significant business value?
  • Will the project I have in mind provide sufficient ROI?
  • Is my business ready for cognitive?

Having the right expectations is important. For example, don't expect AI predictions to be perfect 100% of the time - that will rarely be the case. Cognitive solutions are supposed to augment and expand human skills and capabilities, not replace them. 

In your efforts, it's important to look at what other organizations in your industry may be doing. there are more and more cognitive case studies becoming available, and many cognitive projects are in the works. For example, a project that one Profound Logic partner is working on revolves around the safety of mineworkers. The AI solution, in this case, produces a safety score based on video camera footage that can determine factors such as how often the workers are not wearing safety helmets. Knowing about these types of projects will spark ideas on how you can implement cognitive solutions within your business.

Your Data

The next thing to evaluate is whether you have the right data, as well as enough data, to embark on the project. Cognitive solutions often come down to collecting and having the necessary data, which may include both structured and unstructured information. The first step in your implementation might be to modernize your systems so that the right data becomes available. That might mean starting to collect information from new sources. It could also mean exposing existing legacy data through Web Services endpoints and introducing open source languages like Node.js so that your AI implementation has access to the right information. Modernizing and modularizing your application code is often part of the overall project.

Implementing Cognitive

Finally, you are ready to implement the solution. Implementing AI is often all about connecting the data that you've collected and exposed from various sources to a cognitive service in the cloud. While, in some scenarios, it might make sense to build cognitive capabilities in-house without a cloud provider, it is usually not the preferred approach. There are many existing cloud services available that provide AI and cognitive capabilities that are likely to fit your needs. The most well-known providers are IBM Cloud/Watson, Amazon Web Services, Google Cloud, and Microsoft Azure.

There is, of course, a cost to these services, but they are all typically free to start while you have a low volume of transactions. So, the first step is to sign up for a free account with the provider of your choice. For the visual recognition example used in this article, I used an IBM Cloud account.

Node.js for Cognitive

Any language can connect to a cognitive provider but some languages do it easier and more elegantly than others. I, like many others, prefer Node.js for several good reasons. First, it uses JavaScript, a language that is both popular and is already a must for a mobile or browser interface. But another major reason is its ecosystem of components or packages that help you implement AI. NPM (Node Package Manager) packages, such as "Watson-developer-cloud" from IBM, allow you to call Watson services with only 1 line of code. Other NPM packages simplify tasks like grabbing camera footage and converting it to the appropriate input format for Watson, whereas it might require jumping through lots of hoops to implement the same with other languages.

Get Started Quickly

When you're just exploring and building cognitive POC's, the thought of getting everything set up and running on your own system can be overwhelming. A better approach might be to use a free host like NodeRun.com that has everything already configured and provides the tools you need to get started right away. If necessary, you can easily set it up to work with your existing data either by uploading some sample data or by connecting it directly to your development machine. Instead of coding the user interface manually with HTML and CSS, you can make quicker progress by creating the initial UI with a design tool.

Visual Designer-1

Building a solution in the cloud also allows you to quickly share your work with others. The example I built for this article can be shared with all readers using a simple link. You don't have to download or re-build the example from scratch. You can view, run, and fork the code to try your own implementation directly in the cloud. Forking allows you to create your own copy and play with your own custom AI solution.

Your Watson Age

So what is the exciting Watson POC I keep referring to? For this article, I built a visual recognition application that uses your device camera to take your photo, determine your age based on appearance, and tell you all about it using human speech through the speakers on your device.

If you want to try the application first-hand, use your phone, tablet, or laptop with a camera to browse to the following URL:


The URL includes several parts: the action ("run"), the author ("alex"), and the project (or space) name ("watson-age"). Because of Watson, Node.js, and a hosting site, I was able to build a working AI example in less than a couple of hours with a handful of lines of code rather than taking weeks, months, or years to get something going.

Want to look at the code or use the code in your own implementation? Simply navigate to NodeRun.com/alex/watson-age-code/ or check out the NodeRun embed below: 

If at any point, you're ready to take a NodeRun application to production, the functionality is transferable to your own server. Virtually any platform supports open source technologies like Node.js, so running this code on a modern server is not a problem!


My hopes are that this example inspires ideas or perhaps starts a conversation. AI is an area we're all still learning about, myself included. In fact, I am interested to converse with you and hear your feedback. When you visit NodeRun.com/alex/watson-age-code/, you can leave comments or questions for me about the project in the comments area, or you can comment below and I will be more than happy to respond to any questions.

Alex Roytman is the founder and CEO of Profound Logic. He is a Node.js and RPG educator who shares his knowledge at user groups and events around the world. His decades of experience and passion in the field of Web and Mobile development have led Profound Logic to create many popular modernization tools, win multiple awards for innovation, earning a patent for modernization technology, and gain thousands of loyal customers in more than 50 counties.

Topics: RPG Development, Application modernization, IBM i applications, Node.js, Profound.js, IBM i, RPG, AS400 modernization, IBM i Modernization, Agile modernization, iSeries, Legacy Modernization, Profound UI, AS 400, AS_400, Profound Logic

Subscribe to Blog Updates

...and get The 2019 State of IBM i Modernization White Paper FREE!

cover page 2019-1

Recent Posts