As introduced in the previous post there has been some work going on to explore a privacy-by-design alternative to digital travel assitant services like provided by Google or TripIt.

While probably not noticed by many users, the first building blocks for this have been added in the 17.12 and 18.04 application releases already, and a lot more is coming with 18.08. The following provides an overview of the components that have been extended or created as part of this effort.

KF5::Prison

Prison is part of KDE Frameworks 5 and takes care of barcode rendering. This is relevant for being able to render airline boarding passes or the tickets of some train providers. For KF5 5.41 Prison got support for rendering Aztec codes, probably the most widely used barcode format for mobile boarding passes. In February 2018 a brave test subject managed to pass boarding pass checks with a barcode rendered that way for the first time.

Apple Wallet pass file support

Apple Wallet passes are an often found file format for mobile boarding passes. Technically nothing fancy, it’s just a ZIP archive containing JSON data, graphical assets and translation catalogs. Initial support for reading these files has been part of KMail in 17.12, with 18.08 it moved to its own library, KPkPass, providing an API to consume Apple Pass files with C++ or QML.

Besides everything you need to render a working boarding pass these files also provide a basic REST API to poll for updates, which makes this particular interesting for us, given that live data is hard to come by for us, let alone in any unified way. Not all airlines support this, but in April this year we managed to successfully get notified about a Lufthansa gate change for the first time this way.

KItinerary

KItinerary is the libraray at the core of all this, and also got promoted to its own repository with 18.08. It mainly covers two aspects:

The data model, that is the data structures representing booking and reservation data. This largely follows the data model defined by schema.org, which for all we know is also used by Google and Apple for the same purpose.

Data extraction from a number of different sources, including structured annotations found in some booking emails, boarding pass barcodes, barcodes found on some train tickets, Apple Wallets passes as well as a system for extracting unstructured data from plain text, HTML and PDF files.

Data augmentation, that is adding additional information to extracted data from knowledge found on e.g. Wikidata.

KMail plug-ins

With the 17.12 release KMail already got a plug-in for rendering Apple Wallet pass file attachments, with 18.04 the first version of the itinerary plug-in was added. This plug-in will show the booking information found in the current email, and allows you to add the detected trip to your calendar for example.

KMail itinerary plug-in

Please excuse the visuals, this was initally just supposed to be my debug output, but it somehow got stuck. Like the rest of KMail’s message viewer it’s filled from a Grantlee template, so it should be fairly easy to turns this into something more pretty with just basic HTML knowledge, help very much welcome :)

KDE Itinerary mobile app

Since holding your laptop with KMail on it on to a boarding pass scanner is a bit inconvenient and awkward, we also have a Kirigami-based mobile companion app for all this of course. The app primarily consists of a timeline with your itinerary, as well as the possibility to show boarding passes. The first successful flight was made with this for the KDE PIM Sprint in April this year, passing all manual and automatic boarding pass inspections along the way with just the KDE Itinerary app.

KDE Itinerary timeline view with location-aware weather forecasts

KDE Itinerary boarding pass view

There’s also already support for weather forecasts (powered by api.met.no), power plug compatibility warnings (powered by Wikidata) as well as retrieving the itinerary from the Android calendar.

KDE Itinerary on Android showing power plug compatibility information

Summary

All this combined allows you to have KMail automatically extract booking information and send them via your calendar to your phone, where you get a unified itinerary with working boarding passes. Well, at least when using a supported airline, having a Nextcloud calendar and using DavDroid to sync your Android phone. But all of this can run on hardware and software you own and control, which is a big step forward already.

In the next post we are going to look a bit more at how the data extraction is done.