I’ll be attending the Chaos Communication Congress this year finally for the first time, after having failed to obtain a ticket in the past. This week I got the actual ticket document, and seeing it contain an UIC 918.3 barcode I of course had to make KDE Itinerary support this ticket too :)

36C3 Ticket

The 36C3 ticket is a nice example for recently added features in KDE Itinerary, and also sufficiently special to show the flexibility of the extractor infrastructure. It’s a PDF file with two barcodes, a QR code needed for entrance, and an Aztec code with an UIC 918.3 payload for local public transport to the venue.

The QR code is fairly useless for our purposes, it basically just contains a random number. Good from a privacy point of view, but therefore providing nothing the extractor can work with. Not so the second one, that contains some very specific markers we can use for selecting the extractor, such as the unassigned UIC operator code “9997” and the passenger name “36C3”.

So, using the following filter expression in the extractor metadata gives us single PDF pages with one 36C3 ticket each to process:

{
    "filter": [ {
        "match": "uic:9997",
        "property": "reservationFor.provider.identifier",
        "type": "JsonLd"
    } ],
    "type": "Pdf"
    ...
}

The extractor script needs to do a few unusual things though. First, the generic extraction assumes this to be a train ticket, as that’s what UIC 918.3 barcodes are usually used for. We want this to be an event ticket though. So rather than the usual approach of augmenting the results from the generic extraction, we simply create an entirely new object and return that, replacing the existing results.

KMail showing information about an attached 36C3 ticket using the KDE Itinerary plug-in.
KMail Itinerary plug-in detecting 36C3 tickets.

The other special thing is the fact that we have two ticket tokens (barcodes) here, which we both need to preserve. That’s where the recently added multi-ticket support comes in. For this we need to generate two identical event tickets, with separate ticket tokens and ticket names. The slightly hacky part is finding the second barcode, as due to its non-descriptive content we need to do that manually. So this requires iterating over all images on the same PDF page:

var images = pdf.pages[Context.pdfPageNumber].images;
for (var i = 0; i < images.length; ++i) {
    var code = Barcode.decodeQR(images[i]);
    if (code) {
        res.reservedTicket.ticketToken = "qrcode:" + code;
        break;
    }
}

The full extractor script can be found here.

KDE Itinerary multi-ticket selector for a 36C3 ticket.
KDE Itinerary showing both the 36C3 entrance and public transport tickets.

At 36C3

If you are attending 36C3 and are interested in Free Software/Open Data travel/mobility/digital assistant stuff or related/adjacent topics, let’s meet! I’m particular interested in widening the set of people we collaborate with on this, bringing KDE, Wikidata and Navitia together has already gotten us quite far, but I think there’s more we can achieve :)

It looks like I’ll also be presenting the work we did around KDE Itinerary on the WikipakaWG stage, but the exact date and time has yet to be determined.

Thanks

Special thanks to the nice people who helped me to finally get my hands on a ticket for this event, really looking forward to this!