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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# deepevents.ai
deepevents.ai main codebase

- `statistical-consistency-checker/` adds statistical methods, unit, artifact, and review readiness checks for research packets.
40 changes: 40 additions & 0 deletions statistical-consistency-checker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Statistical Consistency Checker

This module adds a focused research review slice for statistical method consistency.

It covers:

- p-value, alpha, and reported-significance alignment
- effect size and confidence interval consistency
- null-value checks for significant and non-significant findings
- multiple-comparison correction review
- sample-size and small-group warnings
- unit mismatches and linked data/code artifact availability
- reviewer actions, audit events, and deterministic digests

The implementation is dependency-free and uses synthetic sample data only.

## Run

```bash
npm run check
npm test
npm run demo
```

## Demo Assets

- short demo video: `docs/demo.webm`
- `docs/demo.svg`

## API

```js
import {
evaluateStatisticalConsistency,
renderStatisticalConsistencyReport
} from "./src/statistical-consistency-checker.js";

const result = evaluateStatisticalConsistency(input);
console.log(renderStatisticalConsistencyReport(result));
```
92 changes: 92 additions & 0 deletions statistical-consistency-checker/data/sample-statistics-input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"generatedAt": "2026-05-16T16:35:00Z",
"manuscript": {
"id": "ms-neuroimmune-042",
"title": "Neuroimmune Marker Study",
"domain": "neuroscience"
},
"artifacts": [
{
"id": "data-raw-csf",
"type": "dataset",
"available": true,
"hash": "sha256:5c1c8b"
},
{
"id": "code-model-r",
"type": "analysis-script",
"available": false,
"hash": "sha256:missing"
},
{
"id": "code-summary-r",
"type": "analysis-script",
"available": true,
"hash": "sha256:af4d22"
}
],
"analyses": [
{
"id": "primary-csf-marker",
"claim": "Marker levels were higher in responders.",
"test": "welch-t-test",
"pValue": 0.031,
"alpha": 0.05,
"reportedSignificant": true,
"effectSize": 0.82,
"confidenceInterval": [0.12, 0.65],
"direction": "positive",
"sampleSize": 28,
"groups": [
{ "name": "responders", "n": 8 },
{ "name": "non-responders", "n": 20 }
],
"multipleComparisons": {
"tests": 6,
"correction": "none"
},
"units": [
{
"variable": "CSF marker",
"expected": "ng/mL",
"observed": "pg/mL"
}
],
"primaryOutcome": true,
"preregistered": false,
"dataArtifactId": "data-raw-csf",
"codeArtifactId": "code-model-r"
},
{
"id": "secondary-cognition-score",
"claim": "Cognitive score change was not statistically significant.",
"test": "linear-model",
"pValue": 0.18,
"alpha": 0.05,
"reportedSignificant": false,
"effectSize": 0.09,
"confidenceInterval": [-0.11, 0.32],
"direction": "positive",
"sampleSize": 64,
"groups": [
{ "name": "treatment", "n": 32 },
{ "name": "control", "n": 32 }
],
"multipleComparisons": {
"tests": 1,
"correction": "not reported"
},
"units": [
{
"variable": "score delta",
"expected": "points",
"observed": "points"
}
],
"primaryOutcome": false,
"preregistered": true,
"dataArtifactId": "data-raw-csf",
"codeArtifactId": "code-summary-r"
}
]
}
17 changes: 17 additions & 0 deletions statistical-consistency-checker/docs/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added statistical-consistency-checker/docs/demo.webm
Binary file not shown.
11 changes: 11 additions & 0 deletions statistical-consistency-checker/docs/requirement-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Requirement Map

This slice targets the peer-review diagnostics part of issue #13.

| Requirement | Coverage |
| --- | --- |
| Statistical error detection | Checks p-values, confidence intervals, effect sizes, significance labels, and null-value consistency. |
| Compliance-style review packet | Emits reviewer actions, audit events, deterministic manifest digests, and finding digests. |
| Citation/review workflow fit | Links each finding to an analysis and includes artifact ids where artifact checks apply. |
| Batch-ready local workflow | `npm run demo` evaluates a synthetic review packet with no external services. |
| Tests | `npm test` covers clean packets, invalid p-values, interval mismatches, unit mismatches, artifact gaps, and deterministic output. |
15 changes: 15 additions & 0 deletions statistical-consistency-checker/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "statistical-consistency-checker",
"version": "1.0.0",
"description": "Deterministic statistical consistency checks for research review packets.",
"type": "module",
"scripts": {
"check": "node --check src/statistical-consistency-checker.js && node --check scripts/demo.js && node --check test/statistical-consistency-checker.test.js",
"demo": "node scripts/demo.js",
"test": "node --test test/*.test.js"
},
"engines": {
"node": ">=18"
},
"license": "MIT"
}
14 changes: 14 additions & 0 deletions statistical-consistency-checker/scripts/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import {
evaluateStatisticalConsistency,
renderStatisticalConsistencyReport
} from "../src/statistical-consistency-checker.js";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const inputPath = path.join(__dirname, "..", "data", "sample-statistics-input.json");
const input = JSON.parse(fs.readFileSync(inputPath, "utf8"));

const result = evaluateStatisticalConsistency(input);
console.log(renderStatisticalConsistencyReport(result));
Loading
Loading