SPB Git forge

spb/websensor

Public
33commits 1branches 0releases
3.4 MBsize
maindefault branch
10 days agolast push
TypeScript 55.4% Python 43.2% SQL 1.2%
5.2 KB · 68 lines tsx
Raw Blame History
1import Link from "next/link";2import type { Metadata } from "next";3import { Bar, Empty, PageHeader, Panel, Stat, Table, Td } from "@/components/ui";4import { api } from "@/lib/api";5import { fmtInt, fmtPct, relTime } from "@/lib/format";67export const dynamic = "force-dynamic";8export const metadata: Metadata = { title: "Coverage", description: "Global Observation Coverage Score: how much of the world's high-value public web WebSensor observes, sector by sector — listed companies, governments, AI, cloud, cybersecurity, markets, science, healthcare, energy, transport, telecom, logistics, open source and commerce.", alternates: { canonical: "/coverage" } };910function band(score: number): string {11  return score >= 80 ? "text-signal" : score >= 60 ? "text-high" : score >= 40 ? "text-warn" : "text-fg-muted";12}1314export default async function CoveragePage() {15  const c = await api.coverage();16  if (!c || !c.sectors.length) {17    return (18      <>19        <PageHeader compact kicker="Global Observation Coverage Score" title="Coverage" description="How much of the world's high-value public web do we observe?" />20        <Panel><Empty>Coverage universes are not loaded yet.</Empty></Panel>21      </>22    );23  }24  const factoryQueued = (c.factory.queued ?? 0) + (c.factory.discovering ?? 0);25  return (26    <>27      <PageHeader28        compact29        kicker="Global Observation Coverage Score"30        title={<span>Coverage <span className={`font-mono ${band(c.global_score)}`}>{c.global_score.toFixed(1)}</span><span className="text-[13px] text-fg-subtle"> / 100</span></span>}31        description={`How much of the world's high-value public web do we observe? ${fmtInt(c.covered)} of ${fmtInt(c.members)} organizations in ${c.sectors.length} sector universes have at least one active sensor. The denominator is explicit (config/coverage), the score is explainable (breadth 70 % · depth 30 %), and the Source Factory expands it continuously: ${fmtInt(c.monitored.shadow)} sensors are in shadow monitoring, ${fmtInt(factoryQueued)} organizations are queued for discovery.`}32      />33      <div className="panel mb-4 grid grid-cols-2 divide-x divide-y divide-line sm:grid-cols-3 lg:grid-cols-6 lg:divide-y-0">34        <Stat label="Global score" value={<span className={band(c.global_score)}>{c.global_score.toFixed(1)}</span>} hint="sector-weighted" />35        <Stat label="Universe members" value={fmtInt(c.members)} hint={`${c.sectors.length} sectors`} />36        <Stat label="Observed" value={fmtInt(c.covered)} hint={fmtPct(c.members ? c.covered / c.members : null)} tone="signal" />37        <Stat label="Sensors matched" value={fmtInt(c.sensors_matched)} hint={`${fmtInt(c.monitored.sensors)} active in total`} />38        <Stat label="In shadow" value={fmtInt(c.monitored.shadow)} hint="observed, not yet published" tone="info" />39        <Stat label="Factory queue" value={fmtInt(factoryQueued)} hint={`${fmtInt(c.factory.discovered ?? 0)} discovered · ${fmtInt(c.factory.blocked ?? 0)} blocked`} />40      </div>41      <Panel dense title="Sectors" action={<span className="text-[11px] text-fg-subtle">updated {relTime(c.generated_at)}</span>}>42        <Table head={["Sector", "Score", "", "Breadth", "Depth", "Members", "Observed", "Shadow", "Queued", "Sensors", "Weight", ""]}>43          {c.sectors.map((s) => (44            <tr key={s.sector} className="hover:bg-panel-2/60">45              <Td><Link href={`/coverage/${s.sector}`} className="font-medium hover:underline">{s.label}</Link><div className="text-[11px] text-fg-subtle">{s.description ?? s.sector}</div></Td>46              <Td mono className={`font-semibold ${band(s.score)}`}>{s.score.toFixed(1)}</Td>47              <Td><div className="w-24 sm:w-40"><Bar value={s.score} tone={s.score >= 80 ? "signal" : s.score >= 60 ? "high" : s.score >= 40 ? "mid" : "info"} /></div></Td>48              <Td mono>{fmtPct(s.breadth)}</Td>49              <Td mono>{fmtPct(s.depth)}</Td>50              <Td mono>{fmtInt(s.members)}</Td>51              <Td mono className="text-signal">{fmtInt(s.covered)}</Td>52              <Td mono className={s.shadow_members ? "text-info" : "text-fg-subtle"}>{fmtInt(s.shadow_members)}</Td>53              <Td mono className="text-fg-subtle">{fmtInt(s.queued)}</Td>54              <Td mono>{fmtInt(s.sensors)}</Td>55              <Td mono className="text-fg-subtle">×{s.weight}</Td>56              <Td><Link href={`/coverage/${s.sector}`} className="whitespace-nowrap text-[11px] text-fg-subtle hover:text-fg">members →</Link></Td>57            </tr>58          ))}59        </Table>60      </Panel>61      <p className="mt-3 text-[11.5px] leading-relaxed text-fg-subtle">62        Method — {c.method}. A member counts as observed when at least one active (non-shadow) sensor lives on its registrable domain or on a host it declares. Shadow sensors are new sensors the Source Factory found and validated; they are polled and their evidence is kept, but nothing is published until they prove signal over noise. Universes live in <code>config/coverage/*.yaml</code> with provenance and retrieval dates; they are the denominator, not the registry.63        {c.issues.length > 0 && <span className="text-warn"> {c.issues.length} universe file{c.issues.length > 1 ? "s" : ""} could not be loaded.</span>}64      </p>65    </>66  );67}68