fix(tools): count AIS ship type 0 as unknown in vessel breakdowns

AIS type 0 means "not available" (ITU-R M.1371), but the source keeps it
as '0', so group_by: 'type' listed "0" as a type and understated
unknown_count. vessels_in_area rows now report it as null, and a
regression fixture mixes type 0 with Cargo and Tanker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
quanticsoul4772andClaude Opus 5.5 committed 2026-10-16 12:06:10 -07:00
1 parent acd75efc7c
commit 52863a9f42
2 files changed
+42 -1

No files matched your search

+7 -1
View File
@@ -32,6 +32,12 @@ const ALL_VESSELS = 1_000_000;
const round = (value, digits) =>
Number.isFinite(value) ? Number(value.toFixed(digits)) : null;
const text = (value) => (typeof value === 'string' && value ? value : null);
// AIS ship type 0 is "not available" (ITU-R M.1371); the source keeps it as
// '0', so it is reported as unknown rather than counted as a type.
const vesselType = (value) => {
const type = text(value);
return type === '0' ? null : type;
};
function vesselRow(record, from) {
const point = { lat: record.latitude, lon: record.longitude };
@@ -39,7 +45,7 @@ function vesselRow(record, from) {
mmsi: record.id,
name: text(record.name),
imo: text(record.imo),
type: text(record.type),
type: vesselType(record.type),
destination: text(record.destination),
lat: round(record.latitude, 5),
lon: round(record.longitude, 5),