SmartQHSE commited on
Commit
7ed006f
·
1 Parent(s): 854a3af

publish: HSE Term Lookup space

Browse files
Files changed (2) hide show
  1. README.md +17 -5
  2. index.html +111 -18
README.md CHANGED
@@ -1,10 +1,22 @@
1
  ---
2
- title: Hse Term Lookup
3
- emoji: 🏃
4
- colorFrom: pink
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: HSE Term Lookup
3
+ emoji: 🔍
4
+ colorFrom: gray
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ license: cc-by-4.0
9
+ short_description: Searchable HSE / occupational-safety glossary
10
  ---
11
 
12
+ # HSE Term Lookup
13
+
14
+ Static HF Space — searchable HSE / occupational-safety glossary. Live data from
15
+ [SmartQHSE Open API](https://www.smartqhse.com/api/v1/glossary). CC BY 4.0.
16
+
17
+ Companion to the open dataset
18
+ [SmartQHSE/hse-glossary](https://huggingface.co/datasets/SmartQHSE/hse-glossary)
19
+ and the broader
20
+ [SmartQHSE Open HSE Data collection](https://huggingface.co/collections/SmartQHSE/smartqhse-open-hse-data-69f7597712196f8018c2dab5).
21
+
22
+ Built by [SmartQHSE](https://www.smartqhse.com) — the AI-native HSE/QHSE platform.
index.html CHANGED
@@ -1,19 +1,112 @@
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.0" />
6
+ <title>HSE Term Lookup — SmartQHSE</title>
7
+ <meta name="description" content="Searchable HSE / occupational-safety glossary — TRIR, LTIFR, ALARP, OSHA, hierarchy of controls, permit-to-work. CC BY 4.0. Powered by SmartQHSE." />
8
+ <style>
9
+ * { box-sizing: border-box; }
10
+ body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #fafaf9; color: #191919; line-height: 1.55; }
11
+ header { background: #191919; color: white; padding: 32px 24px; text-align: center; }
12
+ header h1 { margin: 0 0 8px 0; font-size: 28px; font-weight: 700; }
13
+ header p { margin: 0 auto; opacity: 0.75; font-size: 14px; max-width: 600px; }
14
+ header a { color: #0B998C; text-decoration: none; }
15
+ main { max-width: 900px; margin: 0 auto; padding: 24px; }
16
+ .search { width: 100%; padding: 14px 18px; font-size: 16px; border: 1px solid #e5e5e5; border-radius: 12px; margin-bottom: 24px; outline: none; background: white; }
17
+ .search:focus { border-color: #0B998C; box-shadow: 0 0 0 3px rgba(11,153,140,0.1); }
18
+ .stats { font-size: 13px; color: #6B6B6B; margin-bottom: 16px; }
19
+ .term-card { background: white; border: 1px solid #e5e5e5; border-radius: 12px; padding: 20px 24px; margin-bottom: 14px; }
20
+ .term-card:hover { border-color: #0B998C; }
21
+ .term-name { font-weight: 700; font-size: 18px; color: #191919; margin: 0 0 4px 0; }
22
+ .term-aliases { font-size: 12px; color: #6B6B6B; margin-bottom: 10px; font-family: ui-monospace, monospace; }
23
+ .term-def { font-size: 14px; color: #37352F; margin: 0; }
24
+ .term-meta { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f0f0f0; font-size: 12px; }
25
+ .term-meta a { color: #0B998C; text-decoration: none; }
26
+ .term-meta a:hover { text-decoration: underline; }
27
+ .empty { text-align: center; color: #6B6B6B; padding: 40px; }
28
+ footer { text-align: center; padding: 32px 24px; color: #6B6B6B; font-size: 13px; border-top: 1px solid #e5e5e5; margin-top: 40px; }
29
+ footer a { color: #0B998C; text-decoration: none; }
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <header>
34
+ <h1>HSE Term Lookup</h1>
35
+ <p>Searchable HSE / occupational-safety glossary — definitions, formulas, authoritative sources. Live data from <a href="https://www.smartqhse.com/api/v1/glossary">SmartQHSE Open API</a>. CC BY 4.0.</p>
36
+ </header>
37
+ <main>
38
+ <input type="search" class="search" id="q" placeholder="Search: TRIR, LTIFR, ALARP, OSHA, permit-to-work…" autofocus />
39
+ <div class="stats" id="stats">Loading glossary…</div>
40
+ <div id="results"></div>
41
+ </main>
42
+ <footer>
43
+ <p>Built by <a href="https://www.smartqhse.com">SmartQHSE</a> — the AI-native HSE/QHSE platform.<br />Open dataset: <a href="https://huggingface.co/datasets/SmartQHSE/hse-glossary">SmartQHSE/hse-glossary</a> · <a href="https://huggingface.co/collections/SmartQHSE/smartqhse-open-hse-data-69f7597712196f8018c2dab5">SmartQHSE Open HSE Data Collection</a></p>
44
+ </footer>
45
+ <script>
46
+ let TERMS = [];
47
+
48
+ function el(tag, attrs, children) {
49
+ const node = document.createElement(tag);
50
+ if (attrs) for (const k in attrs) {
51
+ if (k === "class") node.className = attrs[k];
52
+ else if (k === "href" || k === "target" || k === "rel") node.setAttribute(k, attrs[k]);
53
+ else node.setAttribute(k, attrs[k]);
54
+ }
55
+ if (children !== undefined) {
56
+ if (Array.isArray(children)) for (const c of children) {
57
+ if (c == null) continue;
58
+ node.appendChild(typeof c === "string" ? document.createTextNode(c) : c);
59
+ } else if (typeof children === "string") {
60
+ node.textContent = children;
61
+ } else node.appendChild(children);
62
+ }
63
+ return node;
64
+ }
65
+
66
+ function renderCard(t) {
67
+ const aliases = (t.aliases || []).filter(a => a !== t.term).join(" · ");
68
+ const meta = el("div", { class: "term-meta" }, [
69
+ el("a", { href: t.url || "#", target: "_blank", rel: "noopener" }, "Read full definition →"),
70
+ " · category: " + (t.category || "—"),
71
+ ]);
72
+ const card = el("article", { class: "term-card" }, [
73
+ el("h2", { class: "term-name" }, t.term),
74
+ aliases ? el("div", { class: "term-aliases" }, aliases) : null,
75
+ el("p", { class: "term-def" }, t.shortDefinition),
76
+ meta,
77
+ ]);
78
+ return card;
79
+ }
80
+
81
+ function render(query) {
82
+ const q = (query || "").trim().toLowerCase();
83
+ const filtered = !q ? TERMS : TERMS.filter(t => {
84
+ const haystack = [t.term, t.slug, ...(t.aliases || []), t.shortDefinition, t.category].join(" ").toLowerCase();
85
+ return haystack.includes(q);
86
+ });
87
+ const stats = document.getElementById("stats");
88
+ stats.textContent = q ? filtered.length + " of " + TERMS.length + " terms match \"" + q + "\"" : TERMS.length + " HSE terms";
89
+ const results = document.getElementById("results");
90
+ while (results.firstChild) results.removeChild(results.firstChild);
91
+ if (filtered.length === 0) {
92
+ results.appendChild(el("div", { class: "empty" }, "No matches. Try TRIR, ALARP, or permit-to-work."));
93
+ } else {
94
+ for (const t of filtered) results.appendChild(renderCard(t));
95
+ }
96
+ }
97
+
98
+ (async () => {
99
+ try {
100
+ const r = await fetch("https://www.smartqhse.com/api/v1/glossary");
101
+ const j = await r.json();
102
+ TERMS = j.terms || [];
103
+ render("");
104
+ } catch (e) {
105
+ document.getElementById("stats").textContent = "Failed to load glossary. Try again later.";
106
+ console.error(e);
107
+ }
108
+ document.getElementById("q").addEventListener("input", (e) => render(e.target.value));
109
+ })();
110
+ </script>
111
+ </body>
112
  </html>