Skip to content

Add SQLite database backend

Mansi Bhagyanagaram requested to merge database-backend into main

Merge Request Summary

This merge request adds the SQLite database backend for the SpotIt project.

Changes Made

  • Added database.py for backend database operations.
  • Created SQLite database initialization logic.
  • Added reports table schema.
  • Added functions to create, retrieve, update, and delete reports.
  • Added report statistics functions for dashboard integration.
  • Added .gitignore to prevent unnecessary files like database files, virtual environments, cache files, and uploads from being pushed.

Files Added

  • database.py
  • .gitignore

Features Implemented

  • init_db() — Initializes the SQLite database.
  • create_report() — Stores a new safety report.
  • get_report() — Fetches a report using report ID.
  • get_all_reports() — Retrieves all reports.
  • update_status() — Updates report status.
  • delete_report() — Deletes a report.
  • get_report_stats() — Provides basic dashboard statistics.
  • get_reports_by_category() — Provides category-wise report counts.

Testing Done

  • Ran python database.py.
  • Verified that the database initializes successfully.
  • Confirmed that spotit.db is generated locally.
  • Ensured spotit.db is ignored using .gitignore.

Notes

The database file spotit.db is intentionally not pushed to the repository because it is generated locally during runtime.

Related Module

Member 2 — Database & Backend

Edited by Mansi Bhagyanagaram

Merge request reports

Loading