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
85 changes: 85 additions & 0 deletions community-reputation-ledger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Community Reputation Ledger

Self-contained community and reputation milestone for [SCIBASE.AI issue #15](https://github.com/SCIBASE-AI/SCIBASE.AI/issues/15).

The issue asks for structured peer reviews, inline comments, contributor credit, CRediT taxonomy support, transparent reputation scoring, leaderboards, badges, and incentive tiers. This module provides a deterministic ledger that reviewers can run locally without databases, accounts, or external services.

## What It Adds

- Discipline-specific peer review templates for biology, physics, social sciences, and general research.
- Public, semi-private, anonymous, and double-blind review modes with reviewer anonymization.
- Inline comments targeting documents, datasets, code, notebooks, anchors, and line ranges.
- Timestamped contributor credit records with validated CRediT roles and stable hashes.
- Git-style contributor graph aggregation by researcher and project.
- Researcher profile views with review history, comment history, visible citation credits, badges, tiers, and profile hashes.
- Project timeline views that combine contributions, reviews, and comments into hashable chronological events.
- Citation page views that surface visible contributor credit by project for author/citation pages.
- Transparent researcher score components for citations, forks, endorsements, peer review, reproducibility, bounties, contribution credit, and moderation penalties.
- Moderation signals for self-endorsements, reciprocal endorsements, thin reviews, and flagged researcher metrics.
- Governance audit for review quality, reputation score changes, open appeals, required actions, and appeal SLA due dates.
- Leaderboards by domain, region, and institution.
- Badge and incentive tier assignment for trusted reviewers, reproducibility, challenge completion, and open-science leadership.
- Sample community fixture, tests, requirement map, CLI demo, and short demo GIF.

## Run

```bash
cd community-reputation-ledger
npm run check
npm test
npm run demo
```

Expected demo shape:

```json
{
"reviewTemplates": 4,
"reviews": 2,
"comments": 2,
"creditedContributions": 5,
"researcherProfiles": 3,
"projectTimelines": [
{
"projectId": "project-flood-microbiome",
"eventCount": 5
}
],
"citationPages": [
{
"projectId": "project-flood-microbiome",
"creditCount": 3
}
],
"topBiologyResearcher": {
"researcherId": "u-ada",
"tier": "open-science-champion"
},
"moderation": {
"status": "review"
},
"governance": {
"status": "needs-governance-review",
"requiredActions": 1,
"openAppeals": 1,
"firstAppealDueBy": "2026-05-19T08:00:00.000Z"
},
"packetHash": "..."
}
```

## Demo Artifact

See [docs/demo.gif](docs/demo.gif) for a short visual walkthrough. The SVG source is included at [docs/demo.svg](docs/demo.svg).

## Files

- `src/community-reputation-ledger.js` - peer reviews, comments, contribution ledger, contributor graph, researcher profiles, project timelines, citation pages, reputation scores, leaderboards, moderation, and governance audit.
- `data/sample-community.json` - reviewable community fixture.
- `test/community-reputation-ledger.test.js` - dependency-free Node tests.
- `scripts/demo.js` - CLI demo.
- `docs/issue-15-requirement-map.md` - maps the implementation to bounty requirements.

## AI-Assisted Disclosure

This contribution was produced with AI assistance and manually verified with the local commands above.
203 changes: 203 additions & 0 deletions community-reputation-ledger/data/sample-community.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"researchers": [
{
"id": "u-ada",
"displayName": "Ada Chen",
"domain": "biology",
"region": "North America",
"institution": "Northstar Lab"
},
{
"id": "u-ravi",
"displayName": "Ravi Patel",
"domain": "biology",
"region": "Europe",
"institution": "Open Bio Institute"
},
{
"id": "u-maya",
"displayName": "Maya Okafor",
"domain": "social-sciences",
"region": "Africa",
"institution": "Civic Methods Center"
}
],
"projects": [
{
"id": "project-flood-microbiome",
"title": "Coastal flooding microbiome atlas",
"domain": "biology",
"visibility": "public"
},
{
"id": "project-civic-survey",
"title": "Civic survey reproducibility pack",
"domain": "social-sciences",
"visibility": "public"
}
],
"reviews": [
{
"id": "review-1",
"projectId": "project-flood-microbiome",
"reviewerId": "u-ravi",
"discipline": "biology",
"visibility": "public",
"scores": {
"clarity": 4.5,
"methodology": 4,
"data-quality": 5,
"reproducibility": 4,
"novelty": 3.5
},
"recommendation": "accept-with-minor-revisions",
"summary": "Strong open dataset with clear reproducibility hooks.",
"strengths": ["Raw data and notebooks are easy to trace", "Protocol metadata is complete"],
"concerns": ["Clarify batch effects in the methods appendix"],
"createdAt": "2026-05-03T10:00:00Z"
},
{
"id": "review-2",
"projectId": "project-civic-survey",
"reviewerId": "u-ada",
"discipline": "social-sciences",
"visibility": "double-blind",
"scores": {
"clarity": 4,
"ethics": 5,
"sampling": 3.5,
"reproducibility": 4.5,
"impact": 4
},
"recommendation": "revise",
"summary": "Promising survey pack with strong ethics disclosure.",
"strengths": ["Consent workflow is explicit", "Analysis scripts are included"],
"concerns": ["Sampling limitations need clearer framing"],
"createdAt": "2026-05-04T12:00:00Z"
}
],
"comments": [
{
"id": "comment-1",
"projectId": "project-flood-microbiome",
"authorId": "u-ravi",
"target": {
"kind": "dataset",
"path": "data/samples.csv",
"anchor": "column:collection_site"
},
"mode": "public",
"body": "Please document whether collection_site was GPS rounded.",
"createdAt": "2026-05-03T10:15:00Z"
},
{
"id": "comment-2",
"projectId": "project-civic-survey",
"authorId": "u-ada",
"target": {
"kind": "notebook",
"path": "notebooks/weighting.ipynb",
"lineStart": 42
},
"mode": "anonymous",
"body": "The weighting cell should include a seed for deterministic reruns.",
"createdAt": "2026-05-04T12:20:00Z"
}
],
"contributions": [
{
"id": "contrib-1",
"projectId": "project-flood-microbiome",
"contributorId": "u-ada",
"type": "dataset",
"roles": ["data-curation", "investigation"],
"impact": 1.4,
"timestamp": "2026-05-01T09:00:00Z"
},
{
"id": "contrib-2",
"projectId": "project-flood-microbiome",
"contributorId": "u-ada",
"type": "code",
"roles": ["software", "formal-analysis"],
"impact": 1.2,
"timestamp": "2026-05-02T09:00:00Z"
},
{
"id": "contrib-3",
"projectId": "project-flood-microbiome",
"contributorId": "u-ravi",
"type": "review",
"roles": ["validation", "writing-review-editing"],
"impact": 1.1,
"timestamp": "2026-05-03T10:00:00Z"
},
{
"id": "contrib-4",
"projectId": "project-civic-survey",
"contributorId": "u-maya",
"type": "authorship",
"roles": ["conceptualization", "methodology", "writing-original-draft"],
"impact": 1.5,
"timestamp": "2026-05-04T08:00:00Z"
},
{
"id": "contrib-5",
"projectId": "project-civic-survey",
"contributorId": "u-ada",
"type": "review",
"roles": ["validation", "writing-review-editing"],
"impact": 1,
"timestamp": "2026-05-04T12:00:00Z"
}
],
"endorsements": [
{ "from": "u-ravi", "to": "u-ada", "weight": 5, "status": "active" },
{ "from": "u-maya", "to": "u-ada", "weight": 4, "status": "active" },
{ "from": "u-ada", "to": "u-ada", "weight": 5, "status": "active" },
{ "from": "u-ada", "to": "u-ravi", "weight": 4, "status": "active" }
],
"metrics": {
"researchers": {
"u-ada": {
"previousReputation": 122,
"previousTier": "open-science-champion",
"citations": 34,
"forks": 8,
"reproducibilityBadges": 2,
"bountyCompletions": 1,
"flags": []
},
"u-ravi": {
"previousReputation": 48,
"previousTier": "active-collaborator",
"citations": 12,
"forks": 3,
"reproducibilityBadges": 1,
"bountyCompletions": 0,
"flags": []
},
"u-maya": {
"previousReputation": 44,
"previousTier": "emerging-contributor",
"citations": 18,
"forks": 2,
"reproducibilityBadges": 0,
"bountyCompletions": 0,
"flags": [{ "id": "flag-1", "severity": "low", "reason": "late review disclosure" }]
}
}
},
"appeals": [
{
"id": "appeal-1",
"researcherId": "u-maya",
"targetType": "metric-flag",
"targetId": "flag-1",
"status": "open",
"openedAt": "2026-05-05T08:00:00Z",
"reviewerGroup": "community-governance",
"requestedChange": "Review whether the late disclosure flag should expire after the corrected disclosure was added."
}
]
}
Binary file added community-reputation-ledger/docs/demo.gif
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 community-reputation-ledger/docs/demo.mp4
Binary file not shown.
33 changes: 33 additions & 0 deletions community-reputation-ledger/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.
30 changes: 30 additions & 0 deletions community-reputation-ledger/docs/issue-15-requirement-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Issue #15 Requirement Map

This module implements a deterministic community and reputation milestone for SCIBASE issue #15. It focuses on structured peer review, inline comments, contributor credit, transparent scoring, leaderboards, badges, and incentive tiers.

| Issue requirement | Implementation |
| --- | --- |
| Structured peer reviews | `selectReviewTemplate()` and `createPeerReview()` support discipline-specific criteria, scores, narrative fields, recommendations, and review history hashes. |
| Public, semi-private, anonymous, and double-blind modes | `createPeerReview()` normalizes review visibility and anonymizes reviewer identity for anonymous and double-blind reviews. |
| Inline comments on documents, datasets, code blocks, and notebooks | `createInlineComment()` stores target kind, path, anchors, line ranges, visibility mode, status, and comment hashes. |
| Review history on reviewer profiles and project timelines | `buildResearcherProfiles()` exposes per-researcher review/comment history, while `buildProjectTimelines()` combines reviews, comments, and contributions into chronological project events. |
| Timestamped contributor credits | `buildContributionLedger()` creates timestamped contribution records with stable hashes and citation visibility. |
| CRediT taxonomy support | Contribution roles are validated against the CRediT role list exported as `CREDIT_ROLES`. |
| Git-style contributor graphs | `buildContributorGraph()` aggregates contributor/project edges, role counts, contribution counts, and credit totals. |
| Visible credit on researcher profiles and citation pages | `buildResearcherProfiles()` returns visible citation credits for each researcher, and `buildCitationPages()` produces project-level credit lists and citation text. |
| Transparent reputation metrics | `scoreResearcher()` exposes score components for citations, forks, endorsements, peer review, reproducibility badges, bounty completions, contribution credit, and penalties. |
| Abuse-resistant moderation hooks | `buildModerationSignals()` flags self-endorsements, reciprocal endorsements, thin review narratives, and flagged researcher metrics before scores are trusted. |
| Trustworthy score governance | `buildGovernanceReport()` audits review quality, reputation score deltas, open appeals, appeal due dates, and required governance actions before reputation changes are published. |
| Leaderboards by domain, region, and institution | `buildLeaderboards()` groups researchers by a requested dimension and ranks them deterministically. |
| Badge and incentive tiers | `assignBadges()` and `assignTier()` surface Trusted Reviewer, Reproducibility Verified, Challenge Finisher, and Open Science Champion outcomes through `scoreResearcher()`. |
| Reviewer demo | `npm run demo` prints review counts, contribution counts, top-ranked researcher, incentive tiers, and packet hash. |

## Verification

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

The module is dependency-free and isolated under `community-reputation-ledger/`.
12 changes: 12 additions & 0 deletions community-reputation-ledger/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "scibase-community-reputation-ledger",
"version": "0.1.0",
"private": true,
"description": "Community review, contribution credit, and reputation scoring module for SCIBASE issue #15.",
"type": "commonjs",
"scripts": {
"check": "node --check src/community-reputation-ledger.js && node --check scripts/demo.js && node --check test/community-reputation-ledger.test.js",
"demo": "node scripts/demo.js",
"test": "node test/community-reputation-ledger.test.js"
}
}
Loading