Database
Database
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:)
CERTIFICATE
Date:
Place: Pune
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
1 Introduction 5
1.1 Objective
1.2 Problem
Definition
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
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.
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
Non-Functional requirements are the ones that specify criteria that can be used to judge the
operation of a system, rather than specific behaviors.
● 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.
● 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.
Hardware Requirements
Software Requirements
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
address Text
age Number
gender 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
Table 4: Farming
Attribute Data Type
fid Number
Table 5: Trig
Attribute Data Type
id Number
action Text
timestamp DateTime
7. Normalization
1NF (First 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.
● 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
# MY db connection
local_server= True
app = Flask(__name__)
app.secret_key='harshithbhaskar'
@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)
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)
@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():
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")
@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')
@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)
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()
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)
@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
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
14. References
1. https://www.youtube.com
2. https://www.google.com
3. http://www.getbootstrap.co