forked from sharedstreets/mobility-metrics
-
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
1 parent
e7f2d9a
commit 2d3fd91
Showing
19 changed files
with
1,798 additions
and
635 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 |
---|---|---|
|
@@ -62,8 +62,10 @@ typings/ | |
|
||
# default data dirs | ||
data | ||
graph | ||
shst | ||
cache | ||
public | ||
|
||
# config | ||
config.json |
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,16 @@ | ||
CHANGELOG | ||
--- | ||
|
||
## 1.4.0 | ||
|
||
- deprecate server in favor of static site | ||
- introduce mobility-metrics CLI | ||
- add example directory, including scripts to reproduce the public demo with 4 simulated providers in Nashville, TN | ||
- add report directory listing (no more guessing which days have data) | ||
- fleet size tracker | ||
- configurable map zoom | ||
- Custom mapbox layer (enables custom polygons in the background) feature | ||
- setup changelog docs | ||
- add geometry type to geojson export file name behavior feature | ||
- log version when generating backfill feature | ||
- set date in UI to 1 day prior to current behavior ui |
Large diffs are not rendered by default.
Oops, something went wrong.
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,36 @@ | ||
{ | ||
"boundary": [ | ||
-86.84881210327148, | ||
36.12262352221241, | ||
-86.73688888549805, | ||
36.2049447642222 | ||
], | ||
"center": [-86.77705764770508, 36.16202793326575], | ||
"privacyMinimum": 3, | ||
"providers": { | ||
"Flipr": { | ||
"type": "local", | ||
"trips": "example/data/Flipr/trips.json", | ||
"status_changes": "example/data/Flipr/changes.json", | ||
"enabled": true | ||
}, | ||
"Scoob": { | ||
"type": "local", | ||
"trips": "example/data/Scoob/trips.json", | ||
"status_changes": "example/data/Scoob/changes.json", | ||
"enabled": true | ||
}, | ||
"BikeMe": { | ||
"type": "local", | ||
"trips": "example/data/BikeMe/trips.json", | ||
"status_changes": "example/data/BikeMe/changes.json", | ||
"enabled": true | ||
}, | ||
"Spuun": { | ||
"type": "local", | ||
"trips": "example/data/Spuun/trips.json", | ||
"status_changes": "example/data/Spuun/changes.json", | ||
"enabled": true | ||
} | ||
} | ||
} |
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,68 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const rimraf = require("rimraf"); | ||
const mkdirp = require("mkdirp"); | ||
const moment = require("moment"); | ||
const exec = require("child_process").execSync; | ||
|
||
console.log("setting up data..."); | ||
const dir = path.join(__dirname, "data"); | ||
rimraf.sync(dir); | ||
mkdirp.sync(dir); | ||
|
||
console.log("generating graph..."); | ||
const graph = path.join(__dirname, "graph"); | ||
rimraf.sync(graph); | ||
mkdirp.sync(graph); | ||
exec( | ||
"curl https://s3.amazonaws.com/metro-extracts.nextzen.org/nashville_tennessee.osm.pbf -o graph/nashville.osm.pbf" | ||
); | ||
exec( | ||
'osmium extract -b "-86.84881210327148,36.12262352221241,-86.73688888549805,36.2049447642222" graph/nashville.osm.pbf -o graph/nash.osm.pbf -s "complete_ways"' | ||
); | ||
exec( | ||
"../node_modules/osrm/lib/binding/osrm-extract graph/nash.osm.pbf -p ../node_modules/osrm/profiles/foot.lua;" | ||
); | ||
exec("../node_modules/osrm/lib/binding/osrm-contract graph/nash.osrm"); | ||
|
||
const providers = ["Flipr", "Scoob", "BikeMe", "Spuun"]; | ||
|
||
const days = 45; | ||
|
||
const start = 1563087600000; // Sunday, July 14, 2019 3:00:00 AM GMT-04:00 | ||
|
||
var cmd = "trip-simulator "; | ||
cmd += "--config scooter "; | ||
cmd += "--pbf graph/nash.osm.pbf "; | ||
cmd += "--graph graph/nash.osrm "; | ||
cmd += "--agents {agents} "; | ||
cmd += "--start {start} "; | ||
cmd += "--seconds 60000 "; | ||
cmd += "--changes data/{provider}/changes.json "; | ||
cmd += "--trips data/{provider}/trips.json "; | ||
cmd += "--quiet "; | ||
|
||
const minAgents = 25; | ||
const maxAgents = 200; | ||
|
||
console.log("running simulations..."); | ||
|
||
for (var day = 1; day <= days; day++) { | ||
console.log(day + " / " + days); | ||
console.log("- - -"); | ||
const time = start + day * 86400000; | ||
|
||
for (let provider of providers) { | ||
console.log(" " + provider); | ||
mkdirp.sync(path.join(dir, provider)); | ||
const agents = Math.round( | ||
Math.random() * (maxAgents - minAgents) + minAgents | ||
); | ||
|
||
var run = cmd; | ||
run = run.split("{agents}").join(agents); | ||
run = run.split("{start}").join(time.toString()); | ||
run = run.split("{provider}").join(provider); | ||
exec(run); | ||
} | ||
} |
Oops, something went wrong.