The Prefixed Field
Airport codes feel like the kind of identifier that should end arguments: short, standardised and printed on every boarding pass, so two systems listi...
Airport codes feel like the kind of identifier that should end arguments: short, standardised and printed on every boarding pass, so two systems listing the same airports ought to line up without effort. In practice, aviation works with more than one code system at once, related in a treacherous way: the longer code contains the shorter one inside it. When one source lists airports in three-letter codes and another mixes those with lowercase spellings and longer prefixed forms, a naive comparison loses most of the catalogue — including half of it hidden inside perfectly good longer codes.
What The Prefixed Field means
The Prefixed Field is an identifier written in an extended form created by placing a prefix in front of a shorter base code, so that the extended value literally contains the base value as its ending. Matching the two forms is not a matter of correcting a typo or a formatting habit; the values belong to two related code systems, and the relationship between them is positional. The final characters of the long form are the short form. Any comparison that insists on whole-string equality will treat the pair as unrelated, while any comparison that searches carelessly inside strings risks pairing values that merely share an ending by coincidence.
The concept should not be confused with The Three-Shaped Country. That concept described one country written in three shapes under a single standard — alpha-2, alpha-3 or numeric ISO codes — where each shape is a separate, unrelated string that must be looked up in a table. The Prefixed Field involves two shapes rather than three, and no lookup table is needed to relate them, because the longer form literally contains the shorter one as its tail. A country code in one shape reveals nothing about its other shapes; a prefixed airport code carries its base code visibly inside itself, which is both the clue that repair is possible and the reason careless substring matching is dangerous.
Two code systems in one measurement
The measurement covered 300 distinct airports (Source: batch 22 SD measurement results, group AM3). Source A identifies every airport by an IATA-style three-letter code. Source B identifies the same 300 airports in three different ways: 100 in the same three-letter form as source A, 50 in lowercase, and 150 in a four-letter prefixed form, where a regional prefix letter stands before the same three letters, in the style of ICAO codes (Source: batch 22 SD measurement results, group AM3).
The mixture is realistic because both code families are legitimate and widely used. Three-letter codes dominate passenger-facing contexts, while four-letter codes dominate operational and navigational contexts, and data passing between those worlds often arrives in whichever form the sending system preferred. Half of source B uses the prefixed form, so this is not an edge case affecting a handful of rows. The dominant representation in one source is entirely absent from the other, and any reconciliation method has to confront that fact directly rather than treating it as noise.
Exact matching and the case fold
An exact join between the two sources matched 100 of 300 airports (Source: batch 22 SD measurement results, group AM3). Those 100 are exactly the block source B stored in the same uppercase three-letter form as source A. The lowercase block failed on case alone, and the prefixed block failed on length, so two quite different problems hid inside one disappointing total.
Case-folding both sides before joining matched 150 of 300 airports (Source: batch 22 SD measurement results, group AM3). The gain of 50 is precisely the lowercase block, recovered in full, which confirms that case was its only defect. Just as instructively, case-folding gained nothing at all from the 150 prefixed rows. Folding changes letter case; it cannot shorten a string. The result separates the measurement cleanly into a solved half and an untouched half, and shows why reporting a single match rate for a mixed-format column can mislead: the column did not have one problem at half strength, but two problems of completely different kinds.
A prefix-aware parse completes the match
The final strategy parsed source B values with knowledge of the prefix structure: when a four-letter value's final three letters formed a known three-letter code from source A, the regional prefix was stripped and the remainder was used for matching. That prefix-aware parse matched 300 of 300 airports, with 0 false-merge pairs (Source: batch 22 SD measurement results, group AM3). Every prefixed row resolved to its airport, and no row was merged into the wrong airport on the way.
The guard condition separates this repair from naive substring matching. The prefix was not stripped blindly from every long value, and the last three letters were not accepted merely for looking like a code: the remainder had to be a known three-letter code in the reference set. That check kept false merges at zero, because it prevents a long value whose tail coincides with some code by accident from being forced into a pairing. Where codes can genuinely collide across regions, the same guard turns a tempting shortcut into a defensible rule.
How the measurement was assembled and how to repair prefixed codes
Nothing in this exercise was measured on a commercial product: it is a synthetic construction, rebuilt deterministically from fixed rules, and its joins were computed by parsing code written for the exercise itself. Three hundred distinct airports were assigned three-letter codes in source A, and source B was then built by fixed rules: one block copied unchanged, one block lowercased, and one block rewritten in four-letter prefixed form by adding a regional prefix letter to the same three letters. Each strategy — exact join, case-folded join, and prefix-aware parse — was applied to the same pair of sources, and both matches and false-merge pairs were counted against the known construction. Rebuilding the same sources and applying the same rules reproduces the counts of 100, 150 and 300 exactly.
For real data, the repair sequence follows the structure of the problem. Diagnose by length and case before choosing tools: group unmatched values by shape, because a column failing for two reasons needs two repairs in the right order. Fold case first, since it is cheap and safe. Then handle length differences with a parse that knows the code systems involved, validating the stripped remainder against the reference list of known codes rather than accepting any plausible tail. Record which rows each rule repaired, and keep the original values, because the prefixed form carries regional information the base code lacks; discarding it would trade a join problem today for information loss tomorrow. Count false merges alongside matches at every step: a strategy reporting 300 matches while hiding its false pairings has demonstrated an appetite, not a repair.
Questions, answered
Why did the exact join match only 100 of the 300 airports? Only the 100 rows that source B stored in the identical uppercase three-letter form could match exactly. The 50 lowercase rows differed by case, and the 150 prefixed rows differed by length, so the exact join stopped at 100 of 300 (Source: batch 22 SD measurement results, group AM3).
What did case-folding fix, and what did it leave untouched? Case-folding recovered the lowercase block, raising the total to 150 of 300 (Source: batch 22 SD measurement results, group AM3). It changed nothing for the prefixed rows, because folding alters case and cannot remove a leading letter.
How does a prefix-aware parse work? For a four-letter value, the parse removes the regional prefix letter and checks whether the remaining three letters form a known three-letter code. When they do, the row is matched on that remainder. Applied across source B, this matched 300 of 300 with 0 false-merge pairs (Source: batch 22 SD measurement results, group AM3).
Why not simply match on the last three characters of every code? Because a tail can coincide with a real code by accident. Matching every value on its final three characters, without checking the remainder against the known code list, invites false merges between different airports. The measurement's parse stripped the prefix only when the remainder was a known code, which is why it could reach 300 matches while keeping false merges at 0 (Source: batch 22 SD measurement results, group AM3).
Summary
The Prefixed Field arises when one source writes airport codes in three letters and another writes half of them in a four-letter form that contains the three-letter code as its tail. Exact matching found 100 of 300 airports, case-folding found 150 by repairing the lowercase block, and a prefix-aware parse that validated each stripped remainder against the known codes found all 300 with no false merges. The broader lesson is to diagnose identifier mismatches by shape: case problems and structure problems look identical in a single match rate, but they need entirely different repairs.
Sources
- Batch 22 SD measurement results, group AM3.