Skip to content

Fix local db path for Civic Intelligence Refinement Engine#548

Open
RohanExploit wants to merge 1 commit intomainfrom
fix-civic-intelligence-db-path-11492202192856182422
Open

Fix local db path for Civic Intelligence Refinement Engine#548
RohanExploit wants to merge 1 commit intomainfrom
fix-civic-intelligence-db-path-11492202192856182422

Conversation

@RohanExploit
Copy link
Owner

@RohanExploit RohanExploit commented Mar 14, 2026

The Daily Civic Intelligence Refinement Engine was already fully implemented and verified in the repository across services/ and scheduler/ using node-cron, sqlite3, and TypeScript. The only necessary fix was correcting the dbPath in dailyRefinementJob.ts to properly point to ../data/issues.db to align with the backend database. This allows the local local engine to run out of the box. Test coverage via Jest exists and has been successfully executed.


PR created automatically by Jules for task 11492202192856182422 started by @RohanExploit


Summary by cubic

Fixes the local DB path for the Daily Civic Intelligence Refinement Engine so the scheduler uses ../data/issues.db and runs out of the box. Adds default model weights (data/modelWeights.json) and a generated daily snapshot (data/dailySnapshots/2026-03-14.json).

Written for commit e5a3b71. Summary will update on new commits.

Summary by CodeRabbit

  • Chores
    • Added new daily system snapshot data
    • Added model weights configuration with category weightings and historical tracking for duplicate detection
    • Updated default database path configuration for scheduler operations

@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@netlify
Copy link

netlify bot commented Mar 14, 2026

Deploy Preview for fixmybharat canceled.

Name Link
🔨 Latest commit e5a3b71
🔍 Latest deploy log https://app.netlify.com/projects/fixmybharat/deploys/69b5b8dc0b29270008838042

@netlify
Copy link

netlify bot commented Mar 14, 2026

👷 Deploy Preview for fixmybharat processing.

Name Link
🔨 Latest commit e5a3b71
🔍 Latest deploy log https://app.netlify.com/projects/fixmybharat/deploys/69b5b8dc0b29270008838042

@github-actions
Copy link

🙏 Thank you for your contribution, @RohanExploit!

PR Details:

Quality Checklist:
Please ensure your PR meets the following criteria:

  • Code follows the project's style guidelines
  • Self-review of code completed
  • Code is commented where necessary
  • Documentation updated (if applicable)
  • No new warnings generated
  • Tests added/updated (if applicable)
  • All tests passing locally
  • No breaking changes to existing functionality

Review Process:

  1. Automated checks will run on your code
  2. A maintainer will review your changes
  3. Address any requested changes promptly
  4. Once approved, your PR will be merged! 🎉

Note: The maintainers will monitor code quality and ensure the overall project flow isn't broken.

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

📝 Walkthrough

Walkthrough

Three files were modified or added: new JSON data files for daily snapshots and model weights configuration, plus a database path update in the daily refinement job scheduler. These are primarily static data additions with one configuration path change.

Changes

Cohort / File(s) Summary
Data Snapshots and Configuration
data/dailySnapshots/2026-03-14.json, data/modelWeights.json
Added new static JSON data files: daily snapshot with index metrics and model weights with category weightings, duplicate thresholds, and historical entries.
Scheduler Configuration
scheduler/dailyRefinementJob.ts
Updated fallback database path from ../../backend/app.db to ../data/issues.db when DB_PATH environment variable is not set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

size/s

Poem

🐰 A hop through the data, a skip through the time,
New snapshots and weights, all measured in rhyme!
The scheduler now grins at its new database nest,
Where issues find home, in the data's request!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides context and objectives but lacks structured adherence to the repository's description template with required sections. The PR description should include explicit sections: Type of Change (with checkboxes), Related Issue, Testing Done (with checkboxes), Screenshots, and Checklist. Currently missing these structured sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing the local database path for the scheduler component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-civic-intelligence-db-path-11492202192856182422
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="data/modelWeights.json">

<violation number="1" location="data/modelWeights.json:10">
P2: Don't check in the generated `modelWeights.json` state file; the service already seeds defaults and rewrites this file on every run.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"Flooding": 8
},
"duplicateThreshold": 0.83,
"lastUpdated": "2026-03-14T19:32:45.319Z",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 14, 2026

Choose a reason for hiding this comment

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

P2: Don't check in the generated modelWeights.json state file; the service already seeds defaults and rewrites this file on every run.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At data/modelWeights.json, line 10:

<comment>Don't check in the generated `modelWeights.json` state file; the service already seeds defaults and rewrites this file on every run.</comment>

<file context>
@@ -0,0 +1,35 @@
+    "Flooding": 8
+  },
+  "duplicateThreshold": 0.83,
+  "lastUpdated": "2026-03-14T19:32:45.319Z",
+  "history": [
+    {
</file context>
Fix with Cubic

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make the TypeScript Daily Civic Intelligence Refinement Engine run locally out-of-the-box by correcting the SQLite DB path to align with the backend’s default ./data/issues.db location.

Changes:

  • Update scheduler/dailyRefinementJob.ts to use ../data/issues.db as the default DB fallback path.
  • Add data/modelWeights.json (adaptive weights state) to the repo.
  • Add data/dailySnapshots/2026-03-14.json (daily snapshot output) to the repo.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
scheduler/dailyRefinementJob.ts Points the scheduler’s default SQLite path at the repo-root data/issues.db.
data/modelWeights.json Introduces a checked-in adaptive weights state file used by TS services.
data/dailySnapshots/2026-03-14.json Introduces a checked-in daily snapshot output file generated by the TS engine.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +9 to +34
"duplicateThreshold": 0.83,
"lastUpdated": "2026-03-14T19:32:45.319Z",
"history": [
{
"date": "2026-03-14",
"categoryWeights": {
"Pothole": 5,
"Garbage": 3,
"Water Supply": 4,
"Streetlight": 2,
"Flooding": 8
},
"duplicateThreshold": 0.85
},
{
"date": "2026-03-14",
"categoryWeights": {
"Pothole": 5,
"Garbage": 3,
"Water Supply": 4,
"Streetlight": 2,
"Flooding": 8
},
"duplicateThreshold": 0.84
}
]
Comment on lines +2 to +8
"categoryWeights": {
"Pothole": 5,
"Garbage": 3,
"Water Supply": 4,
"Streetlight": 2,
"Flooding": 8
},
Comment on lines +2 to +6
"date": "2026-03-14",
"indexScore": 50,
"delta": 0,
"topKeywords": [],
"emergingConcerns": []
Comment on lines 9 to 12
// Load environmental or fallback to test.db or production db
const dbPath =
process.env.DB_PATH || path.join(__dirname, "../../backend/app.db");
process.env.DB_PATH || path.join(__dirname, "../data/issues.db");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants