From 5371f3ee70f936ffcdbf67dc4dfde1efd09fefec Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Fri, 13 Nov 2026 03:19:15 -0600 Subject: [PATCH] fix(alpr): require explicit SharpV G3 before showing G3 specs Address gekh's P2 review of ch-bas's ALPR datasheet feature. Keep the vendored records verbatim, reject generation-ambiguous SharpV model tags, and cover G1/G2/G3 matching and the rendered card with node:test. Update the documented matched-camera count and changelog, preserving original author ch-bas and existing attribution. --- changelog.d/1360-alpr-model-specs.md | 4 ++-- docs/CURRENT-STATE.md | 7 ++++--- src/layers/alpr/modelSpecs.js | 19 ++++++++++++++++--- src/layers/alpr/modelSpecs.test.mjs | 22 +++++++++++++++++++++- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/changelog.d/1360-alpr-model-specs.md b/changelog.d/1360-alpr-model-specs.md index 2e34f02168..90addb2adb 100644 --- a/changelog.d/1360-alpr-model-specs.md +++ b/changelog.d/1360-alpr-model-specs.md @@ -1,5 +1,5 @@ - Mapped ALPR cameras whose OpenStreetMap `model` tag names known hardware (Motorola Solutions Vigilant, Genetec AutoVu, Axis, Verkada, Bosch MIC) show a datasheet spec line on their card, from 16 vendored CCTV Camera Database - records; unknown or mis-attributed models show nothing (bassem chagra, - @ch-bas, #1360). + records; unknown, generation-ambiguous or mis-attributed models show nothing + (bassem chagra, @ch-bas, #1360). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index dd5dfab20a..f1f2201e93 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -971,12 +971,13 @@ screen. Cyan camera badges use Manjunath's camera artwork; selection switches to larger coral badge with corner brackets and an animated tactical card. Numeric mapped bearings draw illustrative 90 m direction wedges (not measured coverage). A camera whose OSM `model` tag names known hardware (Motorola Solutions Vigilant, -Genetec AutoVu SharpV, Axis, Verkada, Bosch MIC; 459 of the 1,567 tagged cameras +Genetec AutoVu, Axis, Verkada, Bosch MIC; 408 of the 1,567 tagged cameras in October 2026) gets a `SPEC` line on its card from vendored datasheet records (`src/layers/alpr/modelSpecs.js`, matched with the CCTV layer's `createModelSpecLookup`). A `manufacturer` naming another maker rejects the -match, and the raw tag text is never shown. The hourly extract has no `model` -field yet, so only an Overpass-backed source fills it. +match, and the raw tag text is never shown. Unversioned `AutoVu SharpV` tags +cannot choose between G1/G2/G3 datasheets and show no specs. The hourly extract +has no `model` field yet, so only an Overpass-backed source fills it. The shared overlay paints gradients for at most 64 nearby cameras, promoting the selected camera; farther cameras keep native Cesium badges without wedges. Native ground-clamped wedges (a ground polyline plus a classification polygon per diff --git a/src/layers/alpr/modelSpecs.js b/src/layers/alpr/modelSpecs.js index 789b6fc4a5..33314531c1 100644 --- a/src/layers/alpr/modelSpecs.js +++ b/src/layers/alpr/modelSpecs.js @@ -7,8 +7,9 @@ * vendors the records for the models among them that the CCTV Camera Database * (https://github.com/ch-bas/cctv-camera-database, CC0-1.0) covers — * Motorola Solutions Vigilant, Genetec AutoVu, Axis, Verkada and Bosch MIC, - * which resolve 459 of those cameras — and resolves a camera's `model` (with - * its `manufacturer`) through the CCTV layer's matcher. The hourly extract the + * which resolve 408 of those cameras (excluding unversioned SharpV tags) — + * and resolves a camera's `model` (with its `manufacturer`) through the CCTV + * layer's matcher. The hourly extract the * layer reads by default does not publish `model` yet, so today only an * Overpass-backed source shows these specs. Flock Safety publishes no * datasheet resolution, so Flock models stay unresolved; an unknown model @@ -254,4 +255,16 @@ const RECORDS = [ * @param {string|null} [manufacturer] - The OSM `manufacturer` tag. * @returns {Object|null} The verbatim spec record, or null when unknown. */ -export const lookupAlprModelSpec = createModelSpecLookup(RECORDS); +const lookupDatasheetSpec = createModelSpecLookup(RECORDS); + +export function lookupAlprModelSpec(model, manufacturer) { + const spec = lookupDatasheetSpec(model, manufacturer); + // The dataset's unversioned SharpV label is tied to G3 hardware, but OSM + // tags may name G1 or G2. Require an explicit G3 or a G3 part number. + if ( + spec?.id === 'genetec-autovu-sharpv' && + !/\bg3\b/i.test(String(model || '')) + ) + return null; + return spec; +} diff --git a/src/layers/alpr/modelSpecs.test.mjs b/src/layers/alpr/modelSpecs.test.mjs index b33c1d879b..fb6d8fbd49 100644 --- a/src/layers/alpr/modelSpecs.test.mjs +++ b/src/layers/alpr/modelSpecs.test.mjs @@ -16,7 +16,10 @@ test('the model tags mappers write resolve to their datasheet record', () => { ['L5F', 'Motorola Solutions', 'motorola-solutions-l5f'], ['L6D', 'Motorola Solutions', 'motorola-solutions-l6d'], ['L6Q', null, 'motorola-solutions-l6q'], - ['AutoVu SharpV', 'Genetec', 'genetec-autovu-sharpv'], + ['AutoVu SharpV G3', 'Genetec', 'genetec-autovu-sharpv'], + ['AU-V-WS850-LC-G3-000', 'Genetec', 'genetec-autovu-sharpv'], + ['AutoVu SharpV G2', 'Genetec', 'genetec-autovu-sharpv-g2'], + ['AutoVu SharpV G1', 'Genetec', 'genetec-autovu-sharpv-g2'], ['Q1700-LE', 'Axis Communications', 'axis-q1700-le'], ['Q1800-LE', 'Axis Communications', 'axis-q1800-le'], ['CP63-E', 'Verkada Inc.', 'verkada-cp63-e'], @@ -42,6 +45,9 @@ test('unknown, mis-attributed or partial models stay unresolved', () => { ['Q1800', 'Axis Communications'], // Without a maker, a code-less product name is never trusted. ['AutoVu SharpV', null], + ['AutoVu SharpV', 'Genetec'], + ['AutoVu SharpV HD', 'Genetec'], + ['Genetec AutoVu SharpV', 'Genetec'], ['UnicamVELOCITY3', null], [null, 'Motorola Solutions'], ]) @@ -98,3 +104,17 @@ test('the card adds the datasheet line only for a resolved model', () => { ); assert.ok(unknown.every((line) => !/FALCON|SYSTEM|SPEC/.test(line))); }); + +test('unversioned SharpV does not display G3 specs on an ALPR card', () => { + const ambiguous = alprLabelDetails( + { manufacturer: 'Genetec', model: 'AutoVu SharpV' }, + OSM, + ); + assert.deepEqual(ambiguous, ['OSM MAPPED', 'GENETEC', 'PUBLIC MAP DATA']); + + const g3 = alprLabelDetails( + { manufacturer: 'Genetec', model: 'AutoVu SharpV G3' }, + OSM, + ); + assert.ok(g3.includes('SPEC GENETEC AUTOVU SHARPV · 1920X1200 · IR')); +});