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.
This commit is contained in:
Kevin Rajan authored and bassem chagra committed 2026-11-14 12:38:32 +01:00
1 parent 71d853dff0
commit 5371f3ee70
4 files changed
+43 -9

No files matched your search

+16 -3
View File
@@ -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;
}
+21 -1
View File
@@ -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'));
});