Skip to content
/ sonar Public

Chat bot for asking questions about your community with open data

License

Notifications You must be signed in to change notification settings

Esri/sonar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sonar

sonar logoInformation should be easily accessible and ubiquitous. Often data requires complex user experiences through limited devices. Instead, what if data can be conversational through commonly used communications tools like Facebook Messenger and Amazon Alexa voice recognition.

Sonar bot provides a natural language interface to local government open data and demographic services that helps people ask questions of their community.

This project is a prototype concept that is still evolving. It currently supports:

  • Facebook messenger
  • Slack
  • Alexa Echo Skills

Demo videos

Interface

Example Commands

  • /sonar map of 201 4th St NE, Washington, DC
  • /sonar tell me about trash at 201 4th St NE, Washington, DC
  • @sonar what are the bus stops at stanton park, Washington, DC
  • Speak: safety of 201 4th St NE, Washington, DC
  • Speak: Add note dangerous intersection at 2nd & constitution, Washington, DC
  • /sonar see notes at 201 4th St NE, Washington, DC

Slack

  • /sonar map of 708 10th St NE, Washington, DC
  • /sonar tell me about trash at 708 10th St NE, Washington, DC

Facebook

Amazon Echo

  • Help help {Dataset}
  • Hello Hello Sonar.
  • Hal Open the pod bay doors HAL.
  • Ping ping {Dataset}
  • GetPopulation give me the population of {Location}
  • GetPopulation how many people live nearby {Location}
  • GetPopulation what is the population of {Location}
  • GetPopulation population {Location}
  • GetPopulation people in {Location}
  • GetCrime safety of {Location}
  • GetData what is the {Dataset} of {Location}
  • GetData what is the nearest {Dataset} at {Location}
  • GetData tell me about {Dataset} at {Location}
  • GetData ask about {Dataset} at {Location}
  • GetData when is {Dataset} for {Location}
  • SummarizeData how many {Dataset} at {Location} since {TimePeriod}
  • SummarizeData in past {TimePeriod} how many {Dataset} at {Location}
  • AddNote add note {Note} at {Location}
  • GetMap map of {Location}
  • GetMap see {Dataset} at {Location}
  • ExitApp stop

Develop

Sonar is built with ClaudiaJS and hosted on Amazon Web Services.

To start developing, you will need to use an Amazon developer account.

Quick Start

First run trhough the Installing and Configuring Claudia.js documentation, specifically the parts about installing Claudia globally (npm install claudia -g) and Configuring Access Credentials. Then:

  1. Clone this repo
  2. npm install
  3. Update your preferred AWS region in package.json and claudia.json
  4. Create (first time): npm run create
  5. Creating will deploy the appropriate API endpoints and lambda functions, but you must also then configure the platforms you want. For example,
    1. For Alexa: claudia update --configure-alexa-skill
    2. For Slack: claudia update --configure-slack-slash-command
    3. etc
  6. Updates: npm run update - will re-deploy your code to AWS.

ArcGIS Token

To use the geoenrichment services for population, you will need to add an ArcGIS Token to the Amazon API Gateway Stage Variables

  1. Visit Amazon API Gateway
  2. Within your API, click on "Stages"
  3. Click on "latest"
  4. Click on tab "Stage Variables"
  5. Click on "Add Stage Variable"
  6. In Name text input, enter arcgisToken and in Value text input enter your token
  7. Click on the gray checkmark to the far right side

Update Amazon Lambda functions

npm run create

or claudia create --region us-east-1 --api-module bot

npm run update

or claudia update

Get Logs

Requires AWS CLI.

npm run logs

or aws logs filter-log-events --log-group-name /aws/lambda/claudia-test

Licensing

Copyright Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.