Python JavaScript CSS HTML PLpgSQL Dockerfile
Clone or download
Pull request Compare This branch is 1288 commits ahead, 4 commits behind ronreiter:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
alembic add schools table to database Jul 21, 2018
anyway Merge pull request #4 from sa-lo-mon/dev Aug 4, 2018
custom_queries Drop support in SQLite Jan 6, 2018
docs Fix AppVeyor and deprecated imports May 1, 2018
static Merge pull request #913 from atalyaalon/dev Jul 26, 2018
templates change schools dashboard to the new dashboard Aug 6, 2018
tests temporarily disable 2014 markers tests since table schema has changed Jul 16, 2018
translations/he/LC_MESSAGES Update to dev Oct 12, 2015
.appveyor.yml Merge branch 'dev' into add_postgis May 5, 2018
.dockerignore Feature: Docker compose improvements (#765) Oct 6, 2017
.gitignore Feature: Docker compose improvements (#765) Oct 6, 2017
.pylintrc More Python 3 fixes Oct 16, 2017
.travis.yml Merge pull request #872 from hasadna/add_postgis Jul 3, 2018
Anyway.ai work Aug 17, 2013
CBS.md change cbs data dirs to dirs without spaces May 14, 2018
Dockerfile Drop support in SQLite Jan 6, 2018
LICENSE Update app name to ANYWAY (all caps) May 7, 2015
Procfile Use Celery for cluster calculator Oct 17, 2017
README.md Update cbs accident file Aug 15, 2018
alembic.ini Reorganize the use of Alembic (fix #757) Oct 2, 2017
app.json Update buildpacks for Heroku Sep 1, 2017
babel.cfg Update to dev Oct 12, 2015
crontab Fix crontab (fix #728) Sep 12, 2017
docker-compose.yml Drop support in SQLite Jan 6, 2018
docker-entrypoint.sh Use Celery for cluster calculator Oct 17, 2017
fields work Aug 17, 2013
main.py School reports modifications - add dataframe, change distance to 300m Aug 4, 2018
messages.pot Update to dev Oct 12, 2015
newrelic.ini Adding new relic for monitoring perofrmance Nov 10, 2014
requirements.txt Adding gis queries using geoalchemy2 Mar 7, 2018
runtime.txt Update Python to 2.7.11 May 6, 2016
test_requirements.txt Browser tests (fix #606) Sep 22, 2017

README.md

ANYWAY Build Status Build status

anyway.co.il - Crowd-sourced road hazard reporting website.
Also available at oway.org.il.

Feel free to contribute to the project.

To report bugs and feature requests, please open an issue on GitHub.

See also our Android app on GitHub.

The datasets Anyway uses are documented here:

See Code Directory Tree Structure.

About

Anyway's main goal is raising awareness of road accidents and act to avoid them, by showing road accidents with casualties over map.
The shown data based on reports supplied by the Israeli Central Bureau of Statistics (CBS) and real time reports from United Hatzalah of Israel.
Anyway is an open source project, sponsored by The Public Knowledge Workshop (“Hasadna”).

Contributing

  • We try to follow the process of other Hasadna projects, e.g. Open-Knesset.
  • Please take a moment to read our "Contributing to ANYWAY" manifest.
  • To see our GitHub issues in a nicer interface, take a look at HuBoard. Check out the Ready list to find a task to work on. The Backlog list there contains issues that are still not ready to be started. The Working list contains issues already started by developers (make sure to move your issue there once you start working on it), and the Done list contains completed issues that are waiting to be confirmed done and closed.

Getting the code and Adding CI to your forked repository

  1. Fork this repository on GitHub
  2. Add Travis CI to your forked repository - in your github forked repository: Settings -> Integrations & services -> Add service -> Travis CI
  3. Add AppVeyor to your forked repository - Login with your GitHub account -> New Project -> GitHub -> anyway
  4. git clone https://github.com/*you*/anyway
  5. Add the main repository as your upstream remote: git remote add upstream https://github.com/hasadna/anyway
  • Get updates whenever you start working: git pull upstream dev
  • Push to your fork when you've committed your changes and tested them: git push. Now make sure CI tests are passing (Travis CI and AppVeyor) and make a pull request from your fork on GitHub

Local Developement: Installing dependencies

You should be familiar with setting up Python in your computer. You can consult the wiki for platform specific tutorials. Developing by using a virtual environment is highly recommended.

Choosing a Python Version

The project is currently transitioning to Python 3. Both Python 2 and 3 are supported at the moment, and the code is tested in Travis against both versions. If you are setting a new environment, it is recommended that you choose Python 3 for future compatibility. The instructions below are relevant for Python 2.

Ubuntu

  1. sudo apt-get install python2-pip python2-dev libpq-dev rabbitmq-server

Fedora

  1. sudo dnf upgrade python-setuptools

OS X

  1. sudo easy_install pip setuptools

For all platforms:

  1. Activate your virtualenv (in case of using one): source *env-name*/bin/activate
  2. Run pip install -r requirements.txt -r test_requirements.txt

Windows

See the Wiki.

Local Developement: Local first run (all platforms)

  1. Set up a PostgreSQL server and create a database for anyway. The instructions for doing that depend on your operating system
  2. Define connection string (needs to be defined whenever you start working):
  1. First time, create tables: alembic upgrade head
  2. Optionally, get the complete accidents file after sending a permission request, and extract it into /static/data/cbs. Otherwise, you'll use the example accidents files that you already got with the code.
  3. Populate the data (markers etc.): python main.py process cbs: this will take a few minutes if you're using the example files (default), but if you have the complete data it may take several hours.
  4. Populate United Hatzalah sample data: python main.py process united --light for the complete, or more recent data please contact the Anyway team.
  5. Populate CBS registered vehicles in cities : python main.py process registered_vehicles: this will take less than an hour
  6. Get the RSA file from rsa file and extract the file into /static/data/rsa. To Populate RSA data: python main.py process rsa <rsa_file_name>
  7. Run the app: python main.py testserver: do this whenever you start working and want to try out your code.
  8. Navigate to http://127.0.0.1:5000 in your browser.
  9. If the site fails to load properly, make sure you have JDK installed on your machine
  10. If you wish to share your app on the local network, you can expose flask by running python main.py testserver --open (Please note that this would expose your machine on port 5000 to all local nodes)

It is useful to add the following to your ~/.bashrc (fixing for the correct path):

alias anyway='cd *path*/anyway && workon anyway && export DATABASE_URL=postgresql://postgres@localhost/anyway'

Then you can simply start working by running the anyway command.

Testing

To run tests: pylint -j $(nproc) anyway tests && pytest -m "not browser" ./tests

If you also wish to run the real browser tests, replace-m "not browser" with --driver Chrome or specify the browser of your choice. To learn more, read about pytest-selenium.

Altering the database schema

When creating a patch that alters the database schema, you should use generate the appropriate Alembic revision by running:

alembic revision --autogenerate -m "Description of the change"

Make sure to commit your revision together with the code.

Docker

See DOCKER

Translation and Localization

See TRANSLATE