Code Monkey home page Code Monkey logo

pgh-port-authority-skill's Introduction

Pittsburgh Port Authority Alexa Skill

The Pittsburgh Port Authority Alexa Skill (PPAAS) provides a voice interface to the Port Authority of Allegheny County’s TrueTime℠ System. TrueTime provides real-time vehicle tracking for Port Authority busses and trains and a publicly available API.

Sample Invocation

The wake word for the Kiva Echo is currently set to “Echo” and the Invocation Name for the PPAAS is set to “NextBus”. So in order to find out when the next “outbound P1” bus is leaving Smithfield and Sixth streets, you might say: “Echo, ask NextBus” and follow the prompts.

Input

In order to determine when your bus will arrive, the skill needs three pieces of information:

  • Route (bus line)
  • Direction (inbound or outbound), and
  • StationName (bus stop) where you will get on the bus.

The skill allows the user to say all of this information at once (OneshotBusIntent) with a statement like:

  • when is the {Direction} {Route} arriving at {StationName} Avenue If the skill does not have all the information, or if it does not understand certain information, it will ask questions until it can provide an answer. Answers to these questions are individual intents triggered by statements like:
  • RouteBusIntent when is the next {Route} bus
  • StationBusIntent {StationName} Street, or
  • DirectionBusIntent {Direction} The user can also specify the StationName by triggering a CrossStreetBusIntent providing cross streets with a statement like:
  • {MainStreet} Street and {CrossStreet} Avenue

Note: The current implementation of the CrossStreetBusIntent ignores the MainStreet and attempts to match the CrossStreet. It works on the assumption that a regular rider will naturally specify the more general street first (e.g. if the bus runs down fifth street and stops at each cross, the regular rider has a tendancy to express the intersection as “Fifth Street and Morewood Avenue,” rather than “Morewood Avenue and Fifth Street”).

Output

The primary output is voice specified as Speech Synthesis Markup Language (SSML). This format allows the skill to specify audio clips (here music that implies success or failure) and specify how the voice expresses the string response (e.g. inserting silence).

A secondary output is an output card

Deployment

S3 Audio

In order to function, the PPAA skill requires three audio files to be available via AWS S3:

AWS Lambda

AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. The source code for an Alexa Skill is deployed to Lambda after you create an AWS Lambda function for a custom skill. After the AWS Lambda function is deployed and linked to the ASK skill, you can view the logs here in Lambda.

Alexa Skills Kit

Configuring the ASK skill primarily occurs in the Amazon Developer’s Console for ASK. Here you define and test the interaction model and configuration of the skill. When it is ready for prime time, this is where the controls reside for publishing the skill.

Interaction Model The files needed to configure the interaction model reside in:

  • /main/com/maya/portAuthority/speechAssets, and
  • /main/com/maya/portAuthority/speechAssets/customSlotTypes you can copy and paste the relevant information from those files and paste into the appropriate fields in the Developer Console:
  • Intent Schema
  • Custom Slot Type: LIST_OF_BUS_ROUTES
  • Custom Slot Type: LIST_OF_DIRECTIONS
  • Customer Slot Type: LIST_OF_STOPS
  • Sample Utterances

##Alexa Skills Kit Documentation The documentation for the Alexa Skills Kit is available on the Amazon Apps and Services Developer Portal.

Questions

Please send questions to [email protected]

pgh-port-authority-skill's People

Contributors

adithyab22 avatar djjonbrown avatar

Stargazers

 avatar

Watchers

 avatar  avatar

pgh-port-authority-skill's Issues

Remember previous entries

Store the previous entries in DynamoDB. Automatically respond and ask if the user would like information on another trip.

Nearest Bus Stop- Error when asking about Airport

The nearest stop to the airport is not returning the airport stop.

The Lat/ Long returned by Google Maps for the attraction "Airport" is centered on the airport. This area is outside of the Google Maps APIs distance calculations.

Recommend making an extra call to the API to return the Lat Long of the matched street address . If not everywhere, at least, for the airport.

Calculate the time you need to leave your location

If the bus stop is 5 minutes away, and the bus is coming in three minutes- do not report that bus.

If the bus is coming in 10 minutes, tell the user- "You need walk out of the building in the next five minutes to catch the next %s"

Don't save erroneous responses

Currently Alexa will repeat an erroneous response when she is launched with no intent. We should change where she saves her responses to the DB so that only the last successful response is saved.

Move URLs and Keys of external APIs to configuration files.

Currently Urls and Keys are littered throughout the app.

TrueTime API: com.maya.portAuthority.api.TrueTimeMessageParser.java
URL: http://truetime.portauthority.org/bustime/api/
ACCESS_ID: cvTWAYXjbFEGcMSQbnv5tpteK

Google API: com.maya.portAuthority.googleMaps.NearestStopLocator.java
URL: https://maps.googleapis.com/maps/api/place/textsearch/json
Key: AIzaSyBzW19DGDOi_20t46SazRquCLw9UNp_C8s

supportedApplicationIds com.maya.portAuthority.GetNextBusSpeechletRequestStreamHandler.java

Audio Files: com.maya.portAuthority.GetNextBusSpeechlet.java
AUDIO_WELCOME = "<audio src="https://s3.amazonaws.com/maya-audio/ppa_welcome.mp3\" />";
AUDIO_FAILURE = "<audio src="https://s3.amazonaws.com/maya-audio/ppa_failure.mp3\" />";
AUDIO_SUCCESS = "<audio src="https://s3.amazonaws.com/maya-audio/ppa_success.mp3\" />";

Analytics: com.maya.portAuthority.util.AnalyticsManager
UA_ID="UA-88894500-1";

Should match the route when entered

When the user specifies all of the input, the skill calls the API to validate the route. This validation should occur earlier in the conversation.

Integrate with Google Maps API

Allow user to enter their current address instead of information about their bus stop. Use Google API to find the nearest bus stop for the address provided.

Alexa gives Null result for Route# 77

Distance matrix api only allows MAx of 25 origins/destinations per call.
Call for route#77 has >25
result of distance matrix api call:
{
"destination_addresses" : [],
"error_message" : "You have exceeded your rate-limit for this API.",
"origin_addresses" : [],
"rows" : [],
"status" : "OVER_QUERY_LIMIT"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.