Call-for-Code / Solution-Starter-Kit-Disasters-2020

Materials for the Call for Code 2020 solution starter kit for natural disaster resiliency in the context of climate change.
https://developer.ibm.com/callforcode/getstarted/climate-change/disaster-resiliency
Apache License 2.0
12 stars 26 forks source link
call-for-code

Disaster resiliency in the context of climate change

This solution starter was created by the United Nations Human Rights Office in Geneva, Switzerland, on February 27-28, 2020. It features contributions by technologists from Unity, Johnson & Johnson, and Red Hat.

Authors

Contents

  1. Overview
  2. Video
  3. The idea
  4. How it works
  5. Diagrams
  6. Documents
  7. Datasets
  8. Technology
  9. Getting started
  10. Resources
  11. License

Overview

What's the problem?

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 climate change is a significant factor.

Read the Sendai Framework for Disaster Risk Reduction to see how we make our communities safer and more resilient to disasters.

How can technology help?

Technology can help our society better prepare for and respond to natural disasters. Specific use cases include reducing exposure to hazards, lessening vulnerability of people and property, wise management of land and the environment, and improving preparedness and early warning for adverse weather events that are gaining in frequency through climate change.

Video

Call for Code Solution Starter: Water sustainability in the context of climate change

The idea

Due to climate change, floods are becoming more frequent and more severe, leading to specific issues for affected communities. This solution starter kit aims to reduce mortality rates by helping potential victims better prepare for, act during, and recover from a flood. Using a mobile application that helps users share knowledge of best practices and facilitates communities organizing themselves, communities will be able to reduce mortality rates and mitigate economic damage so they can recover faster after a flood.

How it works

The goal of the application is to provide an end-to-end solution to help potential victims combat floods. The team approached the problem by breaking it down into three phases: before the flood, during the flood, and after the flood.

Before the flood, the user is presented a checklist of best practices on how to prepare for the upcoming flood. The checklist is derived from the Sendak Framework for disaster preparedness, along with recommendations from seasoned search and rescue professionals. The application will also enable the local authorities to communicate with the user to better enforce disaster preparedness.

In the event of a flood, the app will switch into emergency mode. This mode can be activated by either the user or the local authorities. While in this mode, the app displays a simple evacuation route to the nearest shelter that still has capacity.

After the flood, the app will provide post-flood best practices to help victims rebuild their homes. The app will also enable a community marketplace, providing a platform for residents to trade resources and help push the economy to recover.

By combining IBM Data & AI offerings with HERE Technologies' Location Services, a developer can quickly get started building such a solution. The starter kit offers a React Native template that has integration with Watson Assistant and HERE Technologies' Location Services prebuilt, helping developers jump-start the development process.

Diagrams

Disaster resiliency architecture diagram

This solution starter idea combines machine learning and location services with real-time information to get users the information they need to take action quickly.

  1. The user launches the mobile app and can access information across multiple services.
  2. The user can ask questions to Watson Assistant and get answers to flood planning and recovery-related questions.
  3. The user can access recommendations on flood preparation checklists and best practices with Watson Machine Learning.
  4. The user receives real-time weather updates from The Weather Company.
  5. The user can obtain geolocation data for safety points and plot evacuation routes using HERE Location Services.

Documents

Data sets

Technology

IBM Cloud Services

HERE Location Services

Getting started

Use the following steps to get this starter kit up and running. The starter kit is composed of a React Native front end and a Node.js back end. The application includes a chatbot powered by Watson Assistant that answers questions about flood emergencies and integrates map and location services provided by HERE Technologies.

Prerequisite

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.

1. 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.
  2. Launch the Watson Assistant service.
  3. Create an Assistant.
  4. Add a dialog skill to the Assistant by importing the starter-kit-flood-dialog-skill.json file.
  5. Go back to All Assistants page, open Settings from the action menu ( ) and click on API Details.
  6. Note the Assistant ID and API Key. From the Assistant URL, make note of the base URL/domain (e.g., 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.
  7. Go to Preview Link to get a link to test and verify the dialog skill.

2. Generate an API Key from the HERE Developer Portal

The application uses HERE Location Services for maps, searching, and routing.

To access these services, an API Key is required. Follow the instructions outlined in the HERE Developer Portal to generate a JavaScript API Key.

3. Run the server

To set up and launch the server application:

  1. Go to the starter-kit/server-app directory of the cloned repo.
  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, ASSISTANT_IAM_APIKEY, and ASSISTANT_URL with the values from the dialog skill's API Detail page in Watson Assistant.
  4. Edit the name value in the manifest.yml file to your application name (for example, my-app-name).
  5. From a terminal:
    1. Go to the starter-kit/server-app directory of the cloned repo.
    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 the URL shown in the console (routes) after the app successful uploads and starts (for example, https://solution-starter-kit-disasters-2020-server-random-route.bluemix.net).

4. Run the mobile application

To run the mobile application (using the Xcode iOS Simulator or Android Studio Emulator):

  1. Go to the starter-kit/mobile-app directory of the cloned repo.
  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.

      Note: If you are running the server locally and testing with the Android Emulator set the STARTER_KIT_SERVER_URL using the local machine's URL (e.g., http://10.0.2.2:3000) instead of localhost

    • 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.
    2. Install the dependencies: npm install.
    3. iOS only: Go to the ios directory: cd ios.
    4. iOS only: Install pod dependencies: pod install.
    5. iOS only: Return to the mobile-app directory: cd ../.
    6. Launch the app in the simulator/emulator:
      • iOS only: npm run ios

        Note: You should be running at least iOS 13.0. The first time you launch the simulator, you should ensure that you set a Location in the Features menu.

      • Android only: npm run android

        Note: Your Android Studio needs to have the Android 9 (Pie) SDK and a Pie API Level 28 virtual device

        • Alternative way to run on Android: react-native run-android
          1. Android only: Open Android Studio and setup the project with the android folder.
          2. Android only: Open Android Virtual Device Manager and launch the virtual device installed.
          3. Android only: Click on Debug in Android Studio.

Resources

License

This solution starter is made available under the Apache 2 License.