Coder Social home page Coder Social logo

worldbank-transport / open-transit-indicators Goto Github PK

View Code? Open in Web Editor NEW
43.0 21.0 21.0 23.43 MB

An open-source tool to support transport agencies in planning and managing public transit systems

License: GNU General Public License v3.0

PLSQL 0.24% Shell 4.46% HTML 14.32% CSS 5.36% JavaScript 2.09% Python 26.85% Scala 46.55% SQLPL 0.13%

open-transit-indicators's Introduction

open-transit-indicators

An open-source tool to support transport agencies in planning and managing public transit systems

Build Status

Travis CI Build Status

Selenium Test Status

Installation

Vagrant

If you're using Vagrant, then installation is as simple as cloning the repo and then issuing vagrant up from the root of the repository directory.

To change the default amount of memory allocated to the vagrant machine, set the environment variable OTI_VAGRANT_MEMORY to the preferred size, in MB.

Server installation

If you're installing directly onto a dedicated server, follow these steps after cloning the repo on an ubuntu machine version 12.04:

  1. Run the following commands:
sudo apt-get update
sudo apt-get -y install git
  1. Clone the project into the directory you want the project
cd <DIRECTORY TO DOWNLOAD/INSTALL PROJECT>
git clone -b master https://github.com/WorldBank-Transport/open-transit-indicators.git
  1. Edit deployment/provision.sh and change the line saying: PROJECTS_DIR="/projects". The text /projects should be replaced with the absolute path of the location where you've cloned the repository. For example, if your repository folder is located in /home/myusername/open-transit-indicators, the line should become PROJECTS_DIR="/home/myusername". You can use pwd to determine this directory.

  2. Move into the open-transit-indicators directory with the following command:

cd open-transit-indicators
  1. From the repository folder (project directory), issue the command (you may need to enter your password):
  • For development: sudo ./deployment/provision.sh development
  • For production: sudo ./deployment/provision.sh production

AMI Generation

If you want to generate an Amazon Web Service's (AWS) Amazon Machine Image (AMI) you can use Packer to handle the provisioning.

Use the following instructions to do so:

  1. Create an AWS account if you do not have one already
  2. Get the API keys for a new user or an existing user in your AWS account
  3. Download and install Packer
  4. Navigate to the deployment/packer directory
  5. Copy the open-transit-vars.json.example file and save it as open-transit-vars.json
  6. Edit open-transit-vars.json with the API keys downloaded in step 2
  7. Run the following command to generate a new AMI: packer build -var-file=open-transit-vars.json open-transit-indicators.json PLEASE NOTE: Running this command will cause resources to be created in AWS and will cost money
  8. Once the process finishes installing (could take up to an hour), make note of the AMI ID
  9. Launch the AMI using the AWS EC2 management console and browse to the public DNS hostname provided by Amazon

open-transit-indicators's People

Contributors

cloudniner avatar ddohler avatar echeipesh avatar flibbertigibbet avatar holly-transport avatar jbranigan avatar kshepard avatar lossyrob avatar maurizi avatar moradology avatar notthatbreezy avatar npztest avatar qli1205 avatar sharph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-transit-indicators's Issues

If indicator job crashes, further jobs get stuck at 'queued'

One of my indicator processing jobs crashed (meaning the status got stuck at 'processing'), and when I tried to kick off another, it remained stuck in the 'queued' status forever until I deleted the existing job that was supposedly still 'processing'.

Perhaps inspecting the celery job status directly would give us more granular info about job statuses?

Add simulated transit system for testing

PR #243 changes values to make tests run and comments out now broken tests - it would be nice if we piggypacked off of testkit and gtfs-test fixtures to use the ad hoc transit system Rob built. It would, in addition to being easy to pop in, allow us to reason in a clearer fashion about what we should expect results to be.

TypeError with shapefile.py ErrorFactory

On encountering an error during demographic shapefile import, the error handler fails with
TypeError(u"'source_file' is an invalid keyword argument for this function",)
at the line
self.problemClass.objects.create(**params)

Datetime oddities and less than optimal map for ObservedStopTimes

This one is a little weird. A potential bug was dealt with in a less than ideal way in MR #279 - it may warrant more exploration.

Basically, the less than ideal Map[Period, Map[String, Trip]] which is currently used for 'real time' trip mappings from scheduled trip IDs is used instead of the simpler Map[String, Trip] (which ought to be sufficient) because the latter returns the correct results + 24 hours. Something odd is apparently going on with dates.

Though this workaround might be hiding a more nefarious bug, progress is blocked on this merge and I've been unable to find evidence that such a bug is certain.

Real-Time data upload times out

Attempting to upload stop times for a midsize network (SEPTA bus) results in a timeout error; the celery import task takes tens of minutes.

Cryptic error if GTFS parser fails to load feed

On uploading a GTFS, if it passes validation, but the parser fails to load it, the UI returns a cryptic message that seems to indicate the feed failed validation. All feeds that pass validation should load through the parser, but we should display a more meaningful error message if it doesn't.

image

SQL injection vuln in our windshaft server

There is a SQL injection vulnerabililty in Indicator.prototype.getSql of oti-indicator.js.

Indicator.prototype.getSql = function () {

This url successfully drops the table gtfs_stops:

http://localhost:8067/tiles/transit_indicators/0/%27%29%20as%20hi;%20drop%20table%20gtfs_stops;%20SELECT%20*%20FROM%20%28SELECT%20formatted_value%20as%20value,%20ntile%285%29%20over%20%28order%20by%20value%29%20as%20ntiles_bin,%20the_geom%20FROM%20transit_indicators_indicator%20WHERE%20type=%27/morning/route/10/160/394.png

It looks like we'll have to find a reasonable way to escape or sanitize strings. Stripping out all non alphanumerics should do it.

No system to poll for GTFS parser completion

PR #355 squashes the timeout bug seen with slightly larger systems of GTFS data and introduces a new issue: without some kind of celery polling (similar to that used in indicator calculation), the client is not going to be able to determine the status of a GTFS ingestion.

A mid-sprint card has been added to add this functionality.

Handle zip files created on Macs

Zip files created on Macs currently include a folder called "__MACOSX" which contains Mac-OS-specific metadata. This causes the GTFS import Celery task to fail (the upload will fail with a timeout but the error is visible in the Celery logs). This folder should be ignored or deleted when uploading gtfs feeds (and other file types too, if it makes a difference).

Workaround: Run zip -d <gtfs_feed.zip> "__MACOSX/*" to manually remove the metadata from the zip file.

Fix Django tests

The recent authentication changes have caused all of the Django tests to break (401 errors on responses to all queries).

spray ExceptionHandler not handling exceptions

Although there is an exception handler defined in the implicit scope for the spray routes, it doesn't appear to actually catch errors. The handler translates its exception into JSON to send back, but since it's not catching exceptions, celery is getting an unexpected response, resulting in the UI displaying the error message "No JSON object could be decoded: line 1 column 0 (char 0)".

cryptic_oti_upload_error_msg

Send CartoCSS style for indicator map with tile URL

Currently the app defines the indicator color palettes in two spots.

  1. Windshaft, to draw the indicator geometries
  2. Angular, to draw the map legends

Ideally, we should pass the geometry to windshaft as a get param, storing the style definitions in only one place.

Need better handling when missing required parameters

Currently a user is still able to calculate indicators even if some required configuration parameters are missing. One particularly problematic parameter is Distance Buffer, which if not filled in will cause the Scala process to hang indefinitely.

Database Provisioning Fails on First Run

When provisioning a fresh machine setup_db.sh and the SQL files it runs against the database fails.

The problem seems to stem from the route type definitions being moved to a migration.

GTFS Parser requires agency_id

agency_id is an optional field in the agency.txt and routes.txt file, but the GTFS parser throws an exception unless the field is present

Settings check boxes - strange behavior

When loading the page, first the Demographic check box is activated, followed by Configuration. GTFS, boundary, and real-time aren't activated until I click on them. Clicking on users makes the real-time and GTFS check boxes disappear.

Cannot pip install requirements.txt

Deployment failed to install requirements for me. Two issues: first with ipdb. Though version 0.8 is specified, and pip install ipdb will install version 0.8, attempting to install with the version specified fails. The second issue is with transitfeed. It looks like the most recent version in pypi right now is 1.2.11 (not the latest, 1.2.12, which is specified in requirements.txt).

Failed indicator calculation jobs stuck in 'processing' status indefinitely

If the scala indicator calculations throw an error, the celery job continues to poll indefinitely for status, and the UI shows the calculations as 'processing', and do not allow the user to cancel or retry the job.

The spray endpoint should return an error response if the job fails, allowing the celery job to update the status appropriately and end the task.

Add Separate Config File for Windshaft

The config file for the Angular app /js/angular/app/scripts/config.js has hardcoded the port for the Windshaft tiler to 8067 -- this should be moved to a separate file for easier provisioning.

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.