01

More than one date

Tickets for concerts, trains, exhibitions and sports often show several dates. There may be the date the ticket was bought or printed, the date of the event, a validity period and sometimes a date in the small print or terms. All of them may be printed clearly and in similar formats.

02

Reading tickets automatically

Software that reads tickets from photographs or scans might be used to add events to a calendar, check entry at a venue or organise travel documents. It uses optical character recognition to read the text and then extracts key information, such as the event date, time and place.

03

Finding dates is easy

Recognising that a string of characters is a date, such as 12.03.1998, is relatively easy. Dates follow recognisable patterns. But finding a date is only the first step. The real challenge is deciding which date is which.

04

Linking dates to labels

To identify the event date, the software must link each date to its context: a nearby label such as Event date or Valid on, or its position in a particular region of the ticket. Ticket layouts vary widely between organisers, so the software must understand labels and layout, not just positions.

05

A misleading test

Suppose all the tickets in a test set were bought on the same day as the event. The issue date and the event date would be identical. A software rule that simply picked the first date on the ticket would always give the right answer, even if it was actually reading the issue date.

06

Include disagreements

A good test set includes tickets where the issue date and event date are different. On these, a wrong rule would give a wrong answer, revealing the mistake. Including such cases ensures the test can tell a correct method from an incorrect one that happens to work on easy examples.

07

Date formats

Dates are written in many formats around the world: day-month-year, month-day-year, with numbers or month names. A ticket reading 03.04 could mean 3 April or 4 March, depending on the convention. Software must take the ticket's origin or language into account, and tests should include different formats.

08

Other fields

The same problem applies to times and places. A ticket may show the door opening time and the start time, or a departure and an arrival station. Extracting the right one requires linking each value to its label, and tests should include cases where these values differ.

09

Context matters

Humans read tickets using context: they know the event date is usually prominent, while the issue date is often in small print. Software can learn similar cues, but it should be tested to make sure it relies on the correct ones.

10

Testing responsibly

The NIST AI Risk Management Framework encourages developers to design tests that can reveal flawed reasoning. Including tickets where dates disagree is a simple way to do this.

11

Barcodes and QR codes

Many modern tickets carry barcodes or QR codes containing booking information. Reading these codes can be more reliable than reading printed text, but the codes may not include every detail, and older tickets may have none. A ticket reader may need to combine code data with printed text, and tests should check that both agree.

12

Small print

Dates in the terms and conditions can also confuse a reader.

13

Reprinted tickets

A ticket reprinted later shows a new issue date but keeps the original event date.

14

Human checks

Uncertain readings can be passed to a person to confirm.

15

Try the arithmetic

If a test set has 200 tickets and only 20 have different issue and event dates, a rule that always picks the issue date would still score 90 per cent, hiding a serious flaw.

16

The idea to take away

A ticket can carry several legible dates. Finding a date-shaped string is only the first step. Tests should include tickets where issue and event dates differ, so a wrong selection rule cannot appear correct.

FOLLOW THE EVIDENCE

Sources & further reading

Figures in the example are illustrative. Photograph: CeBIT Home 1998 student day ticket (back).JPG by See original collection record, CC BY-SA 3.0, via Wikimedia Commons; cropped and resized. Reference organisations do not endorse this website.