UNTANGLING THE WEB
FALL 2017 WEEK 11 – MORE ABOUT DATABASES, BACK TO CHATBOTS, GETTING
READY FOR PROJECT 3 NEXT WEEK
AGENDA
• A few things about replication and queries
• Query examples from the movies database
• Looking back at chatbots
• Project work time – this is your last in-person time with me before project 3 is due
DATABSE QUERIES
• Unlike SQL queries, querying the Cloudant DB involves indexes and queries, described as JSON
• We’ll mostly use the default indexes in the movies database example, but you may need to make one of
your own for your database
• https://youtu.be/yr73c5WiliY
REPLICATING THE MOVIES DATABASE
• These are the credentials you
• need, not your IBM ID
SETTING UP A REPLICATION JOB
• Replicate from:
https://examples.cloudant.com/
movies-demo
REMEMBER YOUR CREDENTIALS!
• Well, they are un-memorizable, so remember where they came from. It’s not your Bluemix ID and
password
VIEWING THE MOVIES
• https://849d963b-e883-4420-a23a-
b54b6db5a8a8-
bluemix.cloudant.com/movies/_all_docs?limit=
20&include_docs=true
CREATING QUERIES
CREATING QUERIES
QUERY REFERENCE DOCUMENT
• https://console.bluemix.net/docs/services/Cloudant/api/cloudant_query.html#query
• You probably won’t need all of it, though
• https://youtu.be/B3ZkxSFau8U
EXERCISE
• Go ahead and replicate the movies database to your cloudant instance
• Create a couple queries, for instance all films with Matt Damon
BACK TO CHATBOTS
• Designing the UI for the chatbot, conversational turns, etc is pretty straightforward
• Hooking it into the website is more challenging
• I’ll describe how the conversation_simple sample works
• https://github.com/derekja/conversation-simple
CLONING AND USING THE SAMPLE
• Cloning from https://github.com/derekja/conversation-simple is as usua
• A bit different than before, , though, you can use the cf command line tools instead of the bluemix
console
• Most of these operations can be done through the bluemix UI as well
SETTING UP THE SERVICE
• Setting up the Conversation service
• You can use an existing instance of the Conversation service. Otherwise, follow these steps.
• At the command line, go to the local project directory (conversation-simple).
• cf login
• Create an instance of the Conversation service in Bluemix. For example:
• cf create-service conversation free my-conversation-service
CF LOGIN ISSUES
• I had some problems with “cf login” where it kept rejecting my credentials
• I finally instead used “cf auth derekja@gmail.com pwd” and then “cf target –o derekja@gmail.com –s
dev” to authenticate and set my organization and space
• “cf login” is supposed to do all these steps, but didn’t
• Of course, you’ll use your own space and org and login credentials
BRING IN THE TRAINING DATA
• This is basically the set of test sentences you’ll use with the intents identified
• (https://console.ng.bluemix.net/dashboard/services)
SET SERVICE CREDENTIALS
• Unlike with vcap-local.json, there is little risk of misuse with these service credentials because they can
ONLY access the service you’ve defined, so might as well leave them in the open repo
NPM INSTALL AND START
• Then go to localhost:3000 to run and play with the chatbot
CODE WALKTHROUGH
• App.js again is the root of the application
• Index.html handles the display
• Instead of routes, it is mostly handled in javascript in this example
• Conversation.js and api.js are the two main ones to be aware of. The rest is basically just taking the
response and making nice HTML out of it
PROJECT 3 GRADING (ORIGINAL)
• All project 3 presentation are due on November 29th in class, late projects will not be accepted
• If you are horribly ill and nobody in your group can come in to present, the project itself is still due and the
presentation marks will be forfeit, or if absolutely necessary you can send me a demo video
• 15 points total
• 4 points presentation
• Is the demo good, is the website working, is the story about why it is interesting smooth
• 4 points database design and function (do things actually work)
• What is your table structure like? Talk about any problems you ran into. How was connecting it to the front end?
• 3 points chatbot implementation – is it effectively designed and well implemented?
• 4 points code quality and robustness
• Not everything has to work, but if it is there I want it to do nothing at all or the right thing. How have you structured your code? Is
it commented and easy to understand? Everything checked into github and deployed to the server? Good commit messages?
PROJECT 3 GRADING (REVISED)
• All project 3 presentation are due on November 29th in class, late projects will not be accepted
• If you are horribly ill and nobody in your group can come in to present, the project itself is still due and the
presentation marks will be forfeit, or if absolutely necessary you can send me a demo video
• 15 points total (chatbot grades and database grades can be reversed if desired)
• 4 points presentation
• Is the demo good, is the website working, is the story about why it is interesting smooth
• 5 points database design and function (do things actually work)
• What is your table structure like? Talk about any problems you ran into. How was connecting it to the front end?
• 2 points chatbot implementation – is it effectively designed and well implemented?
• 4 points code quality and robustness
• Not everything has to work, but if it is there I want it to do nothing at all or the right thing. How have you structured your code? Is
it commented and easy to understand? Everything checked into github and deployed to the server? Good commit messages?
HOMEWORK 12 (DUE NOV 29ND BEFORE CLASS)
• Replicate the movies database into your cloudant instance on Bluemix (each group has to do this only
once.. Note the password issue I talked about in lecture)
• Run a simple query for movies that Matt Damon was in
• Write a query for movies that Robert De Niro was in between 1985 and 2001
• For each query screenshot the query and the results

Untangling11

  • 1.
    UNTANGLING THE WEB FALL2017 WEEK 11 – MORE ABOUT DATABASES, BACK TO CHATBOTS, GETTING READY FOR PROJECT 3 NEXT WEEK
  • 2.
    AGENDA • A fewthings about replication and queries • Query examples from the movies database • Looking back at chatbots • Project work time – this is your last in-person time with me before project 3 is due
  • 3.
    DATABSE QUERIES • UnlikeSQL queries, querying the Cloudant DB involves indexes and queries, described as JSON • We’ll mostly use the default indexes in the movies database example, but you may need to make one of your own for your database • https://youtu.be/yr73c5WiliY
  • 4.
    REPLICATING THE MOVIESDATABASE • These are the credentials you • need, not your IBM ID
  • 5.
    SETTING UP AREPLICATION JOB • Replicate from: https://examples.cloudant.com/ movies-demo
  • 6.
    REMEMBER YOUR CREDENTIALS! •Well, they are un-memorizable, so remember where they came from. It’s not your Bluemix ID and password
  • 7.
    VIEWING THE MOVIES •https://849d963b-e883-4420-a23a- b54b6db5a8a8- bluemix.cloudant.com/movies/_all_docs?limit= 20&include_docs=true
  • 8.
  • 9.
  • 10.
    QUERY REFERENCE DOCUMENT •https://console.bluemix.net/docs/services/Cloudant/api/cloudant_query.html#query • You probably won’t need all of it, though • https://youtu.be/B3ZkxSFau8U
  • 11.
    EXERCISE • Go aheadand replicate the movies database to your cloudant instance • Create a couple queries, for instance all films with Matt Damon
  • 12.
    BACK TO CHATBOTS •Designing the UI for the chatbot, conversational turns, etc is pretty straightforward • Hooking it into the website is more challenging • I’ll describe how the conversation_simple sample works • https://github.com/derekja/conversation-simple
  • 13.
    CLONING AND USINGTHE SAMPLE • Cloning from https://github.com/derekja/conversation-simple is as usua • A bit different than before, , though, you can use the cf command line tools instead of the bluemix console • Most of these operations can be done through the bluemix UI as well
  • 14.
    SETTING UP THESERVICE • Setting up the Conversation service • You can use an existing instance of the Conversation service. Otherwise, follow these steps. • At the command line, go to the local project directory (conversation-simple). • cf login • Create an instance of the Conversation service in Bluemix. For example: • cf create-service conversation free my-conversation-service
  • 15.
    CF LOGIN ISSUES •I had some problems with “cf login” where it kept rejecting my credentials • I finally instead used “cf auth derekja@gmail.com pwd” and then “cf target –o derekja@gmail.com –s dev” to authenticate and set my organization and space • “cf login” is supposed to do all these steps, but didn’t • Of course, you’ll use your own space and org and login credentials
  • 16.
    BRING IN THETRAINING DATA • This is basically the set of test sentences you’ll use with the intents identified • (https://console.ng.bluemix.net/dashboard/services)
  • 17.
    SET SERVICE CREDENTIALS •Unlike with vcap-local.json, there is little risk of misuse with these service credentials because they can ONLY access the service you’ve defined, so might as well leave them in the open repo
  • 18.
    NPM INSTALL ANDSTART • Then go to localhost:3000 to run and play with the chatbot
  • 19.
    CODE WALKTHROUGH • App.jsagain is the root of the application • Index.html handles the display • Instead of routes, it is mostly handled in javascript in this example • Conversation.js and api.js are the two main ones to be aware of. The rest is basically just taking the response and making nice HTML out of it
  • 20.
    PROJECT 3 GRADING(ORIGINAL) • All project 3 presentation are due on November 29th in class, late projects will not be accepted • If you are horribly ill and nobody in your group can come in to present, the project itself is still due and the presentation marks will be forfeit, or if absolutely necessary you can send me a demo video • 15 points total • 4 points presentation • Is the demo good, is the website working, is the story about why it is interesting smooth • 4 points database design and function (do things actually work) • What is your table structure like? Talk about any problems you ran into. How was connecting it to the front end? • 3 points chatbot implementation – is it effectively designed and well implemented? • 4 points code quality and robustness • Not everything has to work, but if it is there I want it to do nothing at all or the right thing. How have you structured your code? Is it commented and easy to understand? Everything checked into github and deployed to the server? Good commit messages?
  • 21.
    PROJECT 3 GRADING(REVISED) • All project 3 presentation are due on November 29th in class, late projects will not be accepted • If you are horribly ill and nobody in your group can come in to present, the project itself is still due and the presentation marks will be forfeit, or if absolutely necessary you can send me a demo video • 15 points total (chatbot grades and database grades can be reversed if desired) • 4 points presentation • Is the demo good, is the website working, is the story about why it is interesting smooth • 5 points database design and function (do things actually work) • What is your table structure like? Talk about any problems you ran into. How was connecting it to the front end? • 2 points chatbot implementation – is it effectively designed and well implemented? • 4 points code quality and robustness • Not everything has to work, but if it is there I want it to do nothing at all or the right thing. How have you structured your code? Is it commented and easy to understand? Everything checked into github and deployed to the server? Good commit messages?
  • 22.
    HOMEWORK 12 (DUENOV 29ND BEFORE CLASS) • Replicate the movies database into your cloudant instance on Bluemix (each group has to do this only once.. Note the password issue I talked about in lecture) • Run a simple query for movies that Matt Damon was in • Write a query for movies that Robert De Niro was in between 1985 and 2001 • For each query screenshot the query and the results