elementref commited on
Commit
0ef3796
·
verified ·
1 Parent(s): fa1ba7a

Add static lookup app and dataset CSV files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ cross-references-1.csv filter=lfs diff=lfs merge=lfs -text
37
+ cross-references-2.csv filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,12 +1,20 @@
1
  ---
2
- title: Hydraulic Filter Elements Explorer
3
- emoji: 🔥
4
- colorFrom: green
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
8
  license: mit
9
  short_description: Look up hydraulic filter SKUs and graded cross-references
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Hydraulic Filter Element Explorer
3
+ emoji: 🛢️
4
+ colorFrom: gray
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
  license: mit
9
  short_description: Look up hydraulic filter SKUs and graded cross-references
10
  ---
11
 
12
+ # ElementRef Hydraulic Filter Element Explorer
13
+
14
+ A free static lookup for the open [ElementRef hydraulic filter element dataset](https://huggingface.co/datasets/elementref/hydraulic-filter-elements) (CC BY 4.0).
15
+
16
+ Enter a part number to see catalog specifications and graded cross-references (`full`, `partial`, or `verify`). This Space does not replace the canonical deposit.
17
+
18
+ **Canonical citation:** [https://doi.org/10.5281/zenodo.23132845](https://doi.org/10.5281/zenodo.23132845)
19
+
20
+ Also listed at [elementref.com/open-data](https://elementref.com/open-data/).
cross-references-1.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca5331b94d373d81864aa24dc724ace1650358c66b946401e935189a3c0e1138
3
+ size 14109412
cross-references-2.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1424c7d01e61974cacbd4cd8bc7b186aeb5f1f62c9645cd41fb1d52d5e5ff509
3
+ size 10638378
cross-references-3.csv ADDED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -1,19 +1,194 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Hydraulic Filter Element Explorer</title>
7
+ <style>
8
+ :root {
9
+ --bg: #f6f7f9;
10
+ --card: #fff;
11
+ --text: #1c1f26;
12
+ --muted: #5b6370;
13
+ --line: #e3e6eb;
14
+ --accent: #1f4b8a;
15
+ }
16
+ * { box-sizing: border-box; }
17
+ body {
18
+ margin: 0;
19
+ font-family: Georgia, "Times New Roman", serif;
20
+ background: var(--bg);
21
+ color: var(--text);
22
+ line-height: 1.5;
23
+ }
24
+ main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
25
+ h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.75rem; }
26
+ p.lead, p.meta, #status { color: var(--muted); }
27
+ p.meta { font-size: 0.95rem; }
28
+ a { color: var(--accent); }
29
+ form { display: flex; gap: 0.5rem; margin: 1.25rem 0 0.75rem; flex-wrap: wrap; }
30
+ input[type="search"] {
31
+ flex: 1 1 280px;
32
+ font: inherit;
33
+ padding: 0.65rem 0.8rem;
34
+ border: 1px solid var(--line);
35
+ border-radius: 6px;
36
+ background: var(--card);
37
+ }
38
+ button {
39
+ font: inherit;
40
+ padding: 0.65rem 1.1rem;
41
+ border: 0;
42
+ border-radius: 6px;
43
+ background: var(--accent);
44
+ color: #fff;
45
+ cursor: pointer;
46
+ }
47
+ button:disabled { opacity: 0.6; cursor: not-allowed; }
48
+ section { margin-top: 1.5rem; }
49
+ h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
50
+ .table-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
51
+ table { border-collapse: collapse; width: 100%; font-family: system-ui, sans-serif; font-size: 0.85rem; }
52
+ th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
53
+ th { background: #eef2f7; position: sticky; top: 0; }
54
+ td.wrap { white-space: normal; min-width: 12rem; }
55
+ </style>
56
+ </head>
57
+ <body>
58
+ <main>
59
+ <h1>Hydraulic Filter Element Explorer</h1>
60
+ <p class="lead">Look up part numbers in the open ElementRef hydraulic filter element dataset (CC BY 4.0): catalog specifications plus graded cross-references (<code>full</code>, <code>partial</code>, or <code>verify</code>).</p>
61
+ <p class="meta">Canonical citation: <a href="https://doi.org/10.5281/zenodo.23132845">https://doi.org/10.5281/zenodo.23132845</a>
62
+ · <a href="https://huggingface.co/datasets/elementref/hydraulic-filter-elements">Dataset on Hugging Face</a>
63
+ · <a href="https://elementref.com/open-data/">Open data page</a></p>
64
+ <form id="search-form">
65
+ <input id="query" type="search" placeholder="For example: 0060 R 003 BN4HC or HC2208FCP4H" aria-label="Part number or brand" />
66
+ <button id="search-btn" type="submit" disabled>Search</button>
67
+ </form>
68
+ <p id="status">Loading dataset files…</p>
69
+ <section>
70
+ <h2>Matching SKUs</h2>
71
+ <div class="table-wrap"><table id="sku-table"><thead></thead><tbody></tbody></table></div>
72
+ </section>
73
+ <section>
74
+ <h2>Graded cross-references</h2>
75
+ <div class="table-wrap"><table id="xref-table"><thead></thead><tbody></tbody></table></div>
76
+ </section>
77
+ </main>
78
+ <script>
79
+ const SKU_COLUMNS = ["model","brand","series","category","filter_type","media","micron","micron_basis","beta","od_mm","id_mm","length_mm","end_cap","collapse_bar","bypass_bar","seal_material","confidence"];
80
+ const XREF_COLUMNS = ["model_a","model_b","match_level","conflict","sources"];
81
+ const statusEl = document.getElementById("status");
82
+ const buttonEl = document.getElementById("search-btn");
83
+ let skus = [];
84
+ let xrefs = [];
85
+
86
+ function parseCsv(text) {
87
+ const rows = [];
88
+ let row = [];
89
+ let cell = "";
90
+ let inQuotes = false;
91
+ for (let i = 0; i < text.length; i++) {
92
+ const c = text[i];
93
+ if (inQuotes) {
94
+ if (c === '"') {
95
+ if (text[i + 1] === '"') { cell += '"'; i++; }
96
+ else inQuotes = false;
97
+ } else cell += c;
98
+ } else if (c === '"') inQuotes = true;
99
+ else if (c === ",") { row.push(cell); cell = ""; }
100
+ else if (c === "\n") { row.push(cell); rows.push(row); row = []; cell = ""; }
101
+ else if (c !== "\r") cell += c;
102
+ }
103
+ if (cell.length || row.length) { row.push(cell); rows.push(row); }
104
+ if (!rows.length) return [];
105
+ const headers = rows[0];
106
+ return rows.slice(1).filter(r => r.some(v => v)).map(r => {
107
+ const obj = {};
108
+ headers.forEach((h, idx) => { obj[h] = r[idx] || ""; });
109
+ return obj;
110
+ });
111
+ }
112
+
113
+ function renderTable(table, columns, records, wrapCols) {
114
+ const thead = table.querySelector("thead");
115
+ const tbody = table.querySelector("tbody");
116
+ thead.innerHTML = "<tr>" + columns.map(c => "<th>" + c + "</th>").join("") + "</tr>";
117
+ tbody.innerHTML = "";
118
+ const frag = document.createDocumentFragment();
119
+ for (const rec of records) {
120
+ const tr = document.createElement("tr");
121
+ for (const c of columns) {
122
+ const td = document.createElement("td");
123
+ if (wrapCols && wrapCols.has(c)) td.className = "wrap";
124
+ td.textContent = rec[c] || "";
125
+ tr.appendChild(td);
126
+ }
127
+ frag.appendChild(tr);
128
+ }
129
+ tbody.appendChild(frag);
130
+ }
131
+
132
+ function compact(s) { return (s || "").toLowerCase().replace(/[^a-z0-9]+/g, ""); }
133
+
134
+ function search(query) {
135
+ const q = (query || "").trim();
136
+ if (!q) {
137
+ renderTable(document.getElementById("sku-table"), SKU_COLUMNS, []);
138
+ renderTable(document.getElementById("xref-table"), XREF_COLUMNS, []);
139
+ statusEl.textContent = "Enter a part number or brand to search.";
140
+ return;
141
+ }
142
+ const needle = q.toLowerCase();
143
+ const packed = compact(q);
144
+ const skuHits = skus.filter(r => (r._q && r._q.includes(needle)) || (packed && r._n === packed));
145
+ const xrefHits = xrefs.filter(r => (r._a && r._a.includes(needle)) || (r._b && r._b.includes(needle)) || (packed && (r._an === packed || r._bn === packed)));
146
+ renderTable(document.getElementById("sku-table"), SKU_COLUMNS, skuHits.slice(0, 50), new Set(["media","beta"]));
147
+ renderTable(document.getElementById("xref-table"), XREF_COLUMNS, xrefHits.slice(0, 100));
148
+ statusEl.textContent = "Found " + skuHits.length.toLocaleString() + " matching SKU(s) (showing up to 50) and " + xrefHits.length.toLocaleString() + " cross-reference pair(s) (showing up to 100).";
149
+ }
150
+
151
+ async function loadCsv(path) {
152
+ const res = await fetch(path);
153
+ if (!res.ok) throw new Error("Could not load " + path + " (" + res.status + ")");
154
+ return parseCsv(await res.text());
155
+ }
156
+
157
+ async function init() {
158
+ try {
159
+ statusEl.textContent = "Loading SKU catalog…";
160
+ skus = await loadCsv("./skus-all.csv");
161
+ skus.forEach(r => {
162
+ r._q = ((r.model || "") + " " + (r.normalized || "") + " " + (r.brand || "")).toLowerCase();
163
+ r._n = compact(r.normalized || r.model);
164
+ });
165
+ statusEl.textContent = "Loading cross-references…";
166
+ const parts = await Promise.all([
167
+ loadCsv("./cross-references-1.csv"),
168
+ loadCsv("./cross-references-2.csv"),
169
+ loadCsv("./cross-references-3.csv")
170
+ ]);
171
+ xrefs = parts.flat();
172
+ xrefs.forEach(r => {
173
+ r._a = (r.model_a || "").toLowerCase();
174
+ r._b = (r.model_b || "").toLowerCase();
175
+ r._an = compact(r.model_a);
176
+ r._bn = compact(r.model_b);
177
+ });
178
+ buttonEl.disabled = false;
179
+ statusEl.textContent = "Dataset files loaded. Search a part number to begin.";
180
+ } catch (err) {
181
+ statusEl.textContent = "Could not load the dataset files: " + err.message;
182
+ }
183
+ }
184
+
185
+ document.getElementById("search-form").addEventListener("submit", (e) => {
186
+ e.preventDefault();
187
+ search(document.getElementById("query").value);
188
+ });
189
+ renderTable(document.getElementById("sku-table"), SKU_COLUMNS, []);
190
+ renderTable(document.getElementById("xref-table"), XREF_COLUMNS, []);
191
+ init();
192
+ </script>
193
+ </body>
194
  </html>
skus-all.csv ADDED
The diff for this file is too large to render. See raw diff