/kalliope-uber-yandex-maps

Simple neuron to interact with Uber APIs, using Yandex Maps instead of Google maps

Primary LanguagePython

kalliope-uber-yandex-maps

A neuron to leverage Uber API - forked from https://github.com/bacardi55/kalliope-uber

Synopsis

Use Uber API to:

  • Get the time needed for a driver to arrive at your starting address
  • Get the price and duration of a ride from starting address to end address

You need to enable uber API for this. More information here.

This neuron only leverage the server token and not a end user oauth2 connection per user.

This is due to the limited use case available by this neuron. User can't book a ride from this neuron. I don't intend to develop this as I don't want to automate Uber reservation (i found it a bit dangerous imo :)). But if anyone want ot add it, i'm happy to look at pull requests :).

Installation

kalliope install --git-url https://github.com/Bearle/kalliope-uber-yandex-maps.git

This will install uber-riders python library. This also uses Yandex Maps API, which is only needed to transform address into geolocation data (longitude/latitude). If you provide longitude / latitude data instead of address, we won't use Yandex maps. Please read next section for more information. I

Options

parameter required default choices comment
uber_api_key yes string The api key to use uber API. See below.
yandex_api_key no string The api key to use yandex maps API. See below.
drive_mode yes uberX string The drive mode: uberX, uberBlack, pool', ... Complete list here
start_latitude no string The latitude of the start / origin address
start_longitude no string The longitude of the start / origin address
start_address no string The full text start / origin address
end_latitude no string The latitude of the destination address
end_longitude no string The longitude of the destination address
end_address no string The full text destination address

Additional notes:

  • If start_address is given, Yandex Maps will be used to get geolocation data and will replace the given start_{longitude,latitude} if any

  • If end_address is given, Yandex maps will be used to get geolocation data and will replace the given end_{longitude,latitude} if any

  • Yandex Maps API key isn't required if you have than 25.000 calls/day, but can be used if you have more.

Return Values

TODO: review arguments sample and description

Name Description Type sample
driving_mode The driving method (= drive_mode) arguments String ubserX, pool
time_to_get_driver The time to get a driver String 3 minutes
distance The distance between start and end addresses. Only if end_address is provided String 11.3 km
high_estimate The high estimate price for the ride. Only given if end_address is provided String 13
low_estimate The low estimate price for the ride. Only given if end_address is provided String 10
duration The time to go from origin to destination. Only given if end_address is provided String 19 min
estimate The average time estimate to go from start to end address String $20

Synapses example

Get the estimated time to get a driving_mode driver based on geolocation data

  - name: "Uber-time-estimate"
    signals:
      - order: "how long for a driver to pick me up"
    neurons:
      - say:
          message: "Calculating"
      - uber:
          uber_api_key: "***********************"
          start_longitude: "***"
          start_latitude: "****"
          driving_mode: "uberX"
          say_template: "A {{driving_mode}} driver can be there in {{ time_to_get_driver }} minutes"

Get the estimated time to get a driving_mode based on a text address

  - name: "Uber-time-estimate-by-address"
    signals:
      - order: "how long for a driver to pick me up"
    neurons:
      - say:
          message: "Calculating"
      - uber:
          uber_api_key: "***********************"
          start_address: "*********"
          driving_mode: "uberX"
          say_template: "A {{driving_mode}} driver can be there in {{ time_to_get_driver }} minutes"

Get the estimated time to get a driving_mode, the price and the ride duration

  - name: "Uber-time-and-price"
    signals:
      - order: "how much for a rider to work"
    neurons:
      - say:
          message: "Calculating"
      - uber:
          uber_api_key: "***********************"
          driving_mode: "uberX"
          start_longitude: "***"
          start_latitude: "****"
          end_longitude: "*****"
          end_latitude: "******"
          say_template: "A {{driving_mode}} driver can be there in {{ time_to_get_driver }} minutes. Traject will take about {{ duration }} and would cost {{ estimate }}"

Get the estimated time to get a driving_mode, the price and the ride duration to go to an address givin in argument

  - name: "Uber-time-and-price-by-addresses"
    signals:
      - order: "how much for a rider to {{end_address}}"
    neurons:
      - say:
          message: "Calculating"
      - uber:
          uber_api_key: "***********************"
          start_address: "*********"
          driving_mode: "uberX"
          say_template: "A {{driving_mode}} driver can be there in {{ time_to_get_driver }} minutes. Traject will take about {{ duration }} and would cost {{ estimate }}"
          end_address: "{{end_address}}"

Get the estimated time to get a driving_mode, the price and the ride duration based on addresses given in arguments

  - name: "Uber-time-and-price-by-start-address"
    signals:
      - order: "how long for a driver to pick me up {{start_address}} to go to {{end_address}}"
    neurons:
      - say:
          message: "Calculating"
      - uber:
          uber_api_key: "***********************"
          driving_mode: "uberX"
          say_template: "A {{driving_mode}} driver can be there in {{ time_to_get_driver }} minutes. Traject will take about {{ duration }} and would cost {{ estimate }}"
          start_address: "{{start_address}}"
          end_address: "{{end_address}}"

see more example in the sample directory

Guy who created the original kalliope-uber posts stuff about kalliope