Extends the Test Datasheet Pipeline on AD2:C:\Shares\testdatadb to
generate web-published datasheets for the SCMVAS-Mxxx (obsolete) and
SCMHVAS-Mxxxx (replacement) High Voltage Input Module product lines.
Both are tested either with the existing TESTHV3 software (production
VASLOG .DAT logs) or in Engineering with plain .txt output.
Key changes on AD2 (all deployed 2026-04-12 with dated backups):
- parsers/spec-reader.js: getSpecs() returns a `{_family:'SCMVAS',
_noSpecs:true}` sentinel for SCMVAS/SCMHVAS/VAS-M/HVAS-M model prefixes
so the export pipeline does not silently skip them for missing specs.
- templates/datasheet-exact.js: new Accuracy-only template branch
(generateSCMVASDatasheet + helpers) that mirrors the existing shipped
format byte-for-byte. Extraction regex covers both QuickBASIC STR$()
output formats: scientific-with-trailing-status-digit (98.4% of
records) and plain-decimal (1.6% of records above QB's threshold).
- parsers/vaslog-engtxt.js (new): parses the Engineering-Tested .txt
files in TS-3R\LOGS\VASLOG\VASLOG - Engineering Tested\. Filename SN
regex strips optional trailing 14-digit timestamp; in-file "SN:"
header is the authoritative source when the filename is malformed.
- database/import.js: LOG_TYPES grows a VASLOG_ENG entry with
subfolder + recursive flags. Pre-existing 7 log types keep their
implicit recursive=true behaviour (config.recursive !== false).
importFiles() routes VASLOG_ENG paths before the generic loop so a
VASLOG - Engineering Tested/*.txt path does not mis-dispatch to the
multiline parser.
- database/export-datasheets.js: VASLOG_ENG records are written
verbatim via fs.copyFileSync(source_file, For_Web/<SN>.TXT) for true
byte-level pass-through, with a graceful raw_data fallback when the
source file is no longer on disk.
Deploy outcome:
- 27,503 SCMVAS/SCMHVAS datasheets rendered (27,065 from scientific +
438 from plain-decimal PASS lines, post-patch rerun)
- 434 Engineering-Tested .txt files pass-through-copied to For_Web
- 0 errors across both batches
Repo layout added here:
- scmvas-hvas-research/: discovery artifacts (source .BAS, hvin.dat,
sample .DAT + .txt, binary-format notes, IMPLEMENTATION_PLAN.md)
- implementation/: staged final code + deploy helpers + local test
harness + per-step verification scripts
- backups/pre-deploy-20260412/: independent local snapshot of the 4
AD2 files replaced, pulled byte-for-byte before deploy
All helper scripts fetch the AD2 password at runtime from the SOPS
vault (clients/dataforth/ad2.sops.yaml). None of the committed files
contain the plaintext credential. Known vault-entry hygiene issue
(stale shell-escape backslash before the `!`) is documented in the
fetcher comments and stripped at read-time; flagged separately for
cleanup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
55 lines
2.5 KiB
SQL
55 lines
2.5 KiB
SQL
-- Test Data Database Schema
|
|
-- SQLite database for storing and searching test records
|
|
|
|
-- Main test records table
|
|
CREATE TABLE IF NOT EXISTS test_records (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
log_type TEXT NOT NULL, -- DSCLOG, 5BLOG, 7BLOG, 8BLOG, PWRLOG, SCTLOG, VASLOG, SHT
|
|
model_number TEXT NOT NULL, -- DSCA38-1793, SCM5B30-01, etc.
|
|
serial_number TEXT NOT NULL, -- 176923-1, 105840-2, etc.
|
|
test_date TEXT NOT NULL, -- Test date (YYYY-MM-DD format)
|
|
test_station TEXT, -- TS-1L, TS-3R, etc.
|
|
overall_result TEXT, -- PASS/FAIL
|
|
raw_data TEXT, -- Full original record
|
|
source_file TEXT, -- Original file path
|
|
import_date TEXT DEFAULT (datetime('now')),
|
|
datasheet_exported_at TEXT DEFAULT NULL,
|
|
forweb_exported_at TEXT DEFAULT NULL,
|
|
UNIQUE(log_type, model_number, serial_number, test_date, test_station)
|
|
);
|
|
|
|
-- Indexes for fast searching
|
|
CREATE INDEX IF NOT EXISTS idx_serial ON test_records(serial_number);
|
|
CREATE INDEX IF NOT EXISTS idx_model ON test_records(model_number);
|
|
CREATE INDEX IF NOT EXISTS idx_date ON test_records(test_date);
|
|
CREATE INDEX IF NOT EXISTS idx_model_serial ON test_records(model_number, serial_number);
|
|
CREATE INDEX IF NOT EXISTS idx_result ON test_records(overall_result);
|
|
CREATE INDEX IF NOT EXISTS idx_log_type ON test_records(log_type);
|
|
|
|
-- Full-text search virtual table
|
|
CREATE VIRTUAL TABLE IF NOT EXISTS test_records_fts USING fts5(
|
|
serial_number,
|
|
model_number,
|
|
raw_data,
|
|
content='test_records',
|
|
content_rowid='id'
|
|
);
|
|
|
|
-- Triggers to keep FTS index in sync
|
|
CREATE TRIGGER IF NOT EXISTS test_records_ai AFTER INSERT ON test_records BEGIN
|
|
INSERT INTO test_records_fts(rowid, serial_number, model_number, raw_data)
|
|
VALUES (new.id, new.serial_number, new.model_number, new.raw_data);
|
|
END;
|
|
|
|
CREATE TRIGGER IF NOT EXISTS test_records_ad AFTER DELETE ON test_records BEGIN
|
|
INSERT INTO test_records_fts(test_records_fts, rowid, serial_number, model_number, raw_data)
|
|
VALUES ('delete', old.id, old.serial_number, old.model_number, old.raw_data);
|
|
END;
|
|
|
|
CREATE TRIGGER IF NOT EXISTS test_records_au AFTER UPDATE ON test_records BEGIN
|
|
INSERT INTO test_records_fts(test_records_fts, rowid, serial_number, model_number, raw_data)
|
|
VALUES ('delete', old.id, old.serial_number, old.model_number, old.raw_data);
|
|
INSERT INTO test_records_fts(rowid, serial_number, model_number, raw_data)
|
|
VALUES (new.id, new.serial_number, new.model_number, new.raw_data);
|
|
END;
|