Build an app using the Disaster Resiliency Starter Kit

Natural disasters kill an estimated 90,000 people and affect close to 160 million people worldwide every year, according to the World Health Organization. Severe weather events in particular have been increasing in frequency and intensity over the past decade and scientists believe that climate change is a significant factor.

Whether it’s third-party open source projects or IBM Cloud services, technology can help address these global environmental challenges.

This tutorial guides you though building a starter application around the Disaster Resiliency Starter Kit. The starter application includes a chatbot and a map and routing service. The chatbot is powered by IBM® Watson™ Assistant and answers questions about flood emergencies, while the map and location services are provided by HERE Technologies.

Prerequisites

To follow this tutorial, you must:

Estimated time

It should take you approximately 45 minutes to complete the tutorial.

Steps

  1. Set up an instance of Watson Assistant
  2. Generate an API Key from the HERE Developer Portal
  3. Run the server
  4. Run the mobile application

Set up an instance of Watson Assistant

Log in to IBM Cloud and provision a Watson Assistant instance.

  1. Provision an instance of Watson Assistant from the IBM Cloud catalog.

    • Select a plan (the Lite plan should be sufficient).
    • Enter a Service name.
    • Click Create.

      Provision Watson Assistant

  2. Launch Watson Assistant.

    Launch Assistant

  3. Create an Assistant.

    • Click the Assistant menu.
    • Click Create assistant.

      Create Assistant

    • Enter a Name, and click Create assistant.

      Create Assistant

  4. Add a dialog skill to the Assistant by importing the starter-kit-flood-dialog-skill.json file from the cloned Solution-Starter-Kit-Disasters-2020 repository.

    • Click Add dialog skill.

      Add a dialog skill

    • Select the Import skill tab.

    • Click Choose JSON File.
    • Browse to and select the starter-kit-flood-dialog-skill.json dialog skill file.
    • Click Import.

      Add a dialog skill

  5. Click the assistant’s action menu, and select Settings.

    Add a dialog skill

  6. Select API Details and note the Assistant ID and Api Key. From the Assistant URL, make note of the base URL/domain (for example, https://api.us-south.assistant.watson.cloud.ibm.com or https://api.eu-gb.assistant.watson.cloud.ibm.com) but do not include the directory/path.

    Add a dialog skill

  7. Go to Preview Link to get a link to test and verify the dialog skill.

    Preview dialog

    • Click the URL in the Try it out and share the link section.

      Preview dialog

    • Ask a (flood) question to the assistant.

      Preview dialog

Generate an API Key from the HERE Developer Portal

The application uses HERE Location Services for maps, searching, and routing. An API Key is required to access these services. Follow the instructions outlined in the HERE Developer Portal to generate a JavaScript API Key.

Run the server

To set up and launch the server application:

  1. Go to the starter-kit/server-app directory of the cloned Solution-Starter-Kit-Disasters-2020 repository.

  2. Copy the .env.example file in the starter-kit/server-app directory, and create a new file named .env.

  3. Edit the newly created .env file and update the ASSISTANT_ID and ASSISTANT_IAM_APIKEY values with the values taken from the dialog skill’s API Detail page in Watson Assistant.

  4. Edit the value of name in the manifest.yml file to your wanted application name (for example, my-app-name).

  5. From a terminal:

    1. Go to the starter-kit/server-app directory of the cloned Solution-Starter-Kit-Disasters-2020 repository.

    2. Install the dependencies.

       npm install
      
    3. Launch the server application locally or deploy to IBM Cloud.

      • To run locally:

        1. Start the application.

           npm start
          
        2. The server can be accessed at http://localhost:3000.

      • To deploy to IBM Cloud:

        1. Log in to your IBM Cloud account using the IBM Cloud CLI.

           ibmcloud login
          
        2. Target a Cloud Foundry org and space.

           ibmcloud target --cf
          
        3. Push the app to IBM Cloud.

           ibmcloud app push
          
        4. The server can be accessed at a URL using the name given in the manifest.yml file (for example, https://my-app-name.bluemix.net).

Run the mobile application

To run the mobile application (using the Xcode iOS Simulator):

  1. Go to the starter-kit/mobile-app directory of the cloned Solution-Starter-Kit-Disasters-2020 repository.

  2. Copy the .env.example file in the starter-kit/mobile-app directory, and create a file named .env.

  3. Edit the newly created .env file.

    • Update the STARTER_KIT_SERVER_URL with the URL to the server app launched in the previous step.

    • Update the HERE_APIKEY with the API Key generated in the HERE Developer Portal.

  4. From a terminal:

    1. Go to the starter-kit/mobile-app directory of the cloned Solution-Starter-Kit-Disasters-2020 repository.

    2. Install the dependencies.

       npm install
      
    3. Go to the ios directory.

       cd ios
      
    4. Install pod dependencies.

       pod install
      
    5. Return to the mobile-app directory.

       cd .
      
    6. Launch the app in the simulator.

       npm run ios
      

Summary

In this tutorial, we built an application combining IBM Data and AI offerings with HERE Technologies’ Location Services. The starter application can help you jump-start the development process and quickly get started building your own solution.

va barbosa