generated from lewagon/taxi-fare-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7218a5c
Showing
16 changed files
with
529 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# NY Taxi Fare prediction interface | ||
|
||
 | ||
|
||
## Setup | ||
|
||
The interface uses 4 APIs: | ||
|
||
- The NY Taxi Fare prediction API | ||
- The [Algolia Places](https://community.algolia.com/places/) API for address autocomplete | ||
- The [MapBox Maps API](https://docs.mapbox.com/mapbox-gl-js/api/) to display a map | ||
- The [MapBox Directions API](https://docs.mapbox.com/api/navigation/) to display the route on the map | ||
|
||
These APIs require credentials and the following steps will guide you to get them and set the interface with. | ||
|
||
### NY Taxi Fare prediction API | ||
|
||
Update the `script.js` to get prediction from your own API hosted on Heroku: | ||
|
||
```js | ||
// script.js | ||
|
||
const taxiFareApiUrl = 'https://YOUR_API_URL.herokuapp.com/predict_fare'; | ||
``` | ||
|
||
_Note: the following setup steps are optional as you can use Algolia and Mapbox credentials given by Le Wagon_ | ||
|
||
### Algolia Places Api (optional) | ||
|
||
- Go to [Algolia](https://www.algolia.com/) and create an account and follow the steps to create your first application | ||
- Go to your [dashboard](https://www.algolia.com/) then to the API Keys tab | ||
- Grab an `Application ID` and a `Search-Only API Key` then set them into the `script.js` | ||
|
||
```javascript | ||
// script.js | ||
|
||
const algoliaPlacesApiAppId = 'YOUR_APPLICATION_ID'; | ||
const algoliaPlacesApiKey = 'YOUR_SEARCH_ONLY_API_KEY'; | ||
```` | ||
|
||
### MapBox Maps and Directions APIs (optional) | ||
|
||
- Go to [MapBox](https://www.mapbox.com/) and create an account | ||
- Go to your [Account](https://account.mapbox.com/) and grab your `Access Token` then set it into the `script.js` | ||
|
||
```js | ||
//... | ||
const mapboxApiToken = 'YOUR_MAPBOX_API_ACCESS_TOKEN'; | ||
```` | ||
## Local development | ||
To check your setup, run the interface locally with `serve`. Then go to [http://localhost:8000](http://localhost:8000). | ||
## Deploy on GitHub Pages | ||
Your app is ready to go live! | ||
Create a new branch `gh-pages`: | ||
```bash | ||
git checkout -b gh-pages | ||
``` | ||
Deploy your app on GitHub: | ||
```bash | ||
git push origin gh-pages | ||
``` | ||
Your app will be visible shortly at `https://YOUR_GITHUB_NICKNAME.github.io/taxi-fare-interface`. | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square150x150logo src="/mstile-150x150.png"/> | ||
<TileColor>#da532c</TileColor> | ||
</tile> | ||
</msapplication> | ||
</browserconfig> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "", | ||
"short_name": "", | ||
"icons": [ | ||
{ | ||
"src": "/android-chrome-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/android-chrome-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
], | ||
"theme_color": "#ffffff", | ||
"background_color": "#ffffff", | ||
"display": "standalone" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>NY Taxi Fare prediction interface</title> | ||
|
||
<link rel="apple-touch-icon" sizes="180x180" href="images/favicons/apple-touch-icon.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="images/favicons/favicon-32x32.png"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="images/favicons/favicon-16x16.png"> | ||
<link rel="manifest" href="images/favicons/site.webmanifest"> | ||
<link rel="mask-icon" href="images/favicons/safari-pinned-tab.svg" color="#5bbad5"> | ||
<meta name="msapplication-TileColor" content="#da532c"> | ||
<meta name="theme-color" content="#ffffff"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | ||
<!-- Bootstrap --> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> | ||
<!-- MapBox --> | ||
<link href='https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css' rel='stylesheet' /> | ||
<!-- Flatpickr --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1 class="text-center p-2">NY taxi</h1> | ||
</div> | ||
|
||
<div class="position-relative"> | ||
<div class="position-absolute w-100" id="search"> | ||
<div class="container pt-4 d-flex justify-content-center"> | ||
<form class="form-inline"> | ||
<input type="text" class="form-control mb-2 mr-sm-2" id="pickup" placeholder="Pickup" name="pickup"> | ||
<input type="hidden" id="pickup_latitude" name="pickup_latitude"> | ||
<input type="hidden" id="pickup_longitude" name="pickup_longitude"> | ||
<input type="text" class="form-control mb-2 mr-sm-2" id="dropoff" placeholder="Dropoff" name="dropoff"> | ||
<input type="hidden" id="dropoff_latitude" name="dropoff_latitude"> | ||
<input type="hidden" id="dropoff_longitude" name="dropoff_longitude"> | ||
<input type="text" class="form-control mb-2 mr-sm-2" id="pickup_datetime" name="pickup_datetime"> | ||
<select id="passenger_count" name="passenger_count" class="custom-select mb-2 mr-sm-2"> | ||
<option value="1" selected>1 person</option> | ||
<option value="2">2 persons</option> | ||
<option value="3">3 persons</option> | ||
<option value="4">4 persons</option> | ||
<option value="5">5 persons</option> | ||
<option value="6">6 persons</option> | ||
<option value="7">7 persons</option> | ||
<option value="8">8 persons</option> | ||
</select> | ||
<button type="submit" class="btn btn-primary mb-2" id="get-fare-button">Get fare</button> | ||
</form> | ||
</div> | ||
</div> | ||
<div id='map' style='width: 100%; height: calc(100vh - 88px - 64px);'></div> | ||
<div id="fare" class="position-absolute bg-primary p-4 d-none"> | ||
<p id="predicted-fare"></p> | ||
</div> | ||
</div> | ||
|
||
<div class="footer d-flex align-items-center justify-content-end p-4"> | ||
<p>Made with ❤️ @ | ||
<a href="https://www.lewagon.com" target="_blank"> | ||
<img src="images/le-wagon-neg-color.png" alt="" width=100> | ||
</a> | ||
</p> | ||
</div> | ||
<!-- Bootstrap --> | ||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> | ||
<!-- Algolia places --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<!-- MapBox --> | ||
<script src='https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.js'></script> | ||
<!-- Flatpickr --> | ||
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script> | ||
<script src='script.js'></script> | ||
</body> | ||
</html> |
Oops, something went wrong.