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
1 change: 1 addition & 0 deletions TS_CIVIC_INTELLIGENCE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# TypeScript Daily Civic Intelligence Refinement Engine
<!-- Documentation for the architecture and algorithms underpinning the Daily Civic Intelligence Engine -->

## Overview
VishwaGuru's Civic Intelligence Engine is a self-improving AI system that runs daily at midnight. It operates entirely locally using Node.js and SQLite, analyzing civic issues, detecting trends, and optimizing the system's severity scoring logic based on real-world patterns.
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"sqlite3": "^5.1.7"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/node": "^20.11.24",
"@types/node-cron": "^3.0.11",
"@types/sqlite3": "^3.1.11",
"jest": "^29.7.0",
"jest-util": "^30.2.0",
"ts-jest": "^29.1.2",
"jest-util": "^30.3.0",
"ts-jest": "^29.4.6",
Comment on lines 30 to +32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What is the latest version of jest-util npm package?

💡 Result:

The latest published version of the jest-util npm package is 30.2.0. [1] [2]

Sources: jsDelivr (npm CDN) [1], UNPKG [2].


🌐 Web query:

jest-util npm version history releases

💡 Result:

jest-util has 273 published versions on npm, with the latest release 30.3.0 (published ~2 days ago). [1]

Recent version history (newest → older), with npm publish recency as shown by the registry metadata mirror: 30.3.0, 30.2.0, 30.0.5, 30.0.2, 30.0.1, 30.0.0, then the 29.x line starting at 29.7.0 (and many more). [2]

To see the full npm release/version history locally:

npm view jest-util versions --json
npm view jest-util time --json

Sources: [1] [2]


🌐 Web query:

ts-jest 29.4.6 npm package compatibility jest

💡 Result:

ts-jest@29.4.6 is compatible with Jest 29 and Jest 30, per its peerDependencies:

  • jest: ^29.0.0 || ^30.0.0 (also babel-jest, @jest/types, @jest/transform, jest-util in the same range) [1]
  • typescript: >=4.3 <6 [1]

The ts-jest installation docs for the 29.4 line also indicate installing jest, typescript, and ts-jest together (implying matching major versions) [2].

Sources: [1] [2]


🌐 Web query:

jest 29 jest-util 30 compatibility

💡 Result:

Jest 29 and jest-util 30 are not a supported/guaranteed combination. jest-util is an internal Jest package and Jest 30 includes breaking internal/package changes; mixing majors can break, especially if anything relies on Jest internals or “deep imports.” [1]

What to do

  • If you’re on Jest 29, pin jest-util to 29.x (keep all jest-* / @jest/* packages on the same major).
  • If some tooling lists jest-util as optional/peer (e.g., ts-jest allows either jest-util ^29 || ^30), still choose the version that matches your installed Jest major. [2]

Recommendation: Don’t force jest-util@30 into a Jest 29 tree; either downgrade jest-util to 29.7.x or upgrade Jest to 30.x and align all Jest packages. [1]

Sources: [1] [2]


jest-util@^30.3.0 with jest@^29.7.0 creates an unsupported version mismatch.

jest-util is an internal Jest package where major versions must align with the corresponding Jest major version. Using jest-util@30.3.0 with jest@29.7.0 will likely cause runtime errors. Align versions by either downgrading jest-util to 29.7.x or upgrading both jest and jest-util to the 30.x line. ts-jest@^29.4.6 is compatible with both Jest 29 and 30, so no change needed there.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 30 - 32, The package.json lists jest@^29.7.0 and
jest-util@^30.3.0 which mismatch major versions; update package.json so jest and
jest-util share the same major version—either change "jest-util" to a 29.7.x
release to match "jest" (e.g., ^29.7.x) or upgrade both "jest" and "jest-util"
to the 30.x line (e.g., ^30.x); keep "ts-jest" as-is since it's compatible with
both.

"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
Expand Down
2 changes: 2 additions & 0 deletions scheduler/dailyRefinementJob.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// DailyRefinementJob operates at midnight to run the Civic Intelligence Refinement Engine,
// analyzing recent reports, updating weights, and generating index snapshots automatically.
import * as cron from "node-cron";
import * as sqlite3 from "sqlite3";
import * as path from "path";
Expand Down
2 changes: 2 additions & 0 deletions services/adaptiveWeights.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// AdaptiveWeights dynamically adjusts the severity model weights and duplicate detection thresholds
// based on historical and real-time civic issue reporting and resolution patterns.
import { Issue, ModelWeights } from "./types";
import * as fs from "fs";
import * as path from "path";
Expand Down
2 changes: 2 additions & 0 deletions services/intelligenceIndex.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// IntelligenceIndex computes a daily score summarizing civic activity and problem resolution,
// storing the result in a daily JSON snapshot to build a transparent track record.
import { Issue, DailySnapshot } from "./types";
import * as fs from "fs";
import * as path from "path";
Expand Down
2 changes: 2 additions & 0 deletions services/priorityEngine.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// PriorityEngine is responsible for evaluating the severity and urgency of a civic issue.
// It leverages dynamic weights managed by the AdaptiveWeights service.
import { AdaptiveWeights } from "./adaptiveWeights";
import { ModelWeights } from "./types";

Expand Down
2 changes: 2 additions & 0 deletions services/trendAnalyzer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TrendAnalyzer processes civic issues to identify emerging patterns, top keywords,
// category spikes, and geographic clustering to understand systemic problems.
import { Issue } from "./types";

export class TrendAnalyzer {
Expand Down
2 changes: 2 additions & 0 deletions services/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TypeScript definitions for models and datasets used within the Civic Intelligence Engine.

export interface Issue {
id: number;
reference_id?: string;
Expand Down
Loading