How to map UN/LOCODE without losing the exact freight stop
Store the trade location code and the actual facility separately. A valid location code does not necessarily identify the terminal, warehouse or gate where the vehicle needs to arrive.
Map trading location, facility and shipment stop separately.
The UNECE directory documentation distinguishes the location code, function, status and other attributes. Pin the code-list release and validate the country and location together. Keep the facility ID from the terminal or partner separately, and link both to the applicable stop in your shipment.
Do not turn every port code into a precise GPS or gate instruction. Treat subordinate codes, partner-specific facility IDs and addresses as separate facts unless the source explicitly equates them.
Two terminals can share a parent location without sharing a booking.
A synthetic booking is moved from terminal East to terminal West in the same port area. The broader location may remain the same, but the facility reference, arrival instructions and booking can change. Keep the original facility in the history and resolve the selected delivery to the new stop.
Catch mappings that are valid in format but wrong in context.
- Valid code, wrong function: check the partner’s expected location function rather than matching by place name.
- Unknown terminal: retain the broader location and ask for the facility ID; do not invent a more specific code.
- Release change: compare the old and new list, and send changed or ambiguous mappings for review before using them on future movements.