Fancy status page and status logger for the Lisbon Metro, that scrapes the official website for information
Go HTML JavaScript CSS Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dataobjects Fix bugs with line stats calculation Jul 19, 2018
discordbot Discord bot: make communication with parent package more idiomatic Jul 22, 2018
resource Fix change to dataset resource that's wrecking havok on the app Jul 22, 2018
scraper Make Facebook scraper more resilient Jun 2, 2018
static Add support for reporting disturbances through the website Jun 5, 2018
stationkb @ 7b42fde Move stationkb to a submodule Feb 26, 2018
surveyor Remove binary Mar 24, 2017
web Strike-out closed stations on the line page of the website Jun 8, 2018
.gitignore Update gitignore to ensure private keys are not committed on accident Jun 7, 2018
.gitmodules Move stationkb to a submodule Feb 26, 2018
.travis.yml Attempt to fix travis build by checking out correct discordgo branch Apr 25, 2018
Gopkg.lock Reorganize keybox stuff, adding nested keyboxes for cleaner config Jul 19, 2018
Gopkg.toml Reorganize keybox stuff, adding nested keyboxes for cleaner config Jul 19, 2018
LICENSE Add license Mar 24, 2017
README.md README changes for dep Jun 7, 2018
announcements.go Fix imports and other paths to the repo after move to org Feb 28, 2018
api.go More bot refactoring and new commands Jul 18, 2018
auth.go Add support for associating staff notes with disturbances Mar 28, 2018
close-pt-ml-ar.sql We have more table columns than we used to... Jun 8, 2018
close-pt-ml-en.sql We have more table columns than we used to... Jun 8, 2018
compute.go Fix linter warning Mar 16, 2018
constants-release.go Fix linter warnings Mar 16, 2018
constants.go Fix linter warnings Mar 16, 2018
discord.go Discord bot: make communication with parent package more idiomatic Jul 22, 2018
genkey.sh Implement client pairing protocol Jul 14, 2017
main.go More bot refactoring and new commands Jul 18, 2018
notifs.go Send message type with line status notifications Jun 7, 2018
realtime.go Fix issues identified by static analysis Mar 16, 2018
reports.go Allow more admin control of reports system Jun 15, 2018
schema.sql Add message type to line status. Will help with #56 later on. Jun 5, 2018
scrapers.go Discord bot: make communication with parent package more idiomatic Jul 22, 2018
secrets-debug.json Reorganize keybox stuff, adding nested keyboxes for cleaner config Jul 19, 2018
stats.go Implement the first part of the user-reported disturbances feature Jun 4, 2018
telemetry.go Reorganize keybox stuff, adding nested keyboxes for cleaner config Jul 19, 2018
trusted_client_cert.pem Commit the trusted client key since it's a public key (and this is th… Jun 7, 2018
web.go Reorganize keybox stuff, adding nested keyboxes for cleaner config Jul 19, 2018

README.md

disturbancesmlx Discord license

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.

Installation

We assume you already have a Go development environment set up. This project uses dep for dependency management. Begin by installing dep (it's easy).

You should then clone this repo with go get -u github.com/underlx/disturbancesmlx, then use dep ensure to download and install the right versions of the dependencies in the vendor directory.

Create a new PostgreSQL database and use the schema.sql file to create its schema. Edit the database connection string in secrets-debug.json.

go build, run 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.

Contributing

Contributions are welcome. Fork this project, commit your changes and open a pull request.

Disclaimer

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.