If you have ever tried to build a parser for the IATA Cargo-IMP FWB message, you know that some sections are straightforward and some are not. The AWB number section is a simple 11-digit field. The routing section is three or four IATA airport codes. But then there is RTD — the Rate Description section — and everything changes.
RTD is where the commercial details of the shipment live: how many pieces, how much they weigh, what rate class applies, what the commodity code is, and what the total charge comes to. It sounds simple until you learn that a single AWB can have up to 11 separate RTD line items, each containing up to 12 distinct sub-elements, with conditional fields that appear or disappear based on the rate class, and free-text nature-of-goods descriptions that can span multiple continuation lines.
This article explains why RTD is the most complex section in the FWB standard, what makes it hard to parse reliably, and how KabyTech's approach achieves 97%+ extraction accuracy on RTD data.
Each RTD repetition (line item) contains the following sub-elements, as defined in the IATA Cargo-IMP standard:
A simple shipment — one commodity type, one rate class — has a single RTD line. But a consolidated shipment might have 8, 9, or even the maximum 11 RTD lines, each with different rate classes and commodity codes. The parser must correctly identify where one RTD repetition ends and the next begins, without any explicit delimiter between them in many AWB document formats.
In raw FWB Cargo-IMP text messages, the line structure provides some guidance. But in scanned or PDF-based AWBs, the RTD data often appears as a table where row boundaries are determined by visual spacing rather than explicit markers. OCR systems frequently misidentify row breaks, especially when nature-of-goods descriptions wrap to multiple lines.
The presence or absence of fields depends on the rate class code. A rate class M (minimum) line has no commodity number and may have no weight field. A rate class U (ULD) line includes ULD type and serial number fields that do not exist in other rate classes. A rate class C (specific commodity) line includes a commodity item number that other classes omit.
This means the parser cannot apply a fixed template to extract RTD fields. It must first identify the rate class, then determine which fields to expect, and only then attempt extraction. If the rate class itself is misread — an "M" OCR'd as "W", for example — the entire line's extraction will fail because the parser is looking for fields that do not exist.
The nature-of-goods description (NG) for each RTD line can span up to 11 continuation lines. These continuation lines look very different in different AWB formats. In some formats, they are indented. In others, they are flush left. In some scanned documents, they appear in a separate column. The parser must determine whether a line of text is a continuation of the previous NG description or the start of a new RTD repetition.
Consider this example from a real AWB: a shipment of "FRESH DURIAN MONTHONG GRADE AA PACKED IN STYROFOAM BOXES WITH GEL PACKS". That description spans three lines on a standard AWB form. If the parser mistakes the second or third line for a new RTD entry, it will corrupt both the nature-of-goods field and the subsequent rate data.
Weight and rate fields appear in different numeric formats across AWB documents. Some use periods as decimal separators; others use commas. Some include thousands separators; others do not. Some pad with leading zeros; others do not. The chargeable weight might appear as "380.5", "380,5", "0380.50", or "380.500" depending on the source system that generated the AWB.
The total charge field is especially problematic because it serves as a cross-check: total should equal chargeable weight multiplied by rate. But rounding rules vary between carriers, so a parser that extracts weight as 380.5 and rate as 2.45 might expect a total of 932.23, while the actual printed total is 932.20 due to the carrier rounding down. The parser must be tolerant of these rounding differences while still catching genuine extraction errors.
RTD charges can be expressed in different currencies across different line items within the same AWB (though this is rare). More commonly, the weight unit (kilograms vs. pounds) is declared once in the CVD section but must be consistently applied across all RTD lines. If the parser loses track of the weight unit context, every weight value in the RTD section will be misinterpreted.
Our approach to RTD parsing uses three layers of extraction logic:
Before extracting any values, we analyze the visual or textual structure of the RTD block to identify repetition boundaries. For text-based FWB messages, this uses the standard IATA line identifiers. For scanned/PDF documents, we use a layout analysis model that identifies the tabular structure of the rate description area and maps each visual row to an RTD repetition.
Once repetition boundaries are established, we extract the rate class code first. This determines the field template for the rest of the line. We use a specialized character recognition model for the rate class field because it is a single character whose misidentification cascades into downstream extraction failures. Our rate class recognition accuracy is 99.4%.
After extracting all RTD lines, we run three validation checks:
When a validation check fails, the system flags the specific RTD line for human review rather than silently passing incorrect data downstream. In our production data across Thai customers, approximately 2.3% of AWBs require human review of at least one RTD field — overwhelmingly due to genuinely ambiguous source documents rather than parser errors.
Thai air freight has some specific characteristics that make RTD parsing especially important. Perishable exports (fruits, seafood, orchids) frequently use specific commodity rates (rate class C), which means the commodity item number field is present and must be correctly extracted. Agricultural consolidations often have 5-8 RTD lines for different product types within a single shipment. And the nature-of-goods descriptions for Thai agricultural products tend to be long and detailed because they include grade designations, packaging descriptions, and sometimes Thai-language text mixed with English.
This is exactly the kind of complexity where automated parsing delivers the most value. A human operator spending 5 minutes per RTD line on an 8-line AWB is spending 40 minutes just on rate description data. KabyTech extracts all 8 lines in under 2 seconds, with accuracy that matches or exceeds manual entry.
Upload a sample AWB and see how KabyTech extracts every RTD line item. Free trial, no credit card.