Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckerco authored and zuckerco committed Apr 13, 2017
0 parents commit df7f261
Show file tree
Hide file tree
Showing 12 changed files with 15,540 additions and 0 deletions.
7,700 changes: 7,700 additions & 0 deletions data.py

Large diffs are not rendered by default.

Binary file added data.pyc
Binary file not shown.
30 changes: 30 additions & 0 deletions intent_schema.JSON
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{

"intents": [{

"intent": "testIntent",

"slots": [{

"name": "univ_name",

"type": "AMAZON.EducationalOrganization"

}]


}, {

"intent": "univSearchIntent",

"slots": [{

"name": "first",

"type": "AMAZON.NUMBER"

}]

}]

}
2 changes: 2 additions & 0 deletions sample_utterances.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
testIntent {{univ_name}}
testIntent Say {{univ_name}}
Binary file not shown.
7,704 changes: 7,704 additions & 0 deletions scorecard_files/Most-Recent-Cohorts-Scorecard-Elements.csv

Large diffs are not rendered by default.

Binary file added scorecard_files/revised_scorecard.xlsx
Binary file not shown.
Binary file not shown.
Binary file added scorecard_files/~$revised_scorecard.xlsx
Binary file not shown.
Empty file added scrap.txt
Empty file.
68 changes: 68 additions & 0 deletions univs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import logging
from flask import Flask
from flask_ask import Ask, statement, question, session
from data import UNIVS

app = Flask(__name__)

ask = Ask(app, "/")

logging.getLogger("flask_ask").setLevel(logging.DEBUG)

def get_univ(source):
univ_name = "University of Florida"
for row in source:
if univ_name == row["univ_name"]:
univ_name = row["univ_name"]
city_name = row["city_name"]
state_name = row["state_name"]
# row[" cost_to_attend "] needs to have the spaces around the variables because that's how it is the python dictionary sadly. Same for md_earnings.
cost_to_attend = row[" cost_to_attend "]
grad_rate = row["grad_rate"]
md_earnings = row[" md_earnings "]

return univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings
# You need to get univ_name, city_name, state_name, cost_to_attend, grad_rate and md_earnings.

test = get_univ(UNIVS)
print test

@ask.launch
def start_skill():
welcome_message = 'Welcome to University Explorer. What university would you like to know about?'
return question(welcome_message)

@ask.intent(testIntent)
def test_intent():
# Here you just want to pass what Alexa here's into a sentence.
return statement('I heard you say {}.'.format(univ_name))

@ask.intent(univSearchIntent)
def share_univs():
univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings = get_univ()
univ_message = 'The {} is based in {}, {}. The average annual cost to attend is {}, the graduation rate is {} and the median salary after attending is {}.'.format(univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings)
return statement(univ_message)





















if __name__ == '__main__':

app.run(debug=True)
36 changes: 36 additions & 0 deletions univs_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from flask import Flask
from data import UNIVS


app = Flask(__name__)


def get_univ(source):
# univ_name in the following line is only meant to be temporary. The final prodouct will not be hardcoded and will instead take what the user says.
univ_name = "University of Florida"
for row in source:
if univ_name == row["univ_name"]:
univ_name = row["univ_name"]
city_name = row["city_name"]
state_name = row["state_name"]
# row[" cost_to_attend "] needs to have the spaces around the variables because that's how it is the python dictionary sadly. Same for md_earnings.
cost_to_attend = row[" cost_to_attend "]
grad_rate = row["grad_rate"]
md_earnings = row[" md_earnings "]

return univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings

# I'm having issues in the following code block. When I try running it with the debugging stuff at the bottom I receive the error 'ValueError: View function did not return a response' from flask.
# @app.route('/')
# @app.route('/index.html')
# def index():
# test = get_univ(UNIVS)
# print test

# With this standing after the above and below code blocks are commented out, I receive the desired response in Terminal: ('University of Florida', 'Gainesville', 'Florida', ' $11,778.00 ', '87%', ' $51,100.00 '). This shows that the function I have written works, but something I'm doing with flask doesn't.
test = get_univ(UNIVS)
print test


# if __name__ == '__main__':
# app.run(debug=True)

0 comments on commit df7f261

Please sign in to comment.