Giter VIP home page Giter VIP logo

cac-tripplanner's Introduction

Clean Air Council Circuit Trip Planner and Travelshed

Development Dependencies

Development Installation

  1. Make sure you have the development dependencies installed
  2. Place GTFS .zip files, OSM files, and elevation .tif files (optional) in the root of the otp_data folder
  3. (Optional) Generate a graph file with (takes approx 3 hours) docker-compose run --rm otp otp --build /var/otp in the deployment/graph directory.
  4. Copy deployment/ansible/group_vars/development_template to deployment/ansible/group_vars/development
  5. Change into the src/ folder and run npm install to install the node modules on the host machine
  6. Run vagrant up. You can choose to change the Virtualbox shared folder type for the app VM from its default NFS by:
CAC_APP_SHARED_FOLDER_TYPE=virtualbox vagrant up
  1. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
  2. Running ./scripts/serve-js-dev.sh on the host will rebuild the front-end app on file change (the browser must be reloaded manually to pick up the change). Alternatively, cd /opt/app/src && npm run gulp-development can be run manually in the VM to pick up changes to the static files.

Note that if there is an existing build Graph.obj in otp_data, vagrant provisioning in development mode will not attempt to rebuild the graph, but will use the one already present.

Django migrations are run as part of app provisioning, here, but there may be instances where you need to manually run migrations outside of provisioning, in which case use the command:

vagrant ssh app -c 'cd /opt/app/python/cac_tripplanner && python3 manage.py migrate'

Building AMIs

  1. Configure an AWS profile with aws configure --profile gophillygo if you haven't already
  2. Make a production group_vars file (similarly to how is described above with development). Make sure production is set to true, and also specify an app_username, which should be set to: ubuntu
  3. If building the otp machine, make sure the latest GTFS are in otp_data, then build a graph when them in the development environment provisioning. This will result in a new Graph.obj file being written to otp_data.
  4. Install the deployment dependencies, ideally in a virtualenv: python3 -m venv .venv && source .venv/bin/activate && pip install -r python/cac_tripplanner/deployment_requirements.txt
  5. Build AMIs by running (within the virtualenv): AWS_PROFILE=gophillygo deployment/cac-stack.py create-ami
  6. The previous command builds all AMIs. To only build a single AMI, run the same command, but also specify the --machine-type parameter, which may be set to one of: bastion, otp, or app.

Launching AWS Stacks

  1. Copy deployment/default_template.yaml to deployment/default.yaml and edit variables
  2. Configure an AWS profile with aws configure --profile gophillygo if you haven't already
  3. Create a virtualenv with the deployment dependencies if you haven't already (see Building AMIs, above).
  4. In the project directory, for a set of Blue stacks in the Production environment, run: AWS_PROFILE=gophillygo deployment/cac-stack.py launch-stacks --stack-color blue --stack-type prod
  5. The previous command will do the following:
  • Ensure the VPC stack is up in Production -- it will be launched if it isn't already running
  • Ensure the DataPlane stack is up in Production -- it will be launched if it isn't already running
  • Ensure the OtpServer Blue stack is up in Production -- it will be launched if it isn't already running
  • Ensure the WebServer Blue stack is up in Production -- it will be launched if it isn't already running
  1. Note that database migrations are not automatically run. When the DataPlane is first brought up, it is necessary to manually create the app user/db and run migrations.
  2. Launching a set of Production stacks with the other color (Green), will use the same VPC and DataPlane stacks, but will create different OtpServer and WebServer stacks (if they don't already exist).

Production Blue/Green deployment

  1. Note which color is currently running in production. Use the opposite color in the following steps.
  2. Set otp_host in production group_vars to the CloudFront distribution with the desired color.
  3. Run create_ami command to build new AMIs.
  4. Update default.yaml with new AMI ids.
  5. Run launch_stacks command to launch stacks with the desired color.
  6. Test new stacks thoroughly.
  7. Switch the public DNS record of the site to point to the new WebServer ELB DNS.
  8. The stacks of the previous color may be deleted when ready.

cac-tripplanner's People

Contributors

bryanquigley avatar cloudniner avatar ddohler avatar dependabot[bot] avatar flibbertigibbet avatar fungjj92 avatar hectcastro avatar kevinearldenny avatar klaash avatar kshepard avatar ktohalloran avatar lederer avatar maurizi avatar moradology avatar mtedeschi avatar notthatbreezy avatar rachelekm avatar rajadain avatar rbreslow avatar sharph avatar tnation14 avatar

Stargazers

 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

cac-tripplanner's Issues

Missing leaflet image assets

JavaScript console error on map page about not being able to load /static/styles/images/layers.png.

Also the map layer control seems to be missing its background image; it displays as a white square.

Unable to run initial migrations

I recreated my database VM from scratch. When I attempted to run migrations, there was a warning

Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

When I attempted to run makemigrations the process returned the following error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemigrations.py", line 124, in handle
    self.write_migration_files(changes)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemigrations.py", line 152, in write_migration_files
    migration_string = writer.as_string()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/writer.py", line 131, in as_string
    operation_string, operation_imports = OperationWriter(operation).serialize()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/writer.py", line 88, in serialize
    arg_string, arg_imports = MigrationWriter.serialize(arg_value)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/writer.py", line 333, in serialize
    return cls.serialize_deconstructed(path, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/writer.py", line 239, in serialize_deconstructed
    arg_string, arg_imports = cls.serialize(arg)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/writer.py", line 379, in serialize
    % (value.__name__, module_name))
ValueError: Could not find function generate_filename in destinations.models.

typeahead console error

During use, typeahead.js / jQuery occasionally spit out the error:

Uncaught TypeError: Cannot read property 'length' of undefined

Click and drag origin/destination

This may be a nice enhancement. It was also suggested that we could do the same with the directions, but I'm not sure about that. The use case is for when a tough spot (like the Art Museum circle, or Vine St) gets put into the directions and there are no alternatives provided by OTP.

Update to use Azavea OTP / version 0.13

Current work on the Azavea fork of OTP is based off of version 13 (the last release). We'll likely want to switch CAC to work off of 13 as well. In version 12, JSONP was replaced with CORS, so that should make things easier for us. We may have to figure out how to force usage of the graph config file for the update.

Make side panel details resize dynamically

Map page side panel results div is fixed in size for both tabs. It should set its height based on the size of the results to display, up to some max.

There are some TODOs in the scss with fixed sizes to remove.

Pan/zoom to fit isochrone

Setting a different origin or changing the time expands the isochrone outside of the viewport. We should discuss for specific behavior - i.e. it may not always be desirable to be zooming in and out, depending on user action. Maybe just the initial zoom of the map...

Always display featured locations on the map

This wasn't necessarily clear in the wireframes, but if a user pans outside of their isochrone, the other destinations should be there. They don't necessarily need to be listed in the sidebar, although that is an option as well.

No way back to features list from detail view

Once a feature is clicked in the 'explore' tab, the app switches to the 'directions' tab. From there, navigating back to the 'explore' tab now shows the detail description of the feature (which was not visible before), but there's no way to go back to the summary list of all the features. Also, the only way to view the detailed description of a feature is to switch back to the 'explore' tab after seeing directions to it.

Fix tests

Both the python and js tests are currently failing.

collectstatic warning

When running manage.py collectstatic, get warning:

/opt/app/python/cac_tripplanner/destinations/forms.py:8: RemovedInDjango18Warning: 
Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is 
deprecated - form DestinationForm needs updating
  class DestinationForm(ModelForm):

Add info to routing result

Primarily for step-by-step:

  • Time, distance
  • Mode icons (walk, bike, bus, train)
  • Include which bus or train to get on (and remove turn directions while on buses)

Realizing we may have lifted the set-by-step parser from a different project that was walk-only. Hopefully we are getting the required data returned.

Autocomplete results enhancements

  • Some destinations don't autocomplete (King of Prussia Mall, Longwood Gardens) - this may be related to the extent of the suggest/search radius
  • City/area names don't geocode (i.e. East Falls)
  • Should discuss options when a user's search can't be resolved
  • This kind of needs to work as well as Google Maps (I know) - we may want to consider switching libraries
  • This was the primary hindrance to usability
  • Requires discussion

Add loader to map page

When waiting from results from OTP or features, have a loader of some sort display while waiting.

Maximum bike distance

Not sure if this is an option. Example = 15 miles as max en route to Conshohocken. Do we send the user up the river trail, or on the Conshy train?

Map page form validation needs work

If the 'directions' tab form gets marked as invalid, the 'from' field's red border remains after a valid address has been entered and geocoded.

The 'explore' tab has no validation, and will use the default location if none entered.

Add "x" to clear text inputs

It looked like a lot of work to select the whole string and delete it (often extends beyond the length of the text box).

Share functionality

The proof-of-concept share link getting wired up into the modal interface - with copy link (manual is fine), twitter, facebook, and whatever other social media...

Leaflet error on tab switch

Occasionally switching to the 'directions' tab throws the error:

Uncaught TypeError: Cannot read property '_leaflet_id' of null

Handle error when no geocode result for address

Some addresses listed in the typeahead are not found by the geocoder. When such an address is selected, the text box populates, but then the selection event isn't triggered, and so the directions/explore results do not update.

Refactor some javascript modules

Some modules, for example cac-pages-map.js are in need of a good refactor. There are a lot of js variables and css classes used in disjoint objects which makes it necessary to constantly extract and set information just the right way before performing actions. It's hard to work with and feels very error prone.

Use UserPreferences consistently

There are currently some bugs related to not using UserPreferences consistently. For example, the marker shown for the origin on the explore page is set via searching on the home page, but changing the location from the explore page and searching does not update this location.

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.