Farmer Information System Overview
Farmer Information System Overview
1
TABLE OF CONTENTS
1 INTRODUCTION
2 SYSTEM SPECIFICATION
3 SYSTEM STUDY
4 REVIEW OF LITERATURE 49
7. CONCLUSION 82
8. APPENDIX 87-129
2
ABSTRACT
Farmer Information System is a web application developed for farmers. This application gives
suppose to the village farmers who want to use this facility and who want to learn how is it possible
and how they can use e-farming to sell their products. Farmers will get all the new ideas to improve
their productivity and they can buy and sell their products online. It is a project developed to build
a website which will help farmers from to sell their products to different cities through online.
Farmers can use this facility and can learn how is it possible and how they can use e-farming to sell
their products. Farmers enter this system and upload their product details with images whichever is
stocked at the warehouse and details of price, quality and etc. user view this product and book their
order. At last the products will be directly transported to the customers.
Dashboard: The application offers a visually appealing dashboard that provides an overview of the
farm's key metrics, such as crop status, weather conditions, pest alerts, and market prices. The
dashboard serves as a central hub for farmers to access important information quickly.
Crop Management: Farmers can input details about their crops, including crop type, planting date,
and expected harvest date. The application generates personalized recommendations on optimal
irrigation schedules, fertilization methods, and pest control strategies based on crop-specific data
and best practices.
Weather Integration: The application integrates with weather APIs to provide real-time weather
updates for the farmer's location. Farmers can monitor current weather conditions, receive
forecasts, and make informed decisions about irrigation, harvesting, and other activities based on
the weather data.
3
Market Information: The application aggregates market data from various sources, including
local markets and online platforms. Farmers can access current market prices for their crops,
identify demand trends, and plan their sales accordingly. This feature helps farmers maximize their
profitability by making informed pricing decisions.
Resource Library: The application includes a comprehensive resource library containing articles,
guides, and videos related to various farming techniques, crop diseases, pest control methods, and
more. Farmers can access this repository to gain knowledge, troubleshoot problems, and stay
updated with the latest advancements in agriculture.
Notifications and Alerts: The application sends timely notifications and alerts to farmers regarding
important events, such as upcoming rainfall, crop maturity, disease outbreaks, or price fluctuations
in the market. These notifications ensure that farmers stay informed and can take appropriate
actions promptly.
4
CHAPTER-I
INTRODUCTION
5
1. INTRODUCTION
farmer Information System is a web application developed for Traders. This application gives
suppose to the village Traders who want to use this facility and who want to learn how is it possible
and how they can use e-former to sell their products. Traders will get all the new ideas to improve
their productivity and they can buy and sell their products online.
Purpose of Project
It is the agriculture portal which provides solutions to small farmers and agriculture students of In-
dia. Besides Salt & fertilizer analysis for particular region this portal also helps farmers to know
about government loan and insurance schemes. It also helps them make decisions on mandi/market
and best prices. NGOs are trying to spread messages to make agriculture more eco-friendly through
this site.
Scope of the project
This project deals with Besides Salt & fertilizer analysis for particular region this portal also helps
farmers to know about government loan and insurance schemes. It also helps them make decisions
on mandi/market and best prices. NGOs are trying to spread messages to make agriculture more
eco-friendly through this site.
PROJECT OVERVIEW
It is the agriculture portal which provides solutions to small farmers and agriculture students of In-
dia. Besides Salt & fertilizer analysis for particular region this portal also helps farmers to know
about government loan and insurance schemes. It also helps them make decisions on mandi/market
and best prices. NGOs are trying to spread messages to make agriculture more eco-friendly through
this site.
Entering the details of project, documents, and tasks manually is cumbersome, And tracking the
database is complicated when the details are maintained manually. This makes the maintenance of
schedule erroneous.
6
Administrator:
Admin maintain all the information about Agriculture officers details. It deals with the
creation of users and user maintenance . Every user willing to use the mail server application
should be existing as a user before they can send or receiving mails. Each user is needed to specify
the user name, password and date of creation .
A unique user-id is created or generated automatically and is associated with each user by
the system. The users password should not be displayed as they are typed. Users should be allowed
to change their password as and when required. The users can be deleted only by the administrator.
The admin user is by default created by the system and his password can be changed after he locks
in as admin. The list of users created can be viewed in a tabulated output.
Agriculture officers:
This module deals the information about all student details. And also maintain crops details,
fertilizer details, seeds details. And also maintains the interaction between agriculture students. And
takes comments from students.
A unique user-id is created or generated automatically and is associated with each user by
the system. The users password should not be displayed as they are typed. Users should be allowed
to change their password as and when required . The users can be deleted only by the administrator.
The admin user is by default created by the system and his password can be changed after he locks
in as admin. The list of users created can be viewed in a tabulated output.
.
7
MODULE SPECIFICATION
The modules of the project are: –
Login Module
Admin
Farmer
Vendor
Public
Login Module: –
This will help farmer/vendor/public to login into the system using id and password. A
farmer/vendor/public who has the valid id and password can only login to their respective accounts.
It will help the authentication of the farmer/vendor/public who enters the system.
Admin Module
Add Farming Information: He can add the forming details that is useful for farmers.
Add Market: He can add the market details. Farmer can search the different market in various
cities.
Farmer Module
login: The farmer can fill the registration form and get his credentials.
Add Product: All the details of the product will be uploaded by the farmer. He will fix the rates of
the products. He will add the details of the item. He can update the details of the item.
Search Farming: Farmer can also gathering the useful farming information.
Vendor Module
8
Register: Vendor will get the username and password by filling the registration form. He will view
all the details of the product.
Order: He will see the list of products that he want to buy. He order the bulk of products.
Payment: He can view the sales rate details. The payment details managed by farmer and COD
mode.
Public Module
login: Public will get the username and password by filling the registration form.
Search Farmer: He will view all the details of the product. He can search the former details also.
Order For Function: He will see the list of products that he want to buy. He orders the bulk of
products for only function.
Payment: He can view the sales rate details. The payment details managed by farmer and COD
mode.
9
1.2 COMPANY PROFILE
Our goal is to focus on your software and embedded product's unique requirements, enable teams
to learn and integrate the latest tools and languages, and work with your people to develop long-
lasting products. Expertise ranges from working in industries such as healthcare, logistics, ecom-
merce, and more.
SRI MILLENNIUM COMPUTER TECHNOLGIESS is a company built with people in mind both
in regards to the employees, clients, and end-users of the software solutions we develop.
Through a long history, we were always acting and making decisions analysing not just short-term
outcomes, but a potential long-term impact these decisions will have, putting all the efforts to keep
our business and living environment eco-, social-friendly and preserving the importance of human
rights.
We have assisted enterprises worldwide in digitalizing their business by offering end-to-end digital
solutions. We emphasize on the superiority and expediency of every solution that we develop to en-
sure enrichment of the clients’ business.
We employ some of the most talented IT professionals and continually invest into skills and know-
how development to ensure our clients enjoy the world-class solutions and service in the most cost-
effective way. Our commitment in every client engagement is to ensure success of customer’s in-
novations in IT-process and software systems.
10
OUR SERVICES:
Web Design
The logic of presentation is in the design philosophy. Web design company involves the strategic
planning of data mapping to the simple elegant stroke of a pattern. The best way to portray a
product or service of an organization kick starts with the website design. Representing the
mastermind of any sector in inspiring easy to ponder pattern!
Smc Technologies helps to enhance your business purview at the global level. Bits Informatics
creates a website that presents the strengths of your company under the following category:
Self-portrayal website
Interactive website
Project centred website
Service centred website
Business to Business website
Business to customer website
The system used for a structural execution or implementation of the business volume. In the gloom-
ing technological world, the time and space for planning, organizing, and execution of business
have become smarter. Smc Technologies helps their clients to overcome the technological needs of
the business. We are the technology experts to revamp the strategic business into smarter solutions.
Smc Technologies is the web app development company, it offers web-based application services
for the process based sector in cost-effective user-friendly versions. We are planning to work in
various sectors of business are:
Educational Institutions
Infrastructure Industries
11
Manufacturing Industries
Automobile Industries
Hospitality Institutions
Healthcare Organizations
Logistics
Smc Technologies continuously explores the new business opportunities and sectors that look
towards systematic data performance.
The Growth of technology is never a barrier for the creative minds of innovation. The conglomer -
ates of business at one go is the latest technological trend and impact on the growth ratio. Bits In -
formatics creates a space for its clients to balance the time and efforts of their business hours with a
unique integration portfolio.
MOBILE APPLICATION
Smc Technologies aids to connect the client’s existing business with a mobile application. Bits In-
formatics do help the new client’s to build on their mobile application for m-commerce and web-
M-commerce
Mobile UI Development
Mobile E-Publishing
Smc Technologies the technology partner thrives to enhance the client need for mobile application
12
DIGITAL MARKETING
The potential growth of the business relies on marketing strategies. The effective marketing plat-
form is the thumb rule for lead generations in any sector of businesses. Smc Technologies rejuve-
nates the client’s business by helping them to be the lead marketer of their sector.
Smc Technologies offers the following solutions to assist the client’s online marketing strategies:
SEO copywriting
13
MISSION
The company mission is to “Enhancing the business growth of our customers with creative
design and development to deliver market-defining high-quality solutions that create value and
reliable competitive advantage for our clients around the world”.
VISION
The company vision is to “develop in a constant manner and grow as a major IT service
provider to become a leading performer, in a providing quality web and software development
solutions in the competitive global marketplace.
14
CHAPTER-II
SYSTEM SPECIFICATION
15
2. SYSTEM SPECIFICATION
16
2.3 SOFTWARE DESCRIPTION
HTML
HTML was first created by Tim Berners-Lee, Robert Caillou, and others starting in 1989.
ItstandsforHyperTextMarkupLanguage.Hypertextmeansthatthedocumentcontains linksthat allow
the reader to jump to other places in the document or to another document altogether. The latest
version is known as HTML5. A Markup Language is a way that computers speak to each other to
control how text is processed and presented. To do this HTML uses two things: tags and at-
tributes.
HTML can embed programs written in a scripting language such as JavaScript, which af-
fects the behavior and content of web pages. Inclusion of CSS defines the look and layout of
content. The World Wide Web Consortium (W3C), former maintainer of the HTML and current
maintainer of the CSS standards, has encouraged the use of CSS over explicit presentational
HTML.
BENEFITS
o Web pages development. HTML is heavily used for creating pages thatare
displayed on the world wideweb.
o Web document Creation.
o Internet navigation.
o Cutting edgefeature.
o Responsive images on webpages.
o Client-sidestorage.
o Offline capabilitiesusage.
o Data Entry support with HTML.
17
CSS
Cascading Style Sheets (CSS) is a style sheet language used for describing
the presentation of a document written in a markup language like HTML. CSS is a cornerstone
technology of the World Wide Web, alongside HTML andJavaScript.
CSS Selectors
18
PYTHON:
Python supports multiple programming paradigms, including Procedural, Object Oriented and
Functional programming language. Python design philosophy emphasizes code readability with the
use of significant indentation.
This tutorial gives a complete understanding of Python programming language starting from basic
conceopts to advanced concepts. This tutorial will take you through simple and practical
approaches while learning Python Programming language.
Pythonwasdesignedforreadability,andhassomesimilaritiestotheEnglishlanguagewith influ-
ence from mathematics.
Python uses new lines to complete a command, as opposed to other programming lan-
guages which often use semicolons or parentheses.
Pythonreliesonindentation,usingwhitespace,todefinescope;suchasthescopeofloops, func-
tions and classes. Other programming languages often use curly-brackets for this purpose.
19
Python Online Compiler/Interpreter
We have provided Python Online Compiler/Interpreter which helps you to Edit and Execute the
code directly from your browser. Try to click the icon to run the following Python code to print
conventional "Hello, World!".
Below code box allows you to change the value of the code. Try to change the value
inside print() and run it again to verify the result.
If you know Python nicely, then you have a great career ahead. Here are just a few of the career
options where Python is a key skill:
Game developer
Web designer
Python developer
Full-stack developer
Machine learning engineer
Data scientist
Data analyst
Data engineer
DevOps engineer
Software engineer
Many more other roles
Characteristics of Python
20
It supports functional and structured programming methods as well as OOP.
It can be used as a scripting language or can be compiled to byte-code for building large ap-
plications.
It provides very high-level dynamic data types and supports dynamic type checking.
It supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Applications of Python
The latest release of Python is 3.x. As mentioned before, Python is one of the most widely used
language over the web. I'm going to list few of them here:
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
Easy-to-maintain − Python's source code is fairly easy-to-maintain.
A broad standard library − Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same inter-
face on all platforms.
Extendable − You can add low-level modules to the Python interpreter. These modules en-
able programmers to add to or customize their tools to be more efficient.
Databases − Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs than shell
scripting.
21
The Python syntax defines a set of rules that are used to create Python statements while writing a
Python Program. The Python Programming Language Syntax has many similarities to Perl, C, and
Java Programming Languages. However, there are some definite differences between the
languages.
We can invoke a Python interpreter from command line by typing python at the command prompt
as following −
$ python
Python 3.6.8 (default, Sep 10 2021, 09:13:53)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Here >>> denotes a Python Command Prompt where you can type your commands. Let's type the
following text at the Python prompt and press the Enter −
If you are running older version of Python, like Python 2.4.x, then you would need to use print
statement without parenthesis as in print "Hello, World!". However in Python version 3.x, this
produces the following result −
Hello, World!
Python - Script Mode Programming
We can invoke the Python interpreter with a script parameter which begins the execution of the
script and continues until the script is finished. When the script is finished, the interpreter is no
longer active.
Let us write a simple Python program in a script which is simple text file. Python files have
extension .py. Type the following source code in a test.py file −
22
print ("Hello, World!")
We assume that you have Python interpreter path set in PATH variable. Now, let's try to run this
program as follows −
$ python test.py
Hello, World!
Let us try another way to execute a Python script. Here is the modified test.py file −
#!/usr/bin/python
We assume that you have Python interpreter available in /usr/bin directory. Now, try to run this
program as follows −
Hello, World!
Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other object. An
identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
Python does not allow punctuation characters such as @, $, and % within identifiers.
Python is a case sensitive programming language. Thus, Manpower and manpower are two
different identifiers in Python.
Python Class names start with an uppercase letter. All other identifiers start with a lowercase
letter.
23
Starting an identifier with a single leading underscore indicates that the identifier
is private identifier.
Starting an identifier with two leading underscores indicates a strongly private identifier.
If the identifier also ends with two trailing underscores, the identifier is a language-
defined special name.
The following list shows the Python keywords. These are reserved words and you cannot use them
as constant or variable or any other identifier names. All the Python keywords contain lowercase
letters only.
and as assert
global if import
in is lambda
or pass raise
Python programming provides no braces to indicate blocks of code for class and function
definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly
24
enforced.
The number of spaces in the indentation is variable, but all statements within the block must be
indented the same amount. For example −
if True:
print ("True")
else:
print ("False")
if True:
print ("Answer")
print ("True")
else:
print ("Answer")
print ("False")
Thus, in Python all the continuous lines indented with same number of spaces would form a block.
The following example has various statement blocks −
Do not try to understand the logic at this point of time. Just make sure you understood various
blocks even if they are without braces.
import sys
try:
except IOError:
sys.exit()
25
print "Enter '", file_finish,
if file_text == file_finish:
file.close
break
file.write(file_text)
file.write("\n")
file.close()
if len(file_name) == 0:
sys.exit()
try:
except IOError:
sys.exit()
file_text = file.read()
file.close()
print file_text
Statements in Python typically end with a new line. Python does, however, allow the use of the line
26
continuation character (\) to denote that the line should continue. For example −
total = item_one + \
item_two + \
item_three
Statements contained within the [], {}, or () brackets do not need to use the line continuation
character. For example following statement works well in Python −
'Thursday', 'Friday']
Quotations in Python
Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as
the same type of quote starts and ends the string.
The triple quotes are used to span the string across multiple lines. For example, all the following
are legal −
word = 'word'
Comments in Python
Just like most modern languages, Python supports single-line (or end-of-line) and multi-line (block)
comments. Python comments are very much similar to the comments available in PHP, BASH and
Perl Programming languages.
27
A hash sign (#) that is not inside a string literal begins a comment. All characters after the # and up
to the end of the physical line are part of the comment and the Python interpreter ignores them.
# First comment
Hello, World!
You can type a comment on the same line after a statement or expression −
# This is a comment.
Following triple-quoted string is also ignored by Python interpreter and can be used as a multiline
comments:
'''
This is a multiline
comment.
'''
A line containing only whitespace, possibly with a comment, is known as a blank line and Python
totally ignores it.
In an interactive interpreter session, you must enter an empty physical line to terminate a multiline
statement.
28
Waiting for the User
The following line of the program displays the prompt, the statement saying “Press the enter key to
exit”, and waits for the user to take action −
#!/usr/bin/python
Here, "\n\n" is used to create two new lines before displaying the actual line. Once the user presses
the key, the program ends. This is a nice trick to keep a console window open until the user is done
with an application.
The semicolon ( ; ) allows multiple statements on the single line given that neither statement starts
a new code block. Here is a sample snip using the semicolon −
A group of individual statements, which make a single code block are called suites in Python.
Compound or complex statements, such as if, while, def, and class require a header line and a suite.
Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are
followed by one or more lines which make up the suite. For example −
if expression :
suite
elif expression :
suite
else :
suite
Many programs can be run to provide you with some basic information about how they should be
29
run. Python enables you to do this with -h −
$ python -h
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-c cmd : program passed in as string (terminates option list)
-d : debug output from parser (also PYTHONDEBUG=x)
-E : ignore environment variables (such as PYTHONPATH)
-h : print this help message and exit
[ etc. ]
You can also program your script in such a way that it should accept various options. Command
Line Arguments is an advanced topic and should be studied a bit later once you have gone through
rest of the Python concepts.
30
Key features of the Django framework include:
Object-Relational Mapping (ORM): Django provides an ORM that enables developers to in-
teract with the database using Python code instead of writing raw SQL queries. It supports
multiple database backends and simplifies database operations, including querying, data in-
sertion, and updates.
URL Routing: Django's URL routing mechanism allows developers to map URLs to views
and functions in the application. It enables clean and customizable URLs, making the appli-
cation's structure more readable and user-friendly.
Template Engine: Django includes a powerful template engine that separates the presentation
logic from the business logic. Developers can create dynamic HTML templates with built-in
template tags and filters, allowing for code reuse and maintainability.
Form Handling: Django simplifies form handling by providing a forms module. It allows de-
velopers to define and validate forms using Python classes, automating tasks like data valida-
tion, error handling, and displaying form fields.
Security Features: Django includes several security features to protect web applications from
common vulnerabilities. It provides protection against cross-site scripting (XSS), cross-site
request forgery (CSRF), and SQL injection attacks.
31
Internationalization and Localization: Django supports internationalization and localization,
allowing developers to build applications that can be easily translated into different languages
and localized for various regions.
Testing Framework: Django provides a testing framework that helps developers write unit
tests and integration tests for their applications. It simplifies the process of writing test cases
and running tests to ensure the application's stability and reliability.
Model:
In Django, the data is delivered as an Object Relational Mapping (ORM), which is a technique
designed to make it easier to work with databases.
The most common way to extract data from a database is SQL. One problem with SQL is that you
have to have a pretty good understanding of the database structure to be able to work with it.
Django, with ORM, makes it easier to communicate with the database, without having to write
complex SQL statements.
32
BACKEND: SQLite
SQLite
SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not
have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete
SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.
The database file format is cross-platform - you can freely copy a database between 32-bit and 64-
bit systems or between big-endian and little-endian architectures. These features make SQLite a
popular choice as an Application File Format. SQLite database files are a recommended storage
format by the US Library of Congress. Think of SQLite not as a replacement for Oracle but as a
replacement for fopen()
SQLite is a compact library. With all features enabled, the library size can be less than 750KiB,
depending on the target platform and compiler optimization settings. (64-bit code is larger. And
some compiler optimizations such as aggressive function inlining and loop unrolling can cause the
object code to be much larger.) There is a tradeoff between memory usage and speed. SQLite
generally runs faster the more memory you give it. Nevertheless, performance is usually quite good
even in low-memory environments. Depending on how it is used, SQLite can be faster than direct
filesystem I/O.
SQLite is very carefully tested prior to every release and has a reputation for being very reliable.
Most of the SQLite source code is devoted purely to testing and verification. An automated test
suite runs millions and millions of test cases involving hundreds of millions of individual SQL
statements and achieves 100% branch test coverage. SQLite responds gracefully to memory
allocation failures and disk I/O errors. Transactions are ACID even if interrupted by system crashes
or power failures. All of this is verified by the automated tests using special test harnesses which
33
simulate system failures. Of course, even with all this testing, there are still bugs. But unlike some
similar projects (especially commercial competitors) SQLite is open and honest about all bugs and
provides bugs lists and minute-by-minute chronologies of code changes.
The SQLite code base is supported by an international team of developers who work on SQLite
full-time. The developers continue to expand the capabilities of SQLite and enhance its reliability
and performance while maintaining backwards compatibility with the published interface
spec, SQL syntax, and database file format. The source code is absolutely free to anybody who
wants it, but professional support is also available.
The SQLite project was started on 2000-05-09. The future is always hard to predict, but the intent
of the developers is to support SQLite through the year 2050. Design decisions are made with that
objective in mind.
We the developers hope that you find SQLite useful and we entreat you to use it well: to make good
and beautiful products that are fast, reliable, and simple to use. Seek forgiveness for yourself as you
forgive others. And just as you have received SQLite for free, so also freely give, paying the debt
forward.
SQLite - Commands
This chapter will take you through simple and useful commands used by SQLite programmers.
These commands are called SQLite dot commands and exception with these commands is that they
should not be terminated by a semi-colon (;).
Let's start with typing a simple sqlite3 command at command prompt which will provide you with
SQLite command prompt where you will issue various SQLite commands.
$sqlite3
SQLite version 3.3.6
Enter ".help" for instructions
sqlite>
For a listing of the available dot commands, you can enter ".help" any time. For example −
sqlite>.help
34
SQLite - Syntax
SQLite is followed by unique set of rules and guidelines called Syntax. This chapter lists all
the basic SQLite Syntax.
Case Sensitivity
The important point to be noted is that SQLite is case insensitive, i.e. the
clauses GLOB and glob have the same meaning in SQLite statements.
Comments
SQLite comments are extra notes, which you can add in your SQLite code to increase its
readability and they can appear anywhere; whitespace can occur, including inside expressions
and in the middle of other SQL statements but they cannot be nested.
SQL comments begin with two consecutive "-" characters (ASCII 0x2d) and extend up to and
including the next newline character (ASCII 0x0a) or until the end of input, whichever comes
first.
You can also use C-style comments, which begin with "/*" and extend up to and including the
next "*/" character pair or until the end of input, whichever comes first. C-style comments
can span multiple lines.
SQLite Statements
All the SQLite statements start with any of the keywords like SELECT, INSERT, UPDATE,
DELETE, ALTER, DROP, etc., and all the statements end with a semicolon (;).
or
ANALYZE database_name;
or
ANALYZE database_name.table_name;
35
SQLite AND/OR Clause
SELECT column1, column2....columnN
FROM table_name
WHERE CONDITION-1 {AND|OR} CONDITION-2;
column1 datatype,
36
column2 datatype,
column3 datatype,
.....
columnN datatype,
stmt2;
....
END;
SELECT statement....;
37
SQLite DETACH DATABASE Statement
DETACH DATABASE 'Alias-Name';
FROM table_name;
or
EXPLAIN QUERY PLAN SELECT statement...;
38
SQLite HAVING Clause
SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name
HAVING (arithematic function condition);
SQLite IN Clause
SELECT column1, column2....columnN
FROM table_name
WHERE column_name IN (val-1, val-2,...val-N);
For example:
PRAGMA page_size;
39
PRAGMA cache_size = 1024;
PRAGMA table_info(table_name);
REINDEX database_name.index_name;
REINDEX database_name.table_name;
or
ROLLBACK TO SAVEPOINT savepoint_name;
FROM table_name;
40
Django Introduction
Django is a Python framework that makes it easier to create web sites using Python.
Django takes care of the difficult stuff so that you can concentrate on building your web
applications.
Model - The data you want to present, usually data from a database.
View - A request handler that returns the relevant template and content - based on the
request from the user.
Template - A text file (like an HTML file) containing the layout of the web page, with
logic on how to display the data.
Model
The most common way to extract data from a database is SQL. One problem with SQL is that
you have to have a pretty good understanding of the database structure to be able to work
with it.
Django, with ORM, makes it easier to communicate with the database, without having to
write complex SQL statements.
41
View
A view is a function or method that takes http requests as arguments, imports the relevant
model(s), and finds out what data to send to the template, and returns the final result.
Template
A template is a file where you describe how the result should be represented.
Templates are often .html files, with HTML code describing the layout of a web page, but it
can also be in other file formats to present other results, but we will concentrate on .html
files.
Django uses standard HTML to describe the layout, but uses Django tags to add logic:
<h1>My Homepage</h1>
URLs
Django also provides a way to navigate around the different pages in a website.
When a user requests a URL, Django decides which view it will send it to.
When you have installed Django and created your first Django web application, and the
browser requests the URL, this is basically what happens:
1. Django receives the URL, checks the urls.py file, and calls the view that matches
the URL.
2. The view, located in views.py, checks for relevant models.
42
3. The models are imported from the models.py file.
4. The view then sends the data to a specified template in the template folder.
5. The template contains HTML and Django tags, and with the data it returns finished
HTML content back to the browser.
Django can do a lot more than this, but this is basically what you will learn in this tutorial,
and are the basic steps in a simple web application made with Django.
To check if your system has Python installed, run this command in the command prompt:
python --version
If Python is installed, you will get a result with the version number, like this
Python 3.9.2
If you find that you do not have Python installed on your computer, then you can download it
for free from the following website: https://www.python.org/
PIP
To install Django, you must use a package manager like PIP, which is included in Python
from version 3.4.
To check if your system has PIP installed, run this command in the command prompt:
pip --version
If PIP is installed, you will get a result with the version number.
If you do not have PIP installed, you can download and install it from this
page: https://pypi.org/project/pip/
43
Virtual Environment
It is suggested to have a dedicated virtual environment for each Django project, and one way
to manage a virtual environment is venv, which is included in Python.
The name of the virtual environment is your choice, in this tutorial we will call it myworld.
Type the following in the command prompt, remember to navigate to where you want to
create your project:
Windows:
py -m venv myworld
Unix/MacOS:
This will set up a virtual environment, and create a folder named "myworld" with subfolders
and files, like this:
myworld
Include
Lib
Scripts
pyvenv.cfg
Windows:
myworld\Scripts\activate.bat
Unix/MacOS:
source myworld/bin/activate
Django is a web framework used for rapid development with a clean, pragmatic, maintain-
able, and secure design. It is open-source and written in Python. A web application frame-
work is a toolkit of all components needed for application development. The main goal of the
44
Django framework is to allow developers to focus on new components of the application in-
stead of spending time on already developed components. Many other frameworks on the
market have fewer features than it. It takes care of a lot of hassle. Involved in web develop -
ment, users can focus on developing components needed for their application.
45
CHAPTER-III
SYSTEM STUDY
46
3. SYSTEM STUDY
47
3.2 Proposed System
Online stores are usually available 24 hours a day, and many consumers have Internet
access both at work and at home.
Other establishments such as internet cafes and schools provide access as well. A visit
to a conventional retail store requires travel and must take place during business
hours.
Searching or browsing an online catalog can be faster than browsing the aisles of a
physical store.
One can avoid crowded malls resulting in long lines, and no parking. Consumers with
dial-up Internet connections rather than broadband have much longer load times for
content-rich web sites and have a considerably slower online shopping experience.
Some consumers prefer interacting with people rather than computers because they
find computers hard to use.
Not all online retailers have succeeded in making their sites easy to use or reliable. On
the other hand, a majority of stores have made it easy to find the style one is looking
for, as well as the price range that is acceptable making the shopping experience quick
and efficient.
The internet has made shopping an almost effortless task.
Sends receipt to customer
Accommodates up to four types of shipping
Allows owner to predefine sales tax based a specific state
Tracks purchases even if user clicks the back button
It provides high level of security using different protocols like https etc.
48
49
CHAPTER-IV
REVIEW OF LITERATURE
50
"The Impact of web based application Agricultural Extension Services on Farmers'
Knowledge and Adoption of Improved Practices" (Labarta et al., 2013): This study eval-
uated the impact of a mobile phone-based farmer information application on smallholder
farmers' knowledge and adoption of improved agricultural practices. The findings revealed
that farmers who had access to the application demonstrated a higher level of knowledge and
were more likely to adopt recommended practices. This increased knowledge and adoption
positively influenced their agricultural sales and income.
"Farmers' Use of Mobile Phones for Information Seeking: A Case Study in Rural In-
dia" (Kumar and Singh, 2018): This study examined the use of mobile phones by farmers
in rural India for accessing agricultural information. The findings indicated that farmers who
regularly used mobile phones to access relevant information experienced improved decision-
making abilities, enhanced productivity, and increased sales. The convenience and timeliness
of information received through mobile phones positively impacted farmers' sales perform-
ance.
"The Role of web based in Agricultural Extension Services Delivery: The Case of e-Hakimi
Application in Nigeria" (Tijani et al., 2019): This study investigated the impact of a mobile
phone-based agricultural extension application called e-Hakimi on farmers' access to market
information and sales performance in Nigeria. The results indicated that farmers who used the
application experienced increased sales and improved market integration. The application
provided real-time market prices, facilitated communication with potential buyers, and en-
abled farmers to make informed sales decisions, thereby positively influencing their sales
outcomes.
51
"web based Applications for Agricultural Development: A Systematic Review of the
Literature" (Haque et al., 2018): This systematic review examined the literature on mobile
phone applications for agricultural development, including farmer information applications.
The findings indicated that these applications have the potential to significantly improve
farmers' access to information, market linkages, and sales. The ability to receive real-time
market prices, weather updates, and expert advice positively influenced farmers' decision-
making and sales outcomes.
52
Zuraida Muhammad, Muhammad Azri Asyraf Mohd Hafez, Nor Adni MatLeh, Zakiah
Mohd Yusoff , Shabinar Abd Hamid [1] The term "Internet of Things" refers to the
connection of objects, equipment, vehicles, and other electronic devices to a network for the
purpose of data exchange (IoT). The Internet of Things (IoT) is increasingly being utilised to
connect objects and collect data. As a result, the Internet of Things' use in agriculture is
crucial. The idea behind the project is to create a smart agriculture system that is connected to
the internet of things. The technology is combined with an irrigation system to deal with
Malaysia's variable weather. This system's microcontroller is a Raspberry Pi 4 Model B. The
temperature and humidity in the surrounding region, as well as the moisture level of the soil,
are monitored using the DHT22 and soil moisture sensor. The data will be available on both a
smartphone and a computer. As a result, Internet of Things (IoT) and Raspberry Pi-based
Smart Agriculture Systems have a significant impact on how farmers work. It will have a
good impact on agricultural productivity as well. In Malaysia, employing IoT-based irrigation
systems saves roughly 24.44 percent per year when compared to traditional irrigation
systems. This would save money on labour expenditures while also preventing water waste in
daily needs.
Divya J., Divya M.,Janani V. [2] Agriculture is essential to India's economy and people's
survival. The purpose of this project is to create an embedded-based soil monitoring and
irrigation system that will reduce manual field monitoring and provide information via a
mobile app. The method is intended to help farmers increase their agricultural output. A pH
sensor, a temperature sensor, and a humidity sensor are among the tools used to examine the
soil. Based on the findings, farmers may plant the best crop for the land. The sensor data is
sent to the field manager through Wi-Fi, and the crop advice is created with the help of the
mobile app. When the soil temperature is high, an automatic watering system is used. The
crop image is gathered and forwarded to the field manager for pesticide advice.
53
updated to allow remote monitoring of these parameters through the internet. In real time,
these field weather variables are stored in a remote database. Finally, based on the present
weather conditions, a weather prediction algorithm is employed to manage water distribution.
Farmers would be able to irrigate their crops more efficiently with the proposed smart
irrigation system.
Anushree Math, Layak Ali, Pruthviraj U[4] India is a country where agriculture plays a
vital role. As a result, it's critical to water the plants wisely in order to maximise yield per unit
space and so achieve good output. Irrigation is the process of providing a certain amount of
water to plants at a specific time. The purpose of this project is to water the plants on the
National Institute of Technology Karnataka campus with a smart drip irrigation system. To do
this, the open source platform is used as the system's fundamental controller. Various sensors
have been employed to supply the current parameters of components that impact plant
healthiness on a continual basis. By controlling a solenoid valve, water is provided to the
plants at regular intervals depending on the information acquired from the RTC module. The
webpage may be used to monitor and manage the complete irrigation system. This website
contains a function that allows you to manually or automatically control plant watering. The
health of the plants is monitored using a Raspberry Pi camera that gives live streaming to the
webpage. The controller receives water flow data from the water flow sensor through a
wireless network. The controller analyses this data to see if there are any leaks in the pipe.
Forecasting the weather is also done to restrict the quantity of water given, making it more
predictable and efficient.
Dweepayan Mishra, Arzeena Khan, Rajeev Tiwari, Shuchi Upadhaye [5] Agriculture is
a substantial source of revenue for Indians and has a huge impact on the Indian economy.
Crop development is essential for enhanced yield and higher-quality delivery. As a result,
crop beds with ideal conditions and appropriate moisture can have a big influence on output.
Traditional irrigation systems, such as stream flows from one end to the other, are usually
used. As a result of this delivery, the moisture levels in the fields can alter. A designed
watering system can help to enhance the management of the water system. This research
proposes a terrain-specific programmable water system that will save human work while
simultaneously improving water efficiency and agricultural productivity. The setup is made
up of an Arduino kit, a moisture sensor, and a Wi-Fi module. Data is acquired by connecting
our experimental system to a cloud framework. After then, cloud services analyse the data
and take the necessary actions.
54
R. Nageswara Rao, B.Sridhar [6] Agrarian countries like India rely heavily on agriculture
for their development. Agriculture has always been a roadblock to the country's development.
Smart agriculture, which comprises modernising present agricultural systems, is the only
answer to this challenge. As a result, the suggested strategy attempts to use automation and
Internet of Things technologies to make agriculture smarter. Crop growth monitoring and
selection, irrigation decision assistance, and other uses are possible thanks to the Internet of
Things (IoT). To modernise and boost crop yield, a Raspberry Pi-based autonomous irrigation
IOT system has been proposed. This project's main purpose is to produce crops using the
least amount of water possible. Most farmers waste a lot of time in the fields in order to focus
on water available to plants at the appropriate time. Water management should be improved,
and the system circuit's complexity should be minimised. Based on the data collected from
the sensors, the suggested system determines the amount of water required. Two sensors
detect the humidity and temperature of the soil, as well as the humidity, temperature, and
length of sunshine each day, and send the data to the base station. Based on these
characteristics, the recommended systems must calculate the irrigation water quantity. The
key benefit of the system is the integration of Precision Agriculture (PA) and cloud
computing, which will reduce water fertiliser consumption while increasing crop yields and
assisting in the evaluation of field weather conditions.
Shweta B. Saraf, Dhanashri H. Gawali [7] The Internet of Things (IoT) is the internet-
based connectivity of a huge number of devices (IoT). A unique identity links each item,
allowing data to be sent without human involvement It makes it possible to develop strategies
for improved natural resource management. Smart gadgets with sensors, according to the IoT
concept, enable interaction with the physical and logical worlds. The proposed system in this
study is built on the Internet of Things and uses real-time input data. Over a wireless sensor
network, a smart farm irrigation system uses an Android phone to remotely monitor and
regulate drips. Between sensor nodes and base stations, Zigbee is utilised to communicate. A
web-based java graphical user interface is used to process and present the server's real-time
observed data. Field irrigation system wireless monitoring eliminates human interaction and
enables for remote monitoring and control using an Android phone.
Cloud computing is a potential choice due to the large volume of data created by the wireless
sensor network. This research presents and examines a cloud-based wireless communication
system for monitoring and controlling a collection of sensors and actuators in order to
determine the water needs of plants.
55
Shrihari M[8] The concept of automating agricultural production has been around since the
early 1990s, and one of the primary challenges that both scientists and farmers confront is
irrigation. Irrigation is a dynamic system that is heavily reliant on outside influences. This
article describes a method that uses a custom-built mathematical model to handle data from
wireless sensors on Google Cloud, resulting in a smart system. An IoT-enabled design that
can scale up to big farms. According to Holistic Agricultural Studies, around 35 have been
damaged by animals and people. This intelligent system uses Tensor flow and deep learning
neural networks to recognise animals depending on their threat level, as well as human
intruders who are not authorised on the farm, and to alert the farmer immediately. An android
application is included with the device, which allows for remote access and surveillance
through live video streaming.
G. Sushanth, and S. Sujatha [9] Smart agriculture is a novel concept since IoT sensors can
offer information about agricultural regions and then act on it based on user input. The
purpose of this study is to develop a smart agricultural system that utilises cutting-edge
technologies such as Arduino, Internet of Things, and wireless sensor networks. Through
automation, the research tries to take use of emerging technologies such as the Internet of
Things (IoT) and smart agriculture. The capacity to monitor environmental factors is a critical
component in increasing crop efficiency. The purpose of this study is to develop a system that
can monitor temperature, humidity, wetness, and even the movement of animals that might
damage crops in agricultural areas using sensors, and then send an SMS notification as well
as a notification on the app developed for the same to the farmer's smartphone via
Wi-Fi/3G/4G if there is a discrepancy. The system uses a duplex communication link based
on a cellular Internet interface, which allows data inspection and irrigation schedule to be
changed using an android app. Because of its energy independence and inexpensive cost, the
gadget has the potential to be useful in water-scarce, geographically isolated areas.
Vaishali S, Suraj S, Vignesh G, Dhivya S and Udhayakumar S [10] From the beginning
of time, agriculture has been the most important practise in human society. Traditional
irrigation methods, such overhead sprinklers and flood irrigation, are inefficient. They waste
a lot of water and may even make people sick by causing fungus growth in the soil due to too
much moisture. Due to the scarcity of water, an automated irrigation system is essential for
water conservation and, as a result, agricultural profitability. Irrigation consumes around 85%
of the world's total accessible water resources. This need is projected to increase in the
coming years as the population grows. To meet this need, we must employ creative methods
56
that lower the quantity of water utilised in irrigation. Sensors in the automated system
monitor the availability of water to the crops, and watering is done as needed through
controlled irrigation. Because of its practically limitless storage and processing capabilities,
as well as its fast flexibility, cloud computing is an intriguing solution to the massive amount
of data generated
57
CHAPTER-V
58
5. SYSTEMDESIGN AND DEVELOPMENT
Design is the first step in the development phase for any techniques and principles for the
purpose of defining a device, a process or system in sufficient detail to permit its physical
realization.
Once the software requirements have been analysed and specified the software design
involves three technical activities - design, coding, implementation and testing that are
required to build and verify the software.
The design activities are of main importance in this phase, because in this activity, decisions
ultimately affecting the success of the software implementation and its ease of maintenance
are made. These decisions have the final bearing upon reliability and maintainability of the
system. Design is the only way to accurately translate the customer’s requirements into
finished software or a system.
Design is the place where quality is fostered in development. Software design is a process
through which requirements are translated into a representation of software. Software design
is conducted in two steps. Preliminary design is concerned with the transformation of
requirements into data.
59
5.1 DATAFLOW DIAGRAM
A data flow diagram is graphical tool used to describe and analyze movement of data
through a system. These are the central tool and the basis from which the other components
are developed. The transformation of data from input to output, through processed, may be
described logically and independently of physical components associated with the system.
These are known as the logical data flow diagrams.
The physical data flow diagrams show the actual implements and movement of data
between people, departments and workstations. A full description of a system actually
consists of a set of data flow diagrams. Using two familiar notations Yourdon, Gane and
Sarson notation develops the data flow diagrams. Each component in a DFD is labeled with a
descriptive name. Process is further identified with a number that will be used for
identification purpose.
The development of DFD’S is done in several levels. Each process in lower level
diagrams can be broken down into a more detailed DFD in the next level. The lop-level
diagram is often called context diagram. It consists a single process bit, which plays vital role
in studying the current system. The process in the context level diagram is exploded into
other process at the first level DFD.
The idea behind the explosion of a process into more process is that understanding at
one level of detail is exploded into greater detail at the next level. This is done until further
explosion is necessary and an adequate amount of detail is described for analyst to understand
the process.
Larry Constantine first developed the DFD as a way of expressing system
requirements in a graphical from, this lead to the modular design.
A DFD is also known as a “bubble Chart” has the purpose of clarifying system
requirements and identifying major transformations that will become programs in system
design. So it is the starting point of the design to the lowest level of detail. A DFD consists
of a series of bubbles joined by data flows in the system.
60
DFD SYMBOLS:
In the DFD, there are four symbols
1. A square defines a source(originator) or destination of system data
2. An arrow identifies data flow. It is the pipeline through which the information flows
3. A circle or a bubble represents a process that transforms incoming data flow into outgoing
data flows.
4. An open rectangle is a data store, data at rest or a temporary repository of data
Data flow
Data Store
CONSTRUCTING A DFD:
Several rules of thumb are used in drawing DFD’S:
1. Process should be named and numbered for an easy reference. Each name should be rep-
resentative of the process.
2. The direction of flow is from top to bottom and from left to right. Data traditionally flow
from source to the destination although they may flow back to the source. One way to in-
dicate this is to draw long flow line back to a source. An alternative way is to repeat the
source symbol as a destination. Since it is used more than once in the DFD it is marked
with a short diagonal.
3. When a process is exploded into lower level details, they are numbered.
4. The names of data stores and destinations are written in capital letters. Process and data-
flow names have the first letter of each work capitalized
61
5.2 INPUT DESIGN
Input design is a part of overall system design. The main objective during the input design as
given below:
To produce cost-effective method of input
Input States:
The main input stages can be listed as below:
Data recording
Data transcription
Data conversion
Data verification
Data control
Data transmission
Data validation
Data correction
Input Types:
It is necessary to determine the various types of input. Inputs can be categorized as follows:
External Inputs which are prime inputs for the system.
Input Media:
At this stage choice has to be made about the input media. To conclude about the input media
consideration has to be given to:
Type of Input
Flexibility of Format
62
Speed
Accuracy
Verification methods
Rejection rates
Ease of correction
Security
Easy to use
Portability
Keeping in view the above description of the input types and input media, it can be said that
most of the inputs are of the form of internal and interactive. As input data is to be directly
keyed in by the user, the keyboard can be considered to be the most suitable input device.
SAMPLE INPUT DESIGN:
63
64
5.3 OUTPUT DESIGN
Outputs from computer systems are required primarily to communicate the results of
processing to users. They are also used to provide a permanent copy of the results for later
consultation. The various types of outputs in general are:
External Outputs, whose destination is outside the organization,.
Internal Outputs whose destination is within organization and they are the
User’s main interface with the computer.
Operational outputs whose use is purely within the computer department.
Interface outputs, which involve the user in communicating directly with User Inter-
face.
Output Definition: The outputs should be defined in terms of the following points:
Type of the output
Content of the output
Format of the output
Location of the output
Frequency of the output
Volume of the output
Sequence of the output
Output Media:
In the next stage it is to be decided that which medium is the most appropriate for the output.
The main considerations when deciding about the output media are:
The suitability for the device to the particular application.
The need for a hard copy.
The response time required.
The location of the users
65
The software and hardware available.
Keeping in view the above description the project is to have outputs mainly coming under the
category of internal outputs. The main outputs desired according to the requirement
specification are: The outputs were needed to be generated as a hot copy and as well as
queries to be viewed on the screen. Keeping in view these outputs, the format for the output
is taken from the outputs, which are currently being obtained after manual processing. The
standard printer is to be used as output media for hard copies
SAMPLE OUT PUTS:
66
67
68
5.4 DATABASE DESIGN
Database design can be generally defined as a collection of tasks or processes that enhance
the designing, development, implementation, and maintenance of enterprise data management
system. Designing a proper database reduces the maintenance cost thereby improving data
consistency and the cost-effective measures are greatly influenced in terms of disk storage
space. Therefore, there has to be a brilliant concept of designing a database. The designer
should follow the constraints and decide how the elements correlate and what kind of data
must be stored.
The main objectives behind database designing are to produce physical and logical design
models of the proposed database system. To elaborate this, the logical model is primarily
concentrated on the requirements of data and the considerations must be made in terms of
monolithic considerations and hence the stored physical data must be stored independent of
the physical conditions. On the other hand, the physical database design model includes a
translation of the logical design model of the database by keep control of physical media
using hardware resources and software systems such as Database Management System
(DBMS).
Database design is a critical aspect of building an efficient and effective application. It in-
volves designing the structure, organization, and relationships of the database to store and re-
trieve data accurately and efficiently. Here are some key considerations and steps involved in
the process of database design:
Requirements Analysis: Start by understanding the requirements of your application and the
data it needs to store. Identify the entities (objects) that will be represented in the database
and the relationships between them.
Conceptual Design: Create a conceptual model that represents the high-level view of the
database structure. This can be done using entity-relationship diagrams (ERDs), which depict
entities, attributes, and relationships between entities.
69
Normalize the Data: Normalize the data by applying normalization rules to ensure data integ -
rity and minimize redundancy. This involves breaking down data into smaller, logical units to
avoid data duplication and update anomalies.
Define Tables and Columns: Based on the conceptual model, define the tables and their
columns in the database. Identify primary keys, which uniquely identify each record, and
define appropriate data types for each column.
Establish Relationships: Define the relationships between tables using foreign keys. This en-
sures referential integrity and establishes the connections between related data.
Indexing: Identify the columns that will be frequently used for searching or sorting and con-
sider adding indexes on those columns. Indexing can significantly improve query perform-
ance.
Set Constraints: Implement constraints such as unique constraints, not-null constraints, and
foreign key constraints to maintain data integrity and enforce business rules.
Consider Performance and Scalability: Design the database with performance and scalability
in mind. Consider factors like anticipated data volumes, query patterns, and potential growth
to optimize performance and ensure the database can handle increasing demands.
Security: Implement appropriate security measures to protect the data. This may include de -
fining user roles and permissions, encrypting sensitive data, and implementing secure authen-
tication and access control mechanisms.
Testing and Refinement: Test the database design thoroughly to ensure it meets the require-
ments and performs as expected. Make any necessary refinements based on feedback and
testing results.
70
5.5 MODULE DESCRIPTION
Login Module: –
This will help farmer/vendor/public to login into the system using id and
password. A farmer/vendor/public who has the valid id and password can
only login to their respective accounts. It will help the authentication of
the farmer/vendor/public who enters the system.
Admin Module
Login: Admin login into the system using id and password.
Add Farming Information: He can add the forming details that is use-
ful for farmers.
Add Market: He can add the market details. Farmer can search the dif-
ferent market in various cities.
Reports: In this module generate reports like market , farmer informa-
tion.
Farmer Module
login: The farmer can fill the registration form and get his credentials.
Add Product: All the details of the product will be uploaded by the
farmer. He will fix the rates of the products. He will add the details of the
item. He can update the details of the item.
Orders: He can view the order details.
Search Market: He can search the different market in various cities.
Payment: He manage the payment details also.
Search Farming: Farmer can also gathering the useful farming informa-
tion.
Vendor Module
Register: Vendor will get the username and password by filling the regis-
tration form. He will view all the details of the product.
71
Search Farmer: He can search the former details also.
Order: He will see the list of products that he want to buy. He order the
bulk of products.
Payment: He can view the sales rate details. The payment details man-
aged by farmer and COD mode.
Public Module
login: Public will get the username and password by filling the registra-
tion form.
Search Farmer: He will view all the details of the product. He can
search the former details also.
Order For Function: He will see the list of products that he want to
buy. He orders the bulk of products for only function.
Payment: He can view the sales rate details. The payment details man-
aged by farmer and COD mode.
72
CHAPTER-VI
TESTING AND IMPLEMENTATION
73
6.1 TESTING
TYPES OF TESTS
Unit testing
Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program inputs produce valid outputs. All decision
branches and internal code flow should be validated. It is the testing of individual software
units of the application .it is done after the completion of an individual unit before
integration. This is a structural testing, that relies on knowledge of its construction and is
invasive. Unit tests perform basic tests at component level and test a specific business
process, application, and/or system configuration. Unit tests ensure that each unique path of a
business process performs accurately to the documented specifications and contains clearly
defined inputs and expected results.
Integration testing
Integration tests are designed to test integrated software components to determine if
they actually run as one program. Testing is event driven and is more concerned with the
basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically aimed
at exposing the problems that arise from the combination of components.
74
Functional test
Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and user
manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures: interfacing systems or procedures must be invoked.
System Test
System testing ensures that the entire integrated software system meets requirements. It
tests a configuration to ensure known and predictable results. An example of system testing is
the configuration oriented system integration test. System testing is based on process
descriptions and flows, emphasizing pre-driven process links and integration points.
75
inputs and responds to outputs without considering how the software works.
Unit Testing:
Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be conducted as
two distinct phases.
Test objectives
All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.
Features to be tested
Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page
Integration Testing
Software integration testing is the incremental integration testing of two or
more integrated software components on a single platform to produce failures caused
by interface defects.
The task of the integration test is to check that components or software
applications, e.g. components in a software system or – one step up – software
applications at the company level – interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
76
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires
significant participation by the end user. It also ensures that the system meets the
functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
SYSTEM IMPLEMENTATION:
Systems design
Conceptual design – what the system should do
Logical design – what the system should look to the user
Physical design – how the system should be built
77
1. how the various program parts/modules of an information system are physically or-
ganized hierarchically
2. how the modules communicate with each other through data couple (data exchange)
and flag (control/message)
3. how the modules are related to each other in terms of sequence, selection, and repeti-
tion
SYSTEM SECURITY
The protection of computer based resources that includes hardware, software, data,
procedures and people against unauthorized use or natural
Disaster is known as System Security.
System Security can be divided into four related issues:
Security
Integrity
Privacy
Confidentiality
SYSTEM SECURITY refers to the technical innovations and procedures applied to the
hardware and operation systems to protect against deliberate or accidental damage from a
defined threat.
78
DATA SECURITY is the protection of data from loss, disclosure, modification and
destruction.
SYSTEM INTEGRITY refers to the power functioning of hardware and programs,
appropriate physical security and safety against external threats such as eavesdropping and
wiretapping.
PRIVACY defines the rights of the user or organizations to determine what information they
are willing to share with or accept from others and how the organization can be protected
against unwelcome, unfair or excessive dissemination of information about it.
CONFIDENTIALITY is a special status given to sensitive information in a database to
minimize the possible invasion of privacy. It is an attribute of information that characterizes
its need for protection.
SECURITY SOFTWARE
System security refers to various validations on data in form of checks and controls to avoid
the system from failing. It is always important to ensure that only valid data is entered and
only valid operations are performed on the system. The system employees two types of
checks and controls:
CLIENT SIDE VALIDATION
Various client side validations are used to ensure on the client side that only valid data
is entered. Client side validation saves server time and load to handle invalid data. Some
checks imposed are:
VBScript in used to ensure those required fields are filled with suitable data only. Maxi-
mum lengths of the fields of the forms are appropriately defined.
Forms cannot be submitted without filling up the mandatory data so that manual mistakes
of submitting empty fields that are mandatory can be sorted out at the client side to save
the server time and load.
Tab-indexes are set according to the need and taking into account the ease of user while
working with the system.
SERVER SIDE VALIDATION
Some checks cannot be applied at client side. Server side checks are necessary to save
the system from failing and intimating the user that some invalid operation has been per-
formed or the performed operation is restricted. Some of the server side checks imposed is:
Server side constraint has been imposed to check for the validity of primary key and for-
eign key. A primary key value cannot be duplicated. Any attempt to duplicate the primary
79
value results into a message intimating the user about those values through the forms us-
ing foreign key can be updated only of the existing foreign key values.
User is intimating through appropriate messages about the successful operations or excep-
tions occurring at server side.
Various Access Control Mechanisms have been built so that one user may not agitate
upon another. Access permissions to various types of users are controlled according to the
organizational structure. Only permitted users can log on to the system and can have ac-
cess according to their category. User- name, passwords and permissions are controlled o
the server side.
IMPLEMENTATION:
a. Database Setup: Create the necessary database tables and establish the required relation-
ships to store and retrieve data accurately.
b. Backend Development: Implement the server-side logic of your application using Python.
This involves integrating data sources, implementing algorithms for analysis and recom-
mendation, and developing sales-related functionalities.
c. Frontend Development: Build the user interface using Python web frameworks like Django
or Flask. Design intuitive and user-friendly screens for farmers to access information, input
data, and perform sales-related tasks.
d. Data Integration: Integrate relevant data sources such as weather APIs, market data feeds,
and agricultural databases. Ensure data flows correctly between the application and external
sources.
e. Deployment: Prepare your application for deployment by configuring the server, setting up
the necessary dependencies, and ensuring the application is secure and optimized for produc-
tion.
f. User Training and Support: Provide necessary training to end-users (farmers) on how to use
the application effectively. Offer ongoing support and address any issues or questions that
may arise.
80
Modular Code Structure: Organize your code into reusable modules and follow a modular
design approach. This helps improve code maintainability, readability, and reusability.
Error Handling: Implement proper error handling mechanisms throughout your application.
Use exception handling to gracefully handle errors and prevent application crashes or security
vulnerabilities.
Version Control: Use a version control system (e.g., Git) to track changes in your codebase,
collaborate with other developers, and facilitate easy rollback or recovery if issues arise.
SYSTEM SECURITY:
Secure Data Transmission: Encrypt data transmitted over the network using secure protocols
such as HTTPS/SSL/TLS. Protect sensitive data from interception and unauthorized access.
Input Validation: Validate and sanitize all user inputs to prevent common security
vulnerabilities like SQL injection, cross-site scripting (XSS), and cross-site request forgery
(CSRF). Use secure coding practices and frameworks that provide built-in protection against
these threats.
81
Secure Database Management: Follow secure database management practices, such as using
parameterized queries or prepared statements to prevent SQL injection attacks. Regularly
update and patch your database management system to address security vulnerabilities.
Session Management: Implement secure session management to ensure the integrity and
confidentiality of user sessions. Use techniques like session encryption, session expiration,
and secure cookie handling to protect against session hijacking or session fixation attacks.
Regular Security Audits and Updates: Conduct regular security audits to identify and address
vulnerabilities in your application. Stay updated with security best practices, frameworks, and
libraries to incorporate the latest security features and patches into your application.
Backup and Disaster Recovery: Implement regular data backups and disaster recovery plans
to ensure data integrity and availability in the event of system failures or security incidents.
82
CHAPTER-VII
CONCLUSION
83
7. CONCLUSION
In this project, the information related to cultivation of all types are provided.
helpline is user friendly for farmers. After enrolment of the farmer’s details, the queries are
given with solution by agriculture expertise. This application has many benefits through
this, farmer can decide the crop to sow based on various climatic changes, so that they can
able to get a good yield while cultivating the crops and also helps for getting information
based on government scheme for particular crops, weather report, seasonable crops to sow,
fertilizer etc.,
Such an application can empower farmers with access to real-time information, per-
sonalized recommendations, and sales-related functionalities. By leveraging Python's capa-
bilities and frameworks like Django or Flask, developers can create a user-friendly inter-
face, integrate data sources, implement data analysis algorithms, and enable sales-related
features.
The project encompasses several stages, including system testing and implementa-
tion. System testing involves conducting unit testing, integration testing, functional testing,
performance testing, and user acceptance testing to ensure the application functions as ex-
pected and meets user requirements. Implementation involves setting up the database, de-
veloping the backend and frontend components, integrating data sources, deploying the ap-
plication, and providing user training and support.
84
It's important to note that the success of the project relies on thorough planning,
careful design, efficient implementation, and continuous improvement. Regular updates, in-
corporating user feedback, and staying updated with technological advancements and best
practices are crucial for the long-term success of the farmer information application.
FUTURE ENHANCEMENT:
The farmer information application for agriculture and sales can be further enhanced in several
ways to provide more value and better meet the evolving needs of farmers. Here are some fu-
ture enhancement ideas for the project:
Mobile Application: Extend the application by developing a mobile version compatible with
iOS and Android platforms. This will allow farmers to access information and perform sales-
related tasks conveniently on their smartphones or tablets, even while they are in the field.
Geolocation Integration: Incorporate geolocation capabilities into the application to provide lo-
cation-specific information and recommendations. This can include localized weather fore-
casts, soil condition analysis, and nearby market information. Geolocation can help farmers
make more informed decisions tailored to their specific location.
Integration with IoT Devices: Explore integrating Internet of Things (IoT) devices, such as soil
moisture sensors, weather stations, or crop monitoring systems, into the application. This inte-
gration would enable farmers to receive real-time data from their fields, allowing them to mon-
itor conditions and make timely adjustments to optimize their farming practices and sales
strategies.
Advanced Analytics and Machine Learning: Utilize advanced analytics and machine learning
algorithms to provide more accurate predictions and personalized recommendations. For exam-
ple, machine learning models can analyze historical data to forecast crop yields, predict market
trends, or identify optimal pricing strategies.
Social Collaboration Features: Implement social collaboration features within the application
to facilitate knowledge sharing and community engagement among farmers. This could include
discussion forums, chat features, and the ability to share success stories, farming techniques,
85
and market insights. Peer-to-peer interaction can foster a sense of community and provide
valuable support to farmers.
Integration with E-Commerce Platforms: Enable direct integration with e-commerce platforms
or online marketplaces to streamline the sales process. Farmers can list their products, manage
inventory, and receive orders directly through the application, simplifying the sales and distri-
bution process.
Multilingual Support: Incorporate multilingual support to cater to farmers from diverse linguis-
tic backgrounds. This will ensure that the application is accessible and usable for farmers who
speak different languages, thus expanding its reach and impact.
By implementing these future enhancements, the farmer information application can evolve
into a comprehensive and indispensable tool for farmers, facilitating informed decision-mak-
ing, improving productivity, and driving sales growth in the agricultural sector.
86
BIBLIOGRAPHY
87
REFERENCE BOOKS
[1] Boyer, J. M. (2008). Interactive Office Documents A New Face for Web 2.0 Applications,
Proceedings of the 2008 ACM Symposium on Document Engineering.
[2] Relaxing the homogeneity assumption in usability testing. Behaviour & Information
Technology, 20 1–7.
[3] Caulton, D. A. (2001Cavana, R., Delahaye, B., & Sekaran, U. (2001). Applied Business
Research Qualitative and Quantitative Methods, John Wiley & Sons, Milton, Queens land.
REFERENCE WEBSITES
www.codeproject.com
www.w3schools.com
www.learnprogramming.com
88
APPENDIX
.
A)DATA FLOW DIAGRAM
Login
management
Vendor
management
89
90
Level 2
91
B) ENTITY RELATIONSHIP DIAGRM
They provide the data at logic level. They are characterized by that fact that they
provide flexible structuring capabilities and allow data constraints to be specified explicitly.
The entity relationship data model is based on a perception of a real world that consists of a
set of basic object entities and relationships among the objects. it was developed to facilities
database design. The ER data model is one of several semantic data modelling. The semantic
aspect of model lies in the attempt to represent the meaning of data. ER model is externally
used in meaning and interactive of real world enterprises.
E-R model has some means of describing the physical database model; it is useful in the
design and communication of the logical database model. In this model, objects of similar
structure are collected into an entity set. The relationship between entity sets is requested by a
named E-R relationship. The database structure employing the E-R model is usually shown
pictorially using entity - relationship (E - R) diagrams.
92
93
USE CASE DIAGRAM:
A use case diagram is a visual representation of the interactions between actors (users or
systems) and the system under consideration. It depicts the functional requirements and the
interactions between various entities involved in a system. Use case diagrams are part of the
Unified Modeling Language (UML), which is a standard notation used for modeling software
systems.
The main purpose of a use case diagram is to illustrate the functionalities provided by a
system from the perspective of users or external systems. It helps in identifying the actors
(users or external systems), defining the system's boundaries, and specifying the various use
cases or actions performed by the actors.
Actors: Actors represent individuals, organizations, or external systems that interact with the
system. Actors are represented by stick figures. They can be primary actors (directly involved
in the system) or secondary actors (indirectly involved in the system).
Use Cases: Use cases represent specific functionalities or actions performed by the actors.
Use cases are represented by ovals or ellipses. They describe the system's behavior from the
user's perspective.
Relationships: Relationships define the associations between actors and use cases. The main
relationship used in a use case diagram is the association relationship, represented by a solid
line connecting an actor to a use case. Other relationships include extends and includes
relationships, which represent optional and mandatory behavior extensions, respectively.
System Boundary: The system boundary represents the scope or boundary of the system
under consideration. It is typically represented by a rectangle that encloses the use cases and
actors.
94
Add Products
Search Market
Farmer
Payment Details
Manage products
Manage orders
Gathering Information
Registrations
View products
Public
Place orders
Search Farmers
Usecase Diagram
95
DATABAE DESIGN
This database used in this project is similar in structure to that of the relational database.
In the document database the data values are maintained as a file in which all the information
are stored in document.
But the relational database is like tables, which are represented, in physical database
as stored files. They have their own independent existence. A table consists of rows and
columns. Each column corresponds to a piece of information called fields. A set of fields
constitutes a record. The record contains all the information, specific to the particular item.
The database design involves creation of tables. Tables are represented in physical
database as stored files. They have their own independent existence. A table consists of rows
and columns. Each column corresponds to a piece of information called field. A set of fields
constitute a record. The record contains all the information, specific to a particular item.
96
Table name : Table user
97
Table name : Table Order
98
Table name : Table Agriproduct Sales
99
Table name : Table Agri product
100
Table name : Table Billing
101
SAMPLE SCREEN SHOTS
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
SAMPLE CODING:
class Category(models.Model):
name = models.CharField(max_length=50)
description = models.CharField(max_length=1000,null=True)
def __str__(self):
return self.name
class Register_Detail(models.Model):
name = models.CharField(max_length=50,unique=True)
address = models.CharField(max_length=50)
mobile = models.CharField(max_length=20)
password = models.CharField(max_length=50)
email = models.EmailField(max_length=50)
user_type = models.CharField(max_length=30,null=True)
def __str__(self):
return self.name
class Product(models.Model):
p_name = models.CharField(max_length=50)
p_price = models.CharField(max_length=50)
category = models.ForeignKey(Category,
on_delete=models.CASCADE)
note = models.TextField(max_length=2000)
expire_date = models.DateField(null=True,blank=True)
image = models.FileField('Upload
Image',upload_to='documents/',null=True)
user_id = models.ForeignKey(Register_Detail,
on_delete=models.CASCADE,null=True)
def __str__(self):
return self.p_name
class Service(models.Model):
service = models.CharField(max_length=50)
date = models.CharField(max_length=50)
time = models.CharField(max_length=20)
member = models.CharField(max_length=50)
note = models.EmailField(max_length=50)
class Cart_Details(models.Model):
user_id = models.ForeignKey(Register_Detail,
on_delete=models.CASCADE,null=True)
book_id = models.CharField(null=True,max_length=30)
product_id = models.ForeignKey(Product,
on_delete=models.CASCADE,null=True)
118
farmer_id = models.IntegerField(null=True)
status = models.CharField(max_length=50)
tot = models.IntegerField(null=True)
tot_price = models.FloatField(null=True)
date = models.DateField(null=True)
class Market_Detail(models.Model):
name = models.CharField(max_length=100)
address = models.CharField(max_length=1000)
city = models.CharField(max_length=100)
area = models.CharField(max_length=100)
state = models.CharField(max_length=100)
image = models.FileField('Upload
Image',upload_to='documents/',null=True)
def __str__(self):
return self.name
class Veg_Detail(models.Model):
market_id = models.ForeignKey(Market_Detail,
on_delete=models.CASCADE)
veg_name = models.CharField(max_length=1000)
quantity = models.CharField(max_length=100)
price = models.CharField(max_length=100)
date = models.DateField(null=True)
image = models.FileField('Upload
Image',upload_to='documents/',null=True)
def __str__(self):
return self.veg_name
class Forming_Detail(models.Model):
name = models.CharField('Vegetable Name',max_length=100)
water_contain = models.TextField('Water Level',max_length=3000)
fertilizer = models.TextField('Fertilizer',max_length=3000)
soil = models.TextField('Nature of Soli',max_length=3000)
others = models.TextField(max_length=3000)
image = models.FileField('Upload Image',upload_to='farmer/')
def __str__(self):
return self.name
119
from django.contrib import admin
admin.site.register(Market_Detail)
admin.site.register(Veg_Detail)
admin.site.register(Category)
admin.site.register(Product)
admin.site.register(Register_Detail)
admin.site.register(Cart_Details)
admin.site.register(Forming_Detail)
import random
def category(request):
if request.method == 'POST':
a=request.POST.get('name')
b = request.POST.get('con')
post=Category.objects.create(name=a,description=b)
return render(request,'category.html',{})
def farmer_login(request):
120
if request.method == 'POST':
name=request.POST.get('username')
pwd=request.POST.get('password')
user_exist=Register_Detail.objects.filter(name=name,password=pwd,user_type='farmer')
if user_exist:
request.session['name']= request.POST.get('username')
a = request.session['name']
sess = Register_Detail.objects.only('id').get(name=a).id
request.session['user_id']= sess
return redirect('form')
else:
return render(request,'admin_login.html',{})
def form(request):
a=Category.objects.all()
return render(request,'catform.html',{'b':a})
def product_list(request):
a=Product.objects.all()
return render(request,'product_list.html',{'b':a})
def catedit(request,pk):
a=Category.objects.filter(id=pk)
if request.method == 'POST':
c=request.POST.get('name')
b = request.POST.get('con')
update=Category.objects.filter(id=pk).update(name=c,description=b)
if update:
121
messages.success(request,'Category Updated Successfully')
return render(request,'cat_edit.html',{'value':a})
def catdelete(request,pk):
a=Category.objects.filter(id=pk).delete()
return redirect('form')
def login_details(request):
if request.method == 'POST':
name=request.POST.get('username')
pwd=request.POST.get('password')
user_exist=Register_Detail.objects.filter(name=name,password=pwd,user_type='pub-
lic')
if user_exist:
request.session['name']= request.POST.get('username')
a = request.session['name']
sess = Register_Detail.objects.only('id').get(name=a).id
request.session['user_id']= sess
return redirect('view_farmer')
else:
return render(request,'temlogin.html',{})
def profile(request):
return render(request,'dashboard.html',{})
def tem(request):
return render(request,'home.html',{})
def reg(request):
if request.method == 'POST':
122
Name = request.POST.get('uname')
Adddress = request.POST.get('address')
Mobile= request.POST.get('mobile')
Email = request.POST.get('email')
Password = request.POST.get('pwd')
utype = request.POST.get('user_type')
crt = Register_Detail.objects.create(name=Name,
address=Adddress,mobile=Mobile,password=Password,email=Email,user_type=utype)
if crt:
messages.success(request,'Registered Successfully')
return render(request,'register.html',{})
def con(request):
if request.method == 'POST':
a = request.POST.get('name')
b =request.POST.get('mail')
c = request.POST.get('subject')
d = request.POST.get('msg')
crt = Contact_Detail.objects.create(name=a,email=b,subject=c,msg=d)
if crt:
return render(request,'contact.html',{})
def dash(request):
return render(request,'dashboard.html',{})
def userdash(request):
return render(request,'user_dashboard.html',{})
123
def product(request):
a=Category.objects.all()
user_id = request.session['user_id']
uid = Register_Detail.objects.get(id=int(user_id))
if request.method == 'POST':
a=request.POST.get('name')
b=request.POST.get('price')
c=request.POST.get('category')
d=request.POST.get('con')
f =request.FILES['pic']
c_id=Category.objects.get(id=int(c))
prt =
Product.objects.create(p_name=a,p_price=b,category=c_id,note=d,cmp_price='',image=f,user
_id=uid)
if prt:
return redirect('product')
return render(request,'product.html',{'a':a})
def logout(request):
try:
del request.session['user_id']
except:
pass
def order(request):
order = Booking_Detail.objects.all()
return render(request,'order.html',{'order':order})
def view_product(request):
124
user_id = request.session['user_id']
a=Product.objects.filter(user_id=int(user_id))
return render(request,'view_product.html',{'b':a})
def view_farmer(request):
a=Register_Detail.objects.filter(user_type='farmer')
return render(request,'farmer_info.html',{'b':a})
def product_edit(request,pk):
a=Product.objects.filter(id=pk)
b = Category.objects.all()
if request.method == 'POST':
a=request.POST.get('name')
b=request.POST.get('price')
c=request.POST.get('category')
d=request.POST.get('con')
e = request.POST.get('others')
c_id=Category.objects.get(id=int(c))
prt =
Product.objects.filter(id=pk).update(p_name=a,p_price=b,category=c_id,note=d,cmp_price=
e)
if prt:
return redirect('view_product')
return render(request,'product_edit.html',{'value':a,'b':b})
def product_delete(request,pk):
a=Product.objects.filter(id=pk).delete()
return redirect('view_product')
def veg_product(request):
user_id = request.GET.get('fid')
125
product = Product.objects.filter(user_id=int(user_id))
uid = request.session['user_id']
return render(request,'veg_product.html',{'product':product})
def add_to_cart(request,pk):
if request.session.has_key('user_id'):
uid = request.session['user_id']
farmer_id = request.GET.get('fid')
user_id = Register_Detail.objects.get(id=int(uid))
product_id = Product.objects.get(id=int(pk))
product_detail = Product.objects.filter(id=int(pk))
if request.method == 'POST':
price = request.GET.get('price')
tot = request.POST.get('tot')
tot_price = float(price)*int(tot)
crt =
Cart_Details.objects.create(user_id=user_id,product_id=product_id,status='pending',
tot=tot,tot_price=tot_price,farmer_id=int(farmer_id))
if crt:
return redirect('view_items_cart_product')
return render(request,'add_to_cart.html',{'product_detail':product_detail})
else:
return render(request,'temlogin.html',{})
def remove_item(request,pk):
Cart_Details.objects.filter(id=int(pk)).delete()
return redirect('view_items_cart_product')
def cart(request):
126
uid = request.session['user_id']
product_details = Cart_Details.objects.filter(user_id=int(uid),status='pending')
return render(request,'cart.html',{'product_details':product_details})
def view_items_cart(request,pk):
product_details = Cart_Details.objects.filter(book_id=int(pk))
tot = Cart_Details.objects.filter(book_id=int(pk)).aggregate(Sum('tot'))
return render(request,'view_items_cart.html',
{'product_details':product_details,'pk':pk,'tot':tot})
def payment_received(request,pk):
Cart_Details.objects.filter(book_id=int(pk)).update(status='paid')
return redirect('order')
def purchased(request):
uid = request.session['user_id']
product_details = Cart_Details.objects.filter(user_id=int(uid),status='paid')
return render(request,'purchased.html',{'product_details':product_details})
def order_purchased(request):
product_details = Cart_Details.objects.filter(user_id=int(uid),status='paid')
return render(request,'purchased.html',{'product_details':product_details})
def ordered_item(request):
uid = request.session['user_id']
order = Booking_Detail.objects.filter(user_id=int(uid))
return render(request,'ordered_item.html',{'order':order})
def view_items_cart_product(request):
uid = request.session['user_id']
product_details = Cart_Details.objects.filter(status='pending',user_id=int(uid))
tot =
Cart_Details.objects.filter(status='pending',user_id=int(uid)).aggregate(Sum('tot_price'))
127
return render(request,'view_items_cart_product.html',{'product_details':product_de-
tails,'tot':tot,'r_num':r_num})
def purchase(request):
uid = request.session['user_id']
order_id = request.GET.get('order_id')
addr = Register_Detail.objects.filter(id=int(uid))
if request.method == 'POST':
upd =
Cart_Details.objects.filter(user_id=int(uid),status='pending').update(status='order',book_id=o
rder_id,date=timezone.now())
if upd:
return redirect('order_item_user')
return render(request,'purchase.html',{'addr':addr})
def purchased_item(request,pk,status):
uid = request.session['user_id']
product_details = Cart_Details.objects.filter(book_id=pk,user_id=int(uid))
tot =
Cart_Details.objects.filter(book_id=pk,user_id=int(uid)).aggregate(Sum('tot_price'))
return render(request,'purchased_item.html',
{'product_details':product_details,'tot':tot,'status':status})
def order_item_user(request):
uid = request.session['user_id']
cursor = connection.cursor()
query = cursor.execute(post)
128
row = cursor.fetchall()
return render(request,'order_item_user.html',{'product_details':row})
def order_item(request):
farmer_id = request.session['user_id']
cursor = connection.cursor()
query = cursor.execute(post)
row = cursor.fetchall()
return render(request,'order_item.html',{'product_details':row})
def status_order(request,pk,user_id,status):
addr = Register_Detail.objects.filter(id=int(user_id))
product_details = Cart_Details.objects.filter(book_id=pk)
tot = Cart_Details.objects.filter(book_id=pk).aggregate(Sum('tot_price'))
if request.method == 'POST':
upd = Cart_Details.objects.filter(book_id=pk).update(status='paid')
if upd:
return redirect('order_item')
return render(request,'status_order.html',
{'tot':tot,'product_details':product_details,'addr':addr,'pk':pk,'user_id':user_id,'status':status})
def search_market(request):
if request.method == 'POST':
a = request.POST.get('search')
ids = Market_Detail.objects.filter(Q(city__istartswith=a)|
Q(area__istartswith=a))
129
return render(request,'search_product.html',{'ids':ids})
else:
return render(request,'search_product.html',{})
def veg_details(request,pk):
ids = Veg_Detail.objects.filter(market_id=int(pk))
return render(request,'veg_details.html',{'ids':ids})
def search(request):
if request.method == 'POST':
a = request.POST.get('search')
ids = Forming_Detail.objects.filter(name__istartswith=a)
return render(request,'search.html',{'ids':ids})
else:
return render(request,'search.html',{})
130
THANK YOU
131









