Back to Parent

Outcome


Talk to the MeBot about a movie or TV show you like, and it can tell you if the film was filmed in San Francisco! Or ask the MeBot about the movies that I like :). 

The MeBot is chat bot with which you can text to learn more about me and get movie fun facts about San Francisco – all by using San Francisco's open source API.

Previously practiced as a planner, this chat bot project is a fun marriage of my interest in civic engagement and interaction design. While this MeBot take on a more casual topic of city culture. It lays the ground work for more professional uses such as looking up ongoing development projects in cities or learning about the public space maintenance.


Youtube link to video (in case it doesn't show up below: https://youtu.be/wou1skeBnhQ)

Show Advanced Options
Process.thumb
Show Advanced Options

Choosing Databases

When I started this project I knew I wanted to use government data – it's what I use a lot previously as a planner for technical purposes. I looked into San Francisco's data base and found a lot of them with open API! I eventually narrowed down to two very different types of data that I really liked, weighed the pros and cons, and chose the filming location data that may attract larger audience. 

01 choosing database.thumb
Show Advanced Options

Designing Conversation Structure

In choosing the database I actually sketched the conversation structure for both – it definitely helped me see how one is more challenging than the other. The final structure as shown below was very similar to the one I had when I started coding, but the coding process definitely also help clarify the routes.

02 design conversation structure.thumb
Show Advanced Options

Composing Speech with Available Data

The Film Location In San Francisco database (https://data.sfgov.org/Culture-and-Recreation/Film-Locations-in-San-Francisco/yitu-d5am) has a lot of information – from title, release, locations, fun facts, distributors, directors, writers, and actors (actor_1, actor_2, and actor_3). I started with wanting to cram in everything but quickly realized that it would make the speech bubble too long. 

I decided to only use 4 data points for my chatbot and quickly realized that I have to make quite a few pieces of speech to accommodate different data quantity and make the bot sound natural.

03 composing speech with available data.thumb
Show Advanced Options

Constructing Code in Local Environment

DataSF's API is powered by SODA (https://github.com/socrata/soda-ruby), which is a gem that let you access the data simply with a weblink to the JSON file. The output of the data is stored as Hashie (https://github.com/intridea/hashie), which is a growing collection of tools that extend Hashes.

I spent the longest time trying to figure out how to get data from hashie. It was especially tricky because hashie doesn't store empty value, so the location of each item can be different depending on how complete each data point is. 

For instance, this is the output for the movie "A Smile Like Yours":

Screen shot 2018 09 22 at 7.53.40 pm.thumb
Show Advanced Options

You'll see that it skipped the field actor_3 and fun_facts because there was no value for those fields. 

Eventually I figured out a way to simply add each unique value to the another array. (note: I'd add locations.uniq to delete duplicated values, but I know this dataset doesn't have any.)

Show Advanced Options


I coded everything locally and tested it in the local HTML as well as terminals (puts  "#"*90 FTW!)

Show Advanced Options

While I was able to work around most response variations, there remain quite a few issues that I didn't have time to get to. They are listed below:

04 composing speech with available data.thumb
Show Advanced Options

Adjusting Conversation in Context

Once I was confident with the code I pushed it to Heroku and started to test it on my phone. It allowed me to catch a few bugs and awkward dialogue flow. 

Cleaning Up the Code

My code would be working if I just copy-and-paste the local code. However, I wanted to consolidate them into methods so my code can be cleaner. Here are my final two method.

Show Advanced Options
Show Advanced Options

Final Reflection

While we have been building the foundation for this chatbot in weekly exercises, it was REALLY CHALLENGING for me to finally getting it to work the way I wanted (with major room for improvement). Here are some of my final thoughts:

Things I was proud of: 

  • Learning how to use government open data
  • Designing conversation pieces that together sounds natural 
  • Solving some of the edge scenarios

Things I could do better

  • Incorporating natural language processes capability in my Chat Bot
  • Allowing for more back and forth in the conversation design


That's it :) it was a fun project and I learned a lot :)

Drop files here or click to select

You can upload files of up to 20MB using this form.