GithubHelp home page GithubHelp logo

irail / hyperrail Goto Github PK

View Code? Open in Web Editor NEW
45.0 10.0 17.0 8.1 MB

The repo for the iRail.be webapp

Home Page: https://iRail.be

License: Creative Commons Zero v1.0 Universal

JavaScript 83.98% Ruby 0.01% PHP 9.62% SCSS 2.50% Blade 3.90%

hyperrail's Introduction

iRail.be

Software License Dependency Status devDependency Status Build Status

iRail.be is a web-application that uses data from http://api.irail.be (source code.) to create a hyper-media driven application for the Belgian railway company.

Looking for data? Check https://hello.irail.be for more info

Features

Want more features? Please do contribute by adding feature requests. Are you a developer? We accept pull requests!

Step 0: Requirements and clone

Clone the repository:

git clone https://github.com/iRail/hyperRail.git

Set up your server software to pass requests to the hostname of your choice to public/index.php

Step 1: Install / Update dependencies

In order to install the dependencies you have to run: composer install

When installing this for the first time, also run this:

cp .env.example .env
php artisan key:generate

and edit your .env after your own taste (e.g., you may want to switch development mode off)

Step 2: Update bootstrap/start.php for environments

Optional, but can be useful.

Step 3: make app/storage writeable

chmod -R 777 storage

Step 4: Set up resources

  • npm install
  • bower install
  • grunt

Step 5: You're ready!

Usually you should be ready to get started by visiting the hostname you have set up. If it does not work, log an issue. We'll help you out and fix the documentation for everyone else.

In case you just want to update the stations list to the latest version, run: composer update

License

We hereby put this work in the public domain under a CC0 license!

Feel free to attribute us at http://hello.irail.be.

hyperrail's People

Contributors

andreasdl avatar bertware avatar bramdevries avatar brechtvdv avatar drupol avatar elroyk avatar gitter-badger avatar haroenv avatar kidk avatar labautpol avatar micleyman avatar nicoverbruggen avatar pietercolpaert avatar serkanyildiz avatar tjoosten avatar tuinslak avatar xavez 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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hyperrail's Issues

Remember language

I'd suggest to remember the last-used language, this avoids always having to reconfirm the language you want to use.

SSL support

Currently, I am not testing the new hyperRail with SSL. I will be fixing SSL related issues when the other functionality is finished.

JSON by default

Right now, when adding no Accept header, the default choice of hyperRail is to return HTML. Most commonly however, I believe that HTTP requests without a HTTP Accept header will come from:

  • Lazy developers
  • Someone who does a test using curl on the command line

Thus we should provide JSON by default.

Content negotiation and errors

If there are no trains available anymore, instead of showing an empty array, all of a sudden, an HTML page pops up.

reproduce

curl http://irail.be/stations/NMBS/008866530 -H "accept: application:ld+json" -L

How to fix

When you notice there are no trains to show, return an empty JSON array instead of an error page.

URLs

Question: is it possible to work with cleaner URLs?

This is the query now: ?to=008821006&from=008811189&date=070614&time=1349&timeSel=depart&auto=true.

Can we work, like previously, with something somewhat more humanly readable?

Thanks.

iRail API does not support HTTPS requests

Since the old iRail planner API does not support HTTPS requests, on browsers that handle strict guidelines for mixed content (e.g. Firefox) the route planner will not work.

Bug in smartphone view

screenshot_2014-06-07-13-58-03

When being on the /route page, clicking "plan new route" (/route) again, doesn't make the 'dropdown' (?) collapse. It just stays like that, which looks like a bug.

I hope my explanation is clear... :p

JSON-LD on every URI

We want a application/ld+json on every output. When there is a form given, we need links to how we can get to the right URI next.

No need for subdir

No need for subdir, it makes things more complicated. Can you make hyperRailProj the root of the repo before it's too late? :)

Testing & monitoring

If we want to move iRail from the garage to something professional, where commercial parties (such as @FlatTurtle) rely on, we need to introduce a QoS.

From my understanding, data.iRail.be will be sunset in a couple of months (what about api.irail.be ?).

It would be good to provide a dashboard with daily (or hourly) results for ALL data on iRail.be (not just NMBS, but also TEC, MIVB, De Lijn, etc).
Ideally, the (failed) tests results should be broadcast using e-mail, twitter, etc. Perhaps a health status API could be handy as well ?

Todo:

  • document ALL the code, APIs, etc. Make it newb-friendly (push for universities to use our data for freshmen exercises)
  • fix #31
  • create an automatic testing interface, that tests http results, checks for correct date & output, etc
  • create a status dashboard with historic data
  • get automated results in your inbox (& twitter feed)

Examples:

Remember last used trajectory

Most of the times, I actually search the same trajectory (to look for delays before leaving home or the office). Therefore I'd suggest to remember the last trajectory that has been searched. Additionally, if the last trajectory is remembered I would add the invert-trajectory-button on the home page too and not only on the result-page.

JS-bug results in broken interface

When arriving at the interface, after having selected the language, the autofill does not seem to work and I found the following javascript stacktrace:

TypeError: Cannot read property 'length' of undefined
at https://irail.be/builds/js/scripts.js:31016:13395
at wrappedCallback (https://irail.be/builds/js/scripts.js:20676:81)
at wrappedCallback (https://irail.be/builds/js/scripts.js:20676:81)
at https://irail.be/builds/js/scripts.js:20762:26
at Scope.$eval (https://irail.be/builds/js/scripts.js:21786:28)
at Scope.$digest (https://irail.be/builds/js/scripts.js:21598:31)
at Scope.$apply (https://irail.be/builds/js/scripts.js:21890:24)
at HTMLInputElement.listener (https://irail.be/builds/js/scripts.js:26104:15)
at HTMLInputElement.jQuery.event.dispatch (https://irail.be/builds/js/scripts.js:4409:9)
at HTMLInputElement.elemData.handle (https://irail.be/builds/js/scripts.js:4095:28)

Refreshing solves the problem and so far I could only trigger the problem after the language selection (happened a couple of times in the last week)

Close fixed/done issues

Kind of a note that it might be handy to close issues that are done, otherwise it's hard to maintain an overview of what needs to be done.

Comments from french user

Liège n’existe pas dans ton programme…

Quand je tape « V » de Vilvoorde, apparait un « A » et je dois taper les 4 premières lettres « Vilv » pour voir inscrit « Vilvoorde » => ce n’est pas très rapide

https://irail.be/route?lang=fr

Slide open animation on results page is not smooth

When on mobile, the animation when toggling open entries on the results page after planning a route, is not smooth. Since this is a basic Bootstrap element, not sure if we can fix this without rewriting the entire animation.

Rework departure URI

The departure URI at this moment consists of:

$departureURI = "http://irail.be/stations/NMBS/008892007/departures/" . date("YmdHi") . md5sum(routeLabel . headsign ) . "/";

The md5sum is particularly a problem as the headsign changes on the course of the train. For instance, on one interface the headsign can be "Gent Oostende" while in another interface, the headsign can become "Gent". Therefore we suggest changing the URI towards:

$departureURI = "http://irail.be/stations/NMBS/008892007/departures/" . date("YmdHi") . routeLabel . "/";

Which will result in a clearer URI.

Steps to be taken:

  • inform everyone using the departure URI that this changed (thesis student)
  • Change it in hyperRail
  • Change it in the old API http://api.irail.be

Rework autocompletion

Rework the autocompletion to work with AJAX and to support multiple languages.

Server-side

On server-side, we have to support this: http://irail.be/stations/NMBS/?q=gent, which should return first the URI for Ghent Sint Pieters, then the URI for Ghent Dampoort and then the URI for Gentbrugge.

We should implement a trie index which is available in a very quick fashion (RAM). Redis seems like a good solution for this and someone has also already implemented this for Laravel: https://github.com/VictorSigma/RedCard-Autocomplete#laravel-1.

The scores given to each station (in order to be ordered) should in the first place be how big the station is. An indication of this can be found by comparing the number of platforms in a station (which can be crowd-sourced or collected through dbpedia). Another indication can be the number of passengers in a certain station, which for 2009 can be found here: http://www.treintrambus.be/images/stories/reizigerstellingen_2009.xls.

When logged in, also the checkin history should be used.

The body that is returned will be an ordered JSON-LD array of stations, including an indication of how the station was found.

Client-side

On the client-side we will need to review the autocompletion mechanism (maybe @nicoverbruggen can give some pointers of what is used right now?). In any case, this stackoverflow topic looks interesting: https://stackoverflow.com/questions/18460374/angularjs-autocomplete-from-http

When this issue is fixed, also issue #21 will be fixed.

favicon: make it prettier

It's a square square. More square than that doesn't exist.

Either round the corners a tiny bit, or invent colors (make Beep red, and the rest transparant).

On the + side: it's retina ready ;)

Disable session system

The session time-out is way to quick and is only used to store the language the user needs. Just use a cookie to store the preferred language.

Enable appcache

Is it a good idea to enable appcache? The previous version of iRail.be was very fast just because of this reason: you did not need to load the javascript and html anymore from the web, it was already there. Other benefits are that if you but it as an icon on your android device, it doesn't open in a browser tab, but it acts like a separate "app".

Your thoughts?

Multilanguage support for StationString to ID conversion

When provided with a string, strings do not properly convert to their proper id's using the StationString::convertToId() function.

This is because the original website used English station names, and our comparison list now contains Dutch station names. To allow for multilanguage conversion support for this function, I need a set of translations of these station names.

As such, not only 'Gent-Sint-Pieters' would convert correctly, but also 'Ghent Sint Pieters', 'Gent Sint Pieters', 'Ghent-Sint-Pieters' could be converted correctly.

Highlight a certain departure in a result preview

When there would be a #result=1 behind the URI, we should highlight the first result. This way, when sharing the link with others, you could indicate that you want to take the train with the first result on this page.

Reference hello.iRail.be

In the footer, or anywhere else, I can't find any reference to the separate blog at https://hello.irail.be/. Unless @pietercolpaert wants to sunset it? I think the blog still has relevant, iRail related, posts (and should still be used).

And it's also sad that the new iRail hasn't been published on that blog.

Auto option

Remove auto option: just always calculate it when the enite URI is given

What would be the engineering efforts to create an API with station pictures

Hello all,

For the mobile app, I am obsessed with design and put big pictures to make the app beautiful.

Below you will find a prototype of the next version, don't be focused on the texts and fonts that are not ready yet, but please consider having a gorgeous picture of each station.

These pictures can be found on internet (I don't know about the licence, but I am pretty sure we can find legaly usable pictures on flickr, wikipedia, instagram, etc...)

I am ready to collect all these pictures manually, rename them with their ID, and upload to servers, but I really need to know if this could be hosted on iRail/OKFN and if you find this useful.

Please let me know, so I can work collecting those pictures.

screenshot_2014-06-28-11-54-36

Handling iRail URIs that contain deprecated functionality

How should older iRail url's be handled when the functionality is no longer available?

For instance, the settings page (https://irail.be/settings/) is deprecated in the new version of iRail.be. Other examples:

  • Liveboards with one station as input (now redirect to /station/id which functions as a liveboard)
  • Liveboards with two stations as input (currently shows a message)

Custom images per amount of delay

Right now we have a very boring image with every departure (twitter card & in page). We should have images that change per amount of delay.

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.