feat: extract standard_name from title in flexoptix sync
Add parseStandardName(title) to derive standard from product name (SR, LR, ER, DR4, FR4, ZR+, etc.) since the V2 API has no protocol field. Apply to all future syncs. Companion SQL backfill added 1,072 more standard_names (total 2,281 / 29.8% FX coverage, up from 15.8%).
This commit is contained in:
parent
f4a5aa4361
commit
7ec26c04ac
@ -239,6 +239,20 @@ function inferWavelengthNm(...values: Array<string | null>): number | null {
|
|||||||
// ── Normalization ──────────────────────────────────────────────────────────
|
// ── Normalization ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
function parseStandardName(title: string | null): string | null {
|
||||||
|
if (!title) return null;
|
||||||
|
// Extract from first segment (before first " | ")
|
||||||
|
const seg = title.split(" | ")[0] ?? title;
|
||||||
|
// Try full IEEE form first: 10GBASE-SR, 100GBASE-DR4, etc.
|
||||||
|
const ieee = seg.match(/((?:\d+(?:\.\d+)?[TGM])?BASE[-/]\w+)/i);
|
||||||
|
if (ieee) return ieee[1].toUpperCase();
|
||||||
|
// Short-form standards — ordered longest-first to avoid partial matches
|
||||||
|
const m = seg.match(
|
||||||
|
/(OpenZR\+|ZR\+|ZX\+|DR4\+|LR4\+|SR10|SR8|LR8|ER8|DR8|VR8|SR4|LR4|ER4|FR4|DR4|CLR4|PLR4|PSM4|CWDM4|LRM|BX\w*|DR|LR|ER|SR|ZR|ZX|SX|LX|LH|EX|T)/
|
||||||
|
);
|
||||||
|
return m ? m[1] : null;
|
||||||
|
}
|
||||||
|
|
||||||
function parseCdrType(title: string | null): string | null {
|
function parseCdrType(title: string | null): string | null {
|
||||||
if (!title) return null;
|
if (!title) return null;
|
||||||
if (/dual[\s-]cdr/i.test(title)) return "dual_cdr";
|
if (/dual[\s-]cdr/i.test(title)) return "dual_cdr";
|
||||||
@ -433,7 +447,7 @@ async function importProduct(
|
|||||||
product.url ?? null,
|
product.url ?? null,
|
||||||
product.title,
|
product.title,
|
||||||
transceiverId,
|
transceiverId,
|
||||||
product.optics.protocol ?? null,
|
parseStandardName(product.title) ?? product.optics.protocol ?? null,
|
||||||
wdmType,
|
wdmType,
|
||||||
product.optics.cdrType ?? null,
|
product.optics.cdrType ?? null,
|
||||||
product.optics.protocolFamily ?? null,
|
product.optics.protocolFamily ?? null,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user