SPB Git

spb/airiskindex Public

The most methodologically rigorous, fully transparent AI job-exposure index.

TypeScript 88% Python 6.1% SQL 2.7% CSS 1.2% JavaScript 0.9% Shell 0.8%
1.8 KB · 47 lines typescript
Raw Blame History
1//  File:    purge-demo.ts2//  Path:    apps/worker/src/scripts/purge-demo.ts3//  Project: AI Risk Index — airiskindex.io4//  Author:  Simon-Pierre Boucher5//  Contact: contact@spboucher.ai6//  Copyright © 2026 Simon-Pierre Boucher. All rights reserved.7//8//  Description: Removes the demonstration dataset once real ratings exist.910import { prisma } from "@airiskindex/db";1112// Removes the demonstration dataset (synthetic tasks "XX-XXXX.00-Tn", demo13// panel ratings, and score runs computed from demo raters) once real ratings14// exist. Demo runs are preview artifacts, not published index history — the15// immutability rule (CLAUDE.md §9) applies to real runs.1617async function main(): Promise<void> {18  const demoRuns = await prisma.scoreRun.findMany({19    where: { raterModels: { hasSome: ["demo-panel-a", "demo-panel-b"] } },20    select: { id: true },21  });22  const runIds = demoRuns.map((run) => run.id);2324  const [taskScores, occScores, runs] = await prisma.$transaction([25    prisma.taskScore.deleteMany({ where: { runId: { in: runIds } } }),26    prisma.occupationScore.deleteMany({ where: { runId: { in: runIds } } }),27    prisma.scoreRun.deleteMany({ where: { id: { in: runIds } } }),28  ]);2930  const ratings = await prisma.taskRating.deleteMany({31    where: { model: { startsWith: "demo-" } },32  });33  const tasks = await prisma.task.deleteMany({ where: { id: { contains: "-T" } } });34  const occupations = await prisma.occupation.deleteMany({ where: { code: "99-9999.00" } });3536  console.log(37    `purged demo artifacts: ${runs.count} runs, ${occScores.count} occupation scores, ${taskScores.count} task scores, ${ratings.count} ratings, ${tasks.count} synthetic tasks, ${occupations.count} synthetic occupations`,38  );39}4041main()42  .catch((error) => {43    console.error(error);44    process.exitCode = 1;45  })46  .finally(() => prisma.$disconnect());47