Server for the UnderLX app, providing information about public transit networks and handling user-contributed information. It is also responsible for serving a fancy status page for the Lisbon Metro, scraping the official website for some of the information it shows. Live at https://perturbacoes.pt.
The server is written in Go. It is compatible with PostgreSQL only and designed to run behind a reverse proxy (to handle e.g. HTTPS), although it does not need one for experimentation/development.
It is prepared to work with other transit networks, including multiple networks at once, and multiple sources of information for a single network. It supports mixing official sources of information, like service status pages, with unofficial sources, like user reports, managing the lifecycle of service disruptions ("disturbances") accordingly. A modular scraper architecture has been designed to this effect.
It can also be extended to support other kinds of service disruption events ("disturbances"), including whole-network incidents. Right now all "disturbances" are line-oriented.
Since the service, in its current form, monitors a Portuguese subway network, it targets a Portuguese audience and the website is in pt-PT. All code and comments are in English. The REST API provided by this server is locale-agnostic and provides to its clients all the information required for correct localization, such as the timezone of the transport networks (so that timetables, for instance, can be correcly displayed and computed upon).
The website contains a heavily modified version of cnanney's CSS flip counter.
We assume you already have a Go development environment set up. This project uses the Go modules support introduced in Go 1.11 for dependency management. To compile, just clone this repo anywhere and
You should then create a new PostgreSQL database and use the
schema.sql file to create its schema. Edit the database connection string in
disturbancesmlx and wait for the "Scraper completed second fetch" log message to appear. The HTTP server should be available on localhost port 8089 by then (and the PosPlay HTTP server in port 8092).
Contributions are welcome. Fork this project, commit your changes and open a pull request.
I have no affiliation with Metropolitano de Lisboa, E.P.E.. The code and the associated website are not sponsored or endorsed by them. I shall not be liable for any damages arising from the use of this code or associated website.