AISSCE 2024-2025
Crime Management System
        Computer science(083)
Computer science project – synopsis
SUBMITTED BY:
 Vishal M
 AISSCE 2024-2025
Computer Science (803)
Computer Science Project
Crime management system
TEAM MEMBERS:
   Sathya Narayanan V
   Akshay R
   Vishal M
Table of contents:
SNO            DESCRIPTION        PG NO
01    CERTIFICATE                 4
02    ACKNOWLEDGEMENT             5
03    OBJECTIVES OF THE PROJECT   8
04    PROPOSED SYSTEM             10
05    ABOUT PYTHON                12
06    ABOUT MYSQL                 15
07    SOURCE CODE                 17
08    OUTPUT                      26
09   HARDWARE AND SOFTWARE REQUIREMENTS   30
10   BIBLIOGRAPHY                         31
                                     
        Smt. Ramkuwar Devi Fomra Vivekananda Vidyalaya
                       Chromepet, Chennai        – 44
            Unit of VIVEKANANDA EDUCATIONAL SOCIETY (Regd)
                 Department of Computer Science
                    BONAFIDE CERTIFICATE
This is to certify that this bonafide      project work has been done by
________________________________                 of class    XII     in   the
Smt. Ramkuwar Devi       Fomra     Vivekananda      Vidyalaya,      Chromepet,
Chennai – 44 during the year 2024 - 2025
Principal                                               Staff Incharge
Submitted for (All     India Senior Secondary Certificate          Examination)
Computer Science Practical Examination held on _____________ at
Smt.Ramkuwar Devi Fomra Vivekananda Vidyalaya, Chromepet, Chennai -44.
Internal Examiner                                 External Examiner
Date:                                                   School Seal:
The crime management system has been developed to override the problem
prevailing in the practicing manual system. This software is supported to
eliminate and in some cases reduced hardships faced by this existing
system. Moreover this system is designed for the particular need of the
                                  7
police management system to carry out operations in a smooth and
effective manner.The project Crime management system is developed
with a view of assist the police department in there functioning. This project
is aimed in providing easy access to the administration about their police
and prisoners records and their FIR reports.
                                    8
Objectives of the project:
The name of the project on crime management is to manage the
details of police, criminals, and FIR files. The project is totally built at
administrative end and the only administrator is guaranteed the
access.
Functionalities provided by management system are follows:
     This project manager reports by collecting the required
information about the complaint.
      Providing the database facility to store details about police
officer and prisoner details.
      It also displays the information of police and prisoners such as
their designation, years of service, salary and crime committed, age
for convenience of the police.
      It can also delete the data if required.
 The objective of this project is also to let the students apply the
programming knowledge into a real world situation and expose the
students how programming skills helps in developing a good
software.
The students will be able to do the following:
                                        9
     Right programs utilising modern software tools.
    Apply object oriented programming principles effectively when
developing small to medium sized projects.
Write effective procedural code to solve small to medium sized
problem.
       Students will demonstrate the ability to conduct research or
applied computer science project requiring writing and presentation
skills which exemplify scholarly in computer science.
                                   10
Proposed system:
Today one cannot afford to reply on the fallible human beings in
today’s competitive world. So, to keep pace with time, to bring about
the best result without malfunctioning and greater efficiency so to
                                    11
replace the unending heaps of flies with a much sophisticated hard
disk of the computer.
One has to use the data management software. Software has been
an ascent in various organisations. Many software products working
are now in markets, which have helped in making the organisations
work easier and efficiently. Data management initially had to
maintain a lot of ledgers and a lot of paper work has to be done but
now software product on this organisation has made their work faster
and easier. Now only this software has to be loaded on the computer
and work can be done.
This prevents a lot of time and money. The work becomes fully
automated and any information regarding the organization can be
obtained by clicking a button.
                                   12
About python:
Introduction :
                 13
Python is an interpreter, object-oriented, high-level programming
language with dynamic semantics.
Its high-level built-in data structures, combined with dynamic typing
and dynamic binding making it very attractive for rapid application
development.
It was developed by Guido Van Rossum in 1991.
Uses of python :
•   Web development
•   Game development
•   Software development
•   Language development
Features of Python:
1) Easy to use : Due to simple syntax
2) Interpreted language : Code execution and interpretation is
   done line by line
3) Cross-Platform language : It can be run on Windows, Linux,
   Macintosh etc. equally
4) Expressive language : Less code to be written as it itself
   expresses the purpose of the code
5) Completeness : Supports wide range of libraries and modules
6) Free and open source : Can be downloaded freely and source
   code can be modified for improvement
                                   14
Shortcomings of Python:
1) Lesser libraries : Libraries of Python is not competent with
   other languages like C++ , JAVA etc
2) Slow language : As an interpreted language, execution time is
   more than fully compiled languages
3) Not strong on Type-Binding : It does not pin point error for the
use of single variable for different data types
                                    15
ABOUT MySQL:
Introduction:
MySQL is currently the most popular open source database software
and It is multi-user, multithreaded database management system.
                                16
MySQL is especially popular on the web. It is one of the parts of the
very popular LAMP platform.
MySQL was founded by Micheal Widenius (Monty), David Axmark
and Allan Larsson in Sweden in the year 1995.
Features of MySQL:
1) Portability : Can be run in any types of Hardware and            OS
   like Linux, MS Windows etc.
2) Security : Databases are well protected by passwords.
3) Connectivity : Various APIs are developed to connect it with
   many programming languages .
Advantages of MySQL:
•   High performance
•   Flexibility of open source
•   Data redundancy
•   Data security
                                   17
Source code:
import mysql.connector as c import
tkinter as tk from tkinter
import messagebox
from tkinter import ttk
# Function to connect to the database def
connect_db(): try:
    sql = c.connect(        host="localhost",
user="root",
password="123699",
                             18
database="crimemanagement"
     )
     return sql except c.Error
as err:
print(f"Error: {err}") return
None
# Main GUI Window def
main_window(): window
= tk.Tk()
   window.title("Crime Management System")
window.geometry("400x300")
   window.configure(bg="#ddeeff")
  label = tk.Label(window, text="Crime Management",
font=("Helvetica", 25), bg="#ddeeff", fg="#333333")
label.pack(pady=20)
  # Buttons for accessing each table's details
btn_police = tk.Button(window, text="Police Details",
command=police_records_window, width=30,
bg="#337ab7", fg="white", bd=3)
  btn_police.pack(pady=10)
  btn_prisoners = tk.Button(window, text="Prisoners
Details", command=prisoner_records_window, width=30,
bg="#337ab7", fg="white", bd=3)
  btn_prisoners.pack(pady=10)
                             19
  btn_fir = tk.Button(window, text="FIR Details",
command=fir_records_window, width=30, bg="#337ab7",
fg="white", bd=3)
  btn_fir.pack(pady=10)
  window.mainloop()
# Police Records Management Window def
police_records_window():
   create_record_window("Police Records", "policerecord",
("PID", "Pname", "Designation", "YearsOfService", "Salary",
"Gender", "City"))
# Prisoner Records Management Window def
prisoner_records_window():
  create_record_window("Prisoners Records",
"prisoners_report", ("prisonersID", "PRname", "Crime",
"Gender", "Age"))
# FIR Records Management Window def
fir_records_window():
   create_record_window("FIR Records", "fir", ("SNO",
"CName", "MobileNo", "Subject", "PlaceOfOccurrence"))
# Function to create a record window with table name and
columns
                             20
def create_record_window(window_title, table_name,
columns):
  win = tk.Toplevel()
win.title(window_title) win.geometry("400x300")
win.configure(bg="#f0f8ff")
  label = tk.Label(win, text=f"Access {window_title}",
font=("Helvetica", 20), bg="#f0f8ff", fg="#333333")
label.pack(pady=20)
  # View Records Button
  btn_view = tk.Button(win, text=f"View {window_title}",
command=lambda: view_records(table_name, columns),
width=30, bg="#5cb85c", fg="white", bd=3)
btn_view.pack(pady=10)
  # Edit Records Button
  btn_edit = tk.Button(win, text=f"Edit {window_title}",
command=lambda: edit_record_window(table_name,
columns), width=30, bg="#f0ad4e", fg="white", bd=3)
btn_edit.pack(pady=10)
  # Delete Records Button
  btn_delete = tk.Button(win, text=f"Delete {window_title}",
command=lambda: delete_record_window(table_name,
columns[0]), width=30, bg="#d9534f", fg="white", bd=3)
btn_delete.pack(pady=10)
                              21
# Function to view records in a Treeview table def
view_records(table_name, columns):
   sql = connect_db()
if sql is not None:
      cursor = sql.cursor()
      cursor.execute(f"SELECT * FROM {table_name}")
data = cursor.fetchall()
      sql.close()
if not data:
         messagebox.showinfo(f"{table_name} Records",
"No records found.")
         return
      # Create a new window for displaying the records
view_win = tk.Toplevel()
      view_win.title(f"{table_name} - View")
view_win.geometry("700x400")
      view_win.configure(bg="#f0f8ff")
     # Create a Treeview widget to display the records
tree = ttk.Treeview(view_win, columns=columns,
show='headings')
     tree.pack(expand=True, fill=tk.BOTH)
     # Define the column headings and widths       for
col in columns:
        tree.heading(col, text=col)
        tree.column(col, width=100)
                            22
    # Insert data into the treeview       for
record in data:
       tree.insert("", "end", values=record)
else:
    messagebox.showerror("Error", "Failed to connect to
database")
# Function to create an edit window for records def
edit_record_window(table_name, columns):
edit_win = tk.Toplevel()  edit_win.title(f"Edit
{table_name} Records")
edit_win.geometry("400x400")
   edit_win.configure(bg="#ffe4e1")
  label = tk.Label(edit_win, text=f"Edit {table_name}
Record", font=("Helvetica", 20), bg="#ffe4e1", fg="#333333")
label.pack(pady=10)
   # Entry fields for each column
   entries = {} for col in columns:        label =
tk.Label(edit_win, text=f"{col}:", bg="#ffe4e1")
label.pack(pady=5)        entry = tk.Entry(edit_win)
entry.pack()       entries[col] = entry
  # Submit button
                              23
  submit_button = tk.Button(edit_win, text="Submit",
command=lambda: submit_edit(table_name, columns,
entries), bg="#337ab7", fg="white", bd=3)
submit_button.pack(pady=10)
# Function to submit the edited details def
submit_edit(table_name, columns, entries):
sql = connect_db() if sql is not None:         try:
        values = tuple(entries[col].get() for col in columns)
         # Create the SQL insert query dynamically
query = f"INSERT INTO {table_name} ({',
'.join(columns)}) VALUES ({', '.join(['%s'] * len(columns))})"
cursor = sql.cursor()          cursor.execute(query, values)
         sql.commit()
         messagebox.showinfo("Success", "Details added
successfully")       except Exception as e:
         messagebox.showerror("Error", f"An error
occurred: {e}")       finally:
         sql.close()
else:
      messagebox.showerror("Error", "Failed to connect to
database")
# Function to create a delete window def
delete_record_window(table_name, pk_column):
del_win = tk.Toplevel()
                               24
  del_win.title(f"Delete {table_name} Record")
del_win.geometry("400x200")
  del_win.configure(bg="#ffe4e1")
  label = tk.Label(del_win, text=f"Delete {table_name}
Record", font=("Helvetica", 20), bg="#ffe4e1", fg="#333333")
label.pack(pady=10)
  # Entry for the primary key to delete
  label_pk = tk.Label(del_win, text=f"Enter {pk_column} of
record to delete:", bg="#ffe4e1") label_pk.pack(pady=5)
entry_pk = tk.Entry(del_win) entry_pk.pack()
  # Delete button
  btn_delete = tk.Button(del_win, text="Delete",
command=lambda: submit_delete(table_name, pk_column,
entry_pk.get()), bg="#d9534f", fg="white", bd=3)
btn_delete.pack(pady=10)
# Function to delete a record def
submit_delete(table_name, pk_column, pk_value):
  sql = connect_db() if
sql is not None:      try:
        # Create the SQL delete query
        query = f"DELETE FROM {table_name} WHERE
{pk_column} = %s"
        cursor = sql.cursor()
                             25
       cursor.execute(query, (pk_value,))
       sql.commit()
       if cursor.rowcount > 0:
messagebox.showinfo("Success", "Record deleted
successfully")         else:
          messagebox.showwarning("Warning", "No
record found with the provided primary key")     except
Exception as e:
       messagebox.showerror("Error", f"An error
occurred: {e}")     finally:
       sql.close()
else:
      messagebox.showerror("Error", "Failed to connect to
database")
# Run the main window main_window()
                             26
OUTPUT:
          27
28
29
30
Interface python with MySQL:
                                                 Step1: Start python.
STEPS FOR CREATING DATABASE CONNECTIVITY APPLICATIONS:
Step2: Import the packages required for database programming.
Step3: Open a connection to database. Use the
mysql.connector.connect() method of MySQL connector python
with required parameters to connect MySQL.
Step4: Create a cursor instance. Use the connection Object returned
by a connect() method to create a cursor.
Step5: Execute a query. Use cursor.execute() to execute SQL queries
from python.
Step6: Extract data from result set.
Step7: Clean up the environment
                                       31
• Software requirement
    Operating system : Windows 10
    Python 3.9.6 : for execution of program
    MySQL : for storing data in the database
    Python – MySQL connector : for database connectivity
    Microsoft word : for presentation of output
• Hardware requirement
                              32
Computer, for coding and typing the required documents of
                           33
the project.
               34
Printer, to print the required documents of the project.
                             35
Compact drive
Processor: Intel core
RAM : 4 GB
Hard disk : 256 GB
     BIBILOGRAPHY
                        36
Computer science with python
                         -by Sumita arora
                    37
38