0% found this document useful (0 votes)
22 views

Database

Uploaded by

durvaajoshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Database

Uploaded by

durvaajoshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Project Report

On
“Farm Management System”
Submitted by: Guided by:
Mrs.sonal Fatangre
1. Shruti Kolapkar (Roll no:52 University Exam no: )
2.Durva Joshi (Roll no:38 University Exam no:)

DEPARTMENT OF COMPUTER ENGINEERING


R.M.D Sinhgad School of Engineering ,Warje, Pune-58
Savitribai Phule Pune University
2024-25

DEPARTMENT OF COMPUTER ENGINEERING


R.M.D Sinhgad School of Engineering ,Warje, Pune-58
Savitribai Phule Pune University

CERTIFICATE

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 1


This is to certify that “Farm Management System” embodies the original work done by Shruti
Kolapkar and Durva Joshi during this project submission as a partial fulfillment of the
requirement for the Mini Project in subject Database Management System of Third year
Computer Engineering students of Savitribai Phule Pune University during the academic year
2024-2025

Date:
Place: Pune

Project Guide Head of Department Principal


(Mrs. Sonal Fatangare) (Dr. Vina M. Lomte) (Dr.V.V. Dixit)

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 2


ACKNOWLEDGEMENT

The satisfaction that accompanies that the successful completion of any task would be
incomplete without the mention of people whose ceaseless cooperation made it possible, whose
constant guidance and encouragement crown all efforts with success.

We are grateful to our project guide Mrs.Sonal Fatangare for the guidance, inspiration and
constructive suggestions that helpful us in the preparation of this project. We also thank our other
staff members who have helped in successful completion of the project.

Shruti Kolapkar
Durva Joshi

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 3


Contents
Sr. No Title Page No.

1 Introduction 5
1.1 Objective
1.2 Problem
Definition

2 Scope and Limitations 6

3 Requirement Analysis 7
4 System Requirements 9
5 ER Diagram 10
6 ER to table 11
conversion

7 Normalization 14
8 Schema Diagram 15
9 Coding 16
10 Screenshots 25
11 Future Scope and 31
Enhancement

12 Conclusion 32
13 References 33

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 4


1. INTRODUCTION
Project Name: Farm Management System
Programming Language: Frontend- HTML, CSS, Java Script, Bootstrap
Backend-Python flask (Python 3.7) , SQLAlchemy,
Database: MySQL
Project Type:

1.1 Objective:
The project's goal is to design a user-friendly Farm Management System that is
efficient, accurate, and eliminates data redundancy. It aims to provide a fast,
flexible software with a good user interface, enabling long-term, low-maintenance
use. Key features include a centralized farmer-seller database, enhanced security
through login/password, and faster data storage and retrieval. The system will
improve coordination among farmers, reduce losses, and offer better GUI to save
time and money while minimizing data leakage.

1.2 Problem Definition:


The Farm Management System aims to address inefficiencies in farm operations
by providing a centralized, secure platform for farmers and sellers, reducing data
redundancy and improving coordination. It simplifies management tasks, enhances
productivity, and minimizes losses.

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 5


2. Scope & Limitations
Scope of Project:
● The Farm Management System will centralize and streamline farm
operations, providing real-time data management, improved coordination
between farmers and sellers, and enhanced decision-making. It aims to
reduce data redundancy, minimize losses, and offer a secure, user-friendly
interface for long-term, efficient farm management.

Limitations:
● Small size of farm business: Due to fragmentation and subdivision of
holding the average size of operational holdings is very small
● Less labour per unit areas is required to farm large areas, especially since
expensive alterations to land (like terracing) are completely absent.
● Mechanisation can be used more effectively over large, flat areas

3. Requirement Analysis

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 6


3.1 Requirement gathering and analysis:

3.2 Functional Requirements:

3.3 Non-Functional Requirements:

Non-Functional requirements are the ones that specify criteria that can be used to judge the
operation of a system, rather than specific behaviors.

The ones concerned for the project are as:


● Security
Security is the degree of protection against danger, damage, loss and crime. In
order to ensure security, a login is maintained which is user name and password
secured and hence forth is accessible by only certain trustworthy people from
admin.

● Maintainability
Maintainability refers to the ease with which a product can be maintained in order
to:
o Isolate requirements of their cause
o Meet new requirements
o Make future management easier or,
o Cope with a changed environment

● Performance
Good performance is maintained by providing a reliable and high quality service
to the customer as customer satisfaction is the top most priority.

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 7


● Testability
Testability refers the capability of a system to be tested. As this system depicts a
real life scenario it can be easily tested, as to how it is able to store customer
details.

● Usability
Usability is the ease of use and learns ability. System is made very user friendly
using interactive GUI so that it is easy to use, understand and maintain as well.

● Robustness
Robustness is the ability of a system to cope with errors during execution. As the
system has been tested for all sorts of invalid and unexpected inputs and
exception handling is implemented, hence it is Robust in nature.

● Accessibility
Accessibility can have viewed as the “ability to access” and benefit from some
system or entity. System is accessible only to admin for special functions and
hence is easily accessible and easy to maintain.

● Portability
It describes that how easy it is to reuse the system. It requires generalized
abstraction between the application logic and system interfaces. This system is
quite portable as a few minor changes and it can cater to various management
systems.

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 8


4. System Requirements

H/w and S/w requirement: -

Hardware Requirements

 Computer with a 1.1 GHz or faster processor


 Minimum 2GB of RAM or more
 2.5 GB of available hard-disk space
 5400 RPM hard drive
 1366 × 768 or higher-resolution display
 DVD-ROM drive

Software Requirements

Frontend- HTML, CSS, Java Script, Bootstrap


Backend-Python flask (Python 3.7) , SQLAlchemy,

 Operating System: Windows 10


 Google Chrome/Internet Explorer
 XAMPP (Version-3.7)
 Python main editor (user interface): PyCharm Community
 workspace editor: Sublime text 3

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 9


5. ER Diagram

6. ER Diagram to Table Conversion


1. Converting strong entity types

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 10


Strong Entities Conversion:
1. Register
- Represents farmer registration details.
- Attributes: `rid`, `farmername`, `adhar number`, `address`,
`phonenumber`, `age`, `gender`.
2. User
- Represents system users.
- Attributes: `username`, `email`, `password`.
3. AddAgroProducts
- Represents agricultural products.
- Attributes: `pid`, `productname`, `productdesc`, `price`.
4. Farming
- Represents farming types.
- Attributes: `fid`, `farmingtype`.
5. Trig
- Represents system actions.
- Attributes: `id`, `action`, `timestamp`, `fid` (foreign key to Farming).

2. Converting relationships

3. 1. User and AddAgroProducts: A user can add multiple agro products (`n:m`
relationship).
4. 2. User and Register: A user can register and be associated with a farmer
(`m:n` relationship).

TABLE

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 11


Table 1: Register

Attribute Data Type

Aadhar number Number

address Text

Phone number Number

age Number

gender Text

Farmer name Text

username Text

fid Number

Table 2: User
Attribute Data Type

username Text

email Text

password Text

Table 3: AddAgrProducts
Attribute Data Type
pid Number
productname Text
productdesc Text

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 12


price Number
username Text
email Text

Table 4: Farming
Attribute Data Type

fid Number

Farming type Text

Table 5: Trig
Attribute Data Type

id Number

action Text

timestamp DateTime

7. Normalization
1NF (First Normal Form)

● Ensure atomic values: Break down fields to hold a single value.


● Example: Split Crop_Type and Contact_Details into separate rows.

2NF (Second Normal Form)

● Eliminate partial dependencies: Ensure all non-key attributes depend on the entire
primary key.
● Example: Create separate tables for Farmer and Crops linked by Farmer_ID.

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 13


3NF (Third Normal Form)

● Remove transitive dependencies: Non-key attributes should not depend on other non-
key attributes.
● Example: Move attributes like Farm_Location from Crops table to a separate Farm table
if it is not directly related to Crop_Type.

8. Schema Diagram

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 14


9. Coding
from flask import Flask,render_template,request,session,redirect,url_for,flash
from flask_sqlalchemy import SQLAlchemy

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 15


from flask_login import UserMixin
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import login_user,logout_user,login_manager,LoginManager
from flask_login import login_required,current_user

# MY db connection
local_server= True
app = Flask(__name__)
app.secret_key='harshithbhaskar'

# this is for getting unique user access


login_manager=LoginManager(app)
login_manager.login_view='login'

@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))

# app.config['SQLALCHEMY_DATABASE_URL']='mysql://username:password@localhost/
databas_table_name'
app.config['SQLALCHEMY_DATABASE_URI']='mysql://root:@localhost/farmers'
db=SQLAlchemy(app)

# here we will create db models that is tables


class Test(db.Model):
id=db.Column(db.Integer,primary_key=True)
name=db.Column(db.String(100))

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 16


class Farming(db.Model):
fid=db.Column(db.Integer,primary_key=True)
farmingtype=db.Column(db.String(100))

class Addagroproducts(db.Model):
username=db.Column(db.String(50))
email=db.Column(db.String(50))
pid=db.Column(db.Integer,primary_key=True)
productname=db.Column(db.String(100))
productdesc=db.Column(db.String(300))
price=db.Column(db.Integer)

class Trig(db.Model):
id=db.Column(db.Integer,primary_key=True)
fid=db.Column(db.String(100))
action=db.Column(db.String(100))
timestamp=db.Column(db.String(100))

class User(UserMixin,db.Model):
id=db.Column(db.Integer,primary_key=True)
username=db.Column(db.String(50))
email=db.Column(db.String(50),unique=True)
password=db.Column(db.String(1000))

class Register(db.Model):
rid=db.Column(db.Integer,primary_key=True)

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 17


farmername=db.Column(db.String(50))
adharnumber=db.Column(db.String(50))
age=db.Column(db.Integer)
gender=db.Column(db.String(50))
phonenumber=db.Column(db.String(50))
address=db.Column(db.String(50))
farming=db.Column(db.String(50))

@app.route('/')
def index():
return render_template('index.html')

@app.route('/farmerdetails')
@login_required
def farmerdetails():
# query=db.engine.execute(f"SELECT * FROM `register`")
query=Register.query.all()
return render_template('farmerdetails.html',query=query)

@app.route('/agroproducts')
def agroproducts():
# query=db.engine.execute(f"SELECT * FROM `addagroproducts`")
query=Addagroproducts.query.all()
return render_template('agroproducts.html',query=query)

@app.route('/addagroproduct',methods=['POST','GET'])
@login_required
def addagroproduct():

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 18


if request.method=="POST":
username=request.form.get('username')
email=request.form.get('email')
productname=request.form.get('productname')
productdesc=request.form.get('productdesc')
price=request.form.get('price')
products=Addagroproducts(username=username,email=email,productname=productname,p
roductdesc=productdesc,price=price)
db.session.add(products)
db.session.commit()
flash("Product Added","info")
return redirect('/agroproducts')

return render_template('addagroproducts.html')

@app.route('/triggers')
@login_required
def triggers():
# query=db.engine.execute(f"SELECT * FROM `trig`")
query=Trig.query.all()
return render_template('triggers.html',query=query)

@app.route('/addfarming',methods=['POST','GET'])
@login_required
def addfarming():
if request.method=="POST":
farmingtype=request.form.get('farming')
query=Farming.query.filter_by(farmingtype=farmingtype).first()
if query:
flash("Farming Type Already Exist","warning")

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 19


return redirect('/addfarming')
dep=Farming(farmingtype=farmingtype)
db.session.add(dep)
db.session.commit()
flash("Farming Addes","success")
return render_template('farming.html')

@app.route("/delete/<string:rid>",methods=['POST','GET'])
@login_required
def delete(rid):
# db.engine.execute(f"DELETE FROM `register` WHERE `register`.`rid`={rid}")
post=Register.query.filter_by(rid=rid).first()
db.session.delete(post)
db.session.commit()
flash("Slot Deleted Successful","warning")
return redirect('/farmerdetails')

@app.route("/edit/<string:rid>",methods=['POST','GET'])
@login_required
def edit(rid):
# farming=db.engine.execute("SELECT * FROM `farming`")
if request.method=="POST":
farmername=request.form.get('farmername')
adharnumber=request.form.get('adharnumber')
age=request.form.get('age')
gender=request.form.get('gender')

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 20


phonenumber=request.form.get('phonenumber')
address=request.form.get('address')
farmingtype=request.form.get('farmingtype')
# query=db.engine.execute(f"UPDATE `register` SET
`farmername`='{farmername}',`adharnumber`='{adharnumber}',`age`='{age}',`gender`='{gender
}',`phonenumber`='{phonenumber}',`address`='{address}',`farming`='{farmingtype}'")
post=Register.query.filter_by(rid=rid).first()
print(post.farmername)
post.farmername=farmername
post.adharnumber=adharnumber
post.age=age
post.gender=gender
post.phonenumber=phonenumber
post.address=address
post.farming=farmingtype
db.session.commit()
flash("Slot is Updates","success")
return redirect('/farmerdetails')
posts=Register.query.filter_by(rid=rid).first()
farming=Farming.query.all()
return render_template('edit.html',posts=posts,farming=farming)

@app.route('/signup',methods=['POST','GET'])
def signup():
if request.method == "POST":
username=request.form.get('username')
email=request.form.get('email')
password=request.form.get('password')
print(username,email,password)

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 21


user=User.query.filter_by(email=email).first()
if user:
flash("Email Already Exist","warning")
return render_template('/signup.html')
# encpassword=generate_password_hash(password)

# new_user=db.engine.execute(f"INSERT INTO `user` (`username`,`email`,`password`)


VALUES ('{username}','{email}','{encpassword}')")

# this is method 2 to save data in db


newuser=User(username=username,email=email,password=password)
db.session.add(newuser)
db.session.commit()
flash("Signup Succes Please Login","success")
return render_template('login.html')

return render_template('signup.html')

@app.route('/login',methods=['POST','GET'])
def login():
if request.method == "POST":
email=request.form.get('email')
password=request.form.get('password')
user=User.query.filter_by(email=email).first()

if user and user.password == password:


login_user(user)
flash("Login Success","primary")

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 22


return redirect(url_for('index'))
else:
flash("invalid credentials","warning")
return render_template('login.html')

return render_template('login.html')

@app.route('/logout')
@login_required
def logout():
logout_user()
flash("Logout SuccessFul","warning")
return redirect(url_for('login'))

@app.route('/register',methods=['POST','GET'])
@login_required
def register():
farming=Farming.query.all()
if request.method=="POST":
farmername=request.form.get('farmername')
adharnumber=request.form.get('adharnumber')
age=request.form.get('age')
gender=request.form.get('gender')
phonenumber=request.form.get('phonenumber')
address=request.form.get('address')
farmingtype=request.form.get('farmingtype')
query=Register(farmername=farmername,adharnumber=adharnumber,age=age,gender=gen
der,phonenumber=phonenumber,address=address,farming=farmingtype)

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 23


db.session.add(query)
db.session.commit()
# query=db.engine.execute(f"INSERT INTO `register`
(`farmername`,`adharnumber`,`age`,`gender`,`phonenumber`,`address`,`farming`) VALUES
('{farmername}','{adharnumber}','{age}','{gender}','{phonenumber}','{address}','{farmingtype}'
)")
# flash("Your Record Has Been Saved","success")
return redirect('/farmerdetails')
return render_template('farmer.html',farming=farming)

@app.route('/test')
def test():
try:
Test.query.all()
return 'My database is Connected'
except:
return 'My db is not Connected'

app.run(debug=True)

11. Screenshots

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 24


RMDSSOE COMPUTER ENGINEERING DEPARTMENT 25
RMDSSOE COMPUTER ENGINEERING DEPARTMENT 26
RMDSSOE COMPUTER ENGINEERING DEPARTMENT 27
RMDSSOE COMPUTER ENGINEERING DEPARTMENT 28
RMDSSOE COMPUTER ENGINEERING DEPARTMENT 29
12. Future Scope and Enhancement
RMDSSOE COMPUTER ENGINEERING DEPARTMENT 30
• Enhanced database storage facility
• Enhanced user friendly GUI
• more advanced results systems
• online payments

13. Conclusion
FARM MANAGEMENT SYSTEM successfully implemented based on online
selling which helps us in administrating the agro products user for managing the
tasks performed in farmers. The project successfully used various functionalities of
Xampp and python flask and also create the fully functional database management
system for online portals.
Using MySQL as the database is highly beneficial as it is free to download,
popular and can be easily customized. The data stored in the MySQL database can

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 31


easily be retrieved and manipulated according to the requirements with basic
knowledge of SQL.
With the theoretical inclination of our syllabus it becomes very essential to take the
atmost advantage of any opportunity of gaining practical experience that comes
along. The building blocks of this Major Project “Farm Management System” was
one of these opportunities. It gave us the requisite practical knowledge to
supplement the already taught theoretical concepts thus making us more competent
as a computer engineer. The project from a personal point of view also helped us in
understanding the following aspects of project development:
• The planning that goes into implementing a project.
• The importance of proper planning and an organized methodology.
• The key element of team spirit and co-ordination in a successful project.

14. References

1. https://www.youtube.com

2. https://www.google.com

3. http://www.getbootstrap.co

RMDSSOE COMPUTER ENGINEERING DEPARTMENT 32


RMDSSOE COMPUTER ENGINEERING DEPARTMENT 33

You might also like