Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions analytics-data-product-freshness-guard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Analytics Data Product Freshness Guard

This module is a focused Revenue Infrastructure slice for SCIBASE issue #20. It validates recurring licensed analytics data products before monthly invoice release, after entitlement checks but before finance sends the bill.

The guard checks:

- contracted refresh cadence against snapshot age and delivery date
- required metric coverage for customer-facing analytics products
- anonymization threshold coverage before billing for licensed data views
- source-project withdrawal and embargo impacts on deliverable coverage
- reproducibility-score feed freshness for billed analytics products
- customer-facing delivery evidence for exports, portals, and dashboards
- deterministic invoice, credit, defer, or hold recommendations

It is intentionally separate from generic billing ledgers, usage meters, payment webhooks, payment failover, tax and VAT checks, FX settlement, quote approvals, invoice delivery, collections, storage overage, prepaid compute credits, analytics API usage gates, analytics seat rosters, customer consolidation, renewal/cancellation checks, price-escalation caps, and support entitlement guards. This slice focuses only on whether a licensed analytics data product is fresh and complete enough to bill.

## Reviewer Path

```bash
npm run check
npm test
npm run demo
npm run verify-video
```

Generated reviewer artifacts:

- `reports/clean-freshness-packet.json`
- `reports/risky-freshness-packet.json`
- `reports/freshness-review-report.md`
- `reports/summary.svg`
- `reports/demo-script.txt`
- `reports/demo.mp4`

## Safety

All fixtures are synthetic. The module does not call private research projects, uploaded datasets, live analytics stores, customer portals, billing systems, payment processors, credential stores, external APIs, payout systems, or financial accounts.
52 changes: 52 additions & 0 deletions analytics-data-product-freshness-guard/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const fs = require("node:fs");
const path = require("node:path");
const { evaluateFreshnessPacket, renderMarkdownReport, renderSvgSummary } = require("./index");
const { cleanPacket, riskyPacket } = require("./sample-data");

const reportsDir = path.join(__dirname, "reports");
fs.mkdirSync(reportsDir, { recursive: true });

const cleanEvaluation = evaluateFreshnessPacket(cleanPacket);
const riskyEvaluation = evaluateFreshnessPacket(riskyPacket);

fs.writeFileSync(
path.join(reportsDir, "clean-freshness-packet.json"),
`${JSON.stringify({ input: cleanPacket, evaluation: cleanEvaluation }, null, 2)}\n`
);
fs.writeFileSync(
path.join(reportsDir, "risky-freshness-packet.json"),
`${JSON.stringify({ input: riskyPacket, evaluation: riskyEvaluation }, null, 2)}\n`
);
fs.writeFileSync(
path.join(reportsDir, "freshness-review-report.md"),
renderMarkdownReport(riskyPacket, riskyEvaluation)
);
fs.writeFileSync(
path.join(reportsDir, "summary.svg"),
renderSvgSummary(riskyEvaluation)
);
fs.writeFileSync(
path.join(reportsDir, "demo-script.txt"),
[
"Analytics data product freshness billing guard demo",
"",
`Clean packet decision: ${cleanEvaluation.summary.decision}`,
`Clean net invoice cents: ${cleanEvaluation.summary.netInvoiceCents}`,
`Clean audit digest: ${cleanEvaluation.summary.auditDigest}`,
"",
`Risky packet decision: ${riskyEvaluation.summary.decision}`,
`Risky finding count: ${riskyEvaluation.summary.findingCount}`,
`Risky recommended credit cents: ${riskyEvaluation.summary.recommendedCreditCents}`,
`Risky audit digest: ${riskyEvaluation.summary.auditDigest}`,
"",
"The risky packet demonstrates stale snapshots, incomplete metric coverage, anonymization threshold breach, unresolved withdrawal and embargo impacts, stale reproducibility feed evidence, and missing customer delivery proof.",
""
].join("\n")
);

console.log(JSON.stringify({
cleanDecision: cleanEvaluation.summary.decision,
riskyDecision: riskyEvaluation.summary.decision,
riskyFindings: riskyEvaluation.summary.findingCount,
report: "reports/freshness-review-report.md"
}, null, 2));
Loading