Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

‭Agriculture Portal : A Machine Learning-Based Expert‬

‭System for Crop Recommendations, Fertilizer Optimization,‬


‭and Disease Prediction‬
‭A Major Project Report Submitted to‬
‭Rajiv Gandhi Proudyogiki Vishwavidyalaya‬

‭Towards Partial Fulfillment for the Award of‬


‭Bachelor of Technology in‬‭Computer Science & Engineering‬

‭Submitted by:‬ ‭Guided by:‬


‭Aanchal Patel‬ ‭0827CS201002‬ ‭Prof. Juhi Shrivastava‬
‭Aditi Rathore‬ ‭0827CS201013‬ ‭Computer Science and Engineering‬
‭Aman Solanki‬ ‭0827CS201027‬
‭Devesh Ujonia‬ ‭0827CS201069‬

‭Acropolis Institute of Technology & Research, Indore‬


‭Jan-May 2024‬
‭EXAMINER APPROVAL‬

‭The‬ ‭Project‬ ‭entitled‬ ‭“‬ ‭Agriculture‬‭Portal‬‭:‬‭A‬‭Machine‬‭Learning-Based‬

‭Expert‬ ‭System‬ ‭for‬ ‭Crop‬ ‭Recommendations,‬ ‭Fertilizer‬ ‭Optimization,‬

‭and‬ ‭Disease‬ ‭Prediction‬ ‭”‬ ‭submitted‬ ‭by‬ ‭Aanchal‬ ‭Patel‬

‭(0827CS201002),‬ ‭Aditi‬ ‭Rathore‬ ‭(0827CS201013),‬ ‭Aman‬ ‭Solanki‬

‭(0827CS201027),‬ ‭Devesh‬ ‭Ujonia‬ ‭(0827CS201069)‬ ‭has‬ ‭been‬

‭examined‬ ‭and‬ ‭is‬ ‭hereby‬ ‭approved‬ ‭towards‬ ‭partial‬ ‭fulfillment‬ ‭for‬ ‭the‬

‭award‬ ‭of‬ ‭Bachelor‬ ‭of‬ ‭Engineering‬ ‭degree‬ ‭in‬ ‭Computer‬ ‭Science‬ ‭&‬

‭Engineering‬ ‭discipline,‬ ‭for‬ ‭which‬ ‭it‬ ‭has‬ ‭been‬ ‭submitted.‬ ‭It‬ ‭understood‬

‭that‬ ‭by‬ ‭this‬ ‭approval‬ ‭the‬ ‭undersigned‬ ‭do‬ ‭not‬ ‭necessarily‬ ‭endorse‬ ‭or‬

‭approve‬ ‭any‬ ‭statement‬ ‭made,‬ ‭opinion‬ ‭expressed‬ ‭or‬ ‭conclusion‬ ‭drawn‬

‭therein,‬ ‭but‬ ‭approve‬ ‭the‬ ‭project‬ ‭only‬ ‭for‬ ‭the‬ ‭purpose‬ ‭for‬ ‭which‬ ‭it‬ ‭has‬

‭been submitted.‬

‭(Internal Examiner)‬ ‭(External Examiner)‬


‭Date:‬ ‭Date:‬

‭I‬
‭RECOMMENDATION‬

‭This‬‭is‬‭to‬‭certify‬‭that‬‭the‬‭work‬‭embodied‬‭in‬‭this‬‭project‬‭entitled‬‭“‭A
‬ griculture‬

‭Portal‬ ‭:‬ ‭A‬ ‭Machine‬ ‭Learning-Based‬ ‭Expert‬ ‭System‬ ‭for‬ ‭Crop‬

‭Recommendations,‬ ‭Fertilizer‬ ‭Optimization,‬ ‭and‬ ‭Disease‬ ‭Prediction‬‭”‬

‭submitted‬ ‭by‬ ‭Aanchal‬ ‭Patel‬ ‭(0827CS201002),‬ ‭Aditi‬ ‭Rathore‬

‭(0827CS201013),‬ ‭Aman‬ ‭Solanki‬ ‭(0827CS201027),‬ ‭Devesh‬ ‭Ujonia‬

‭(0827CS201069)‬ ‭is‬ ‭a‬ ‭satisfactory‬ ‭account‬ ‭of‬‭the‬‭bonafide‬‭work‬‭done‬‭under‬

‭the‬ ‭supervision‬ ‭of‬ ‭Prof.‬ ‭Juhi‬ ‭Shrivastava‬ ‭is‬ ‭recommended‬ ‭towards‬ ‭partial‬

‭fulfillment‬‭for‬‭the‬‭award‬‭of‬‭the‬‭Bachelor‬‭of‬‭Engineering‬‭(Computer‬‭Science‬‭&‬

‭Engineering) degree by Rajiv Gandhi Proudyogiki Vishwavidhyalaya, Bhopal.‬

‭(Project Guide)‬

‭(Project Coordinator)‬

‭(Dean Academics)‬
‭II‬
‭STUDENTS UNDERTAKING‬

‭This‬ ‭is‬ ‭to‬ ‭certify‬ ‭that‬ ‭the‬ ‭major‬ ‭project‬ ‭entitled‬ ‭“Agriculture‬ ‭Portal‬ ‭:‬

‭A‬ ‭Machine‬ ‭Learning-Based‬ ‭Expert‬ ‭System‬ ‭for‬ ‭Crop‬ ‭Recommendations,‬

‭Fertilizer‬ ‭Optimization,‬ ‭and‬ ‭Disease‬ ‭Prediction”‬ ‭has‬‭been‬‭developed‬‭by‬‭us‬

‭under‬ ‭the‬ ‭supervision‬ ‭of‬ ‭Prof.‬‭Juhi‬‭Shrivastava‬‭.‬‭The‬‭whole‬‭responsibility‬‭of‬

‭the‬‭work‬‭done‬‭in‬‭this‬‭project‬‭is‬‭ours.‬‭The‬‭sole‬‭intention‬‭of‬‭this‬‭work‬‭is‬‭only‬‭for‬

‭practical learning and research.‬

‭We‬‭further‬‭declare‬‭that‬‭to‬‭the‬‭best‬‭of‬‭our‬‭knowledge;‬‭this‬‭report‬

‭does‬ ‭not‬ ‭contain‬ ‭any‬ ‭part‬ ‭of‬ ‭any‬ ‭work‬ ‭which‬ ‭has‬ ‭been‬ ‭submitted‬ ‭for‬ ‭the‬

‭award‬ ‭of‬ ‭any‬ ‭degree‬ ‭either‬ ‭in‬ ‭this‬ ‭University‬ ‭or‬ ‭in‬ ‭any‬ ‭other‬ ‭University‬ ‭/‬

‭Deemed‬‭University‬‭without‬‭proper‬‭citation‬‭and‬‭if‬‭the‬‭same‬‭work‬‭is‬‭found‬‭then‬

‭we are liable for explanation to this.‬

‭Aanchal Patel (0827CS201002)‬

‭Aditi Rathore (0827CS201013)‬

‭Aman Solanki (0827CS201027)‬

‭Devesh Ujonia (0827CS201069)‬


‭III‬
‭Acknowledgement‬
‭We‬‭thank‬‭the‬‭almighty‬‭Lord‬‭for‬‭giving‬‭me‬‭the‬‭strength‬‭and‬‭courage‬‭to‬‭sail‬‭out‬
‭through the tough and reach on shore safely.‬

‭We‬ ‭owe‬ ‭a‬ ‭debt‬ ‭of‬ ‭sincere‬ ‭gratitude,‬ ‭deep‬ ‭sense‬ ‭of‬ ‭reverence‬ ‭and‬ ‭respect‬ ‭to‬
‭our‬ ‭guide‬‭and‬‭mentors‬‭Prof.‬‭Juhi‬‭Shrivastava‬‭,‬‭Associate‬‭Professor,‬‭AITR,‬‭for‬
‭their‬ ‭motivation,‬ ‭sagacious‬ ‭guidance,‬ ‭constant‬ ‭encouragement,‬ ‭vigilant‬
‭supervision‬ ‭and‬ ‭valuable‬ ‭critical‬ ‭appreciation‬ ‭throughout‬ ‭this‬ ‭project‬ ‭work,‬
‭which helped us to successfully complete the project on time.‬

‭We‬ ‭express‬ ‭profound‬ ‭gratitude‬ ‭and‬ ‭heartfelt‬ ‭thanks‬ ‭to‬ ‭Dr.‬ ‭Kamal‬ ‭Kumar‬
‭Sethi‬‭,‬ ‭HOD‬ ‭CSE,‬ ‭AITR‬ ‭Indore‬ ‭for‬ ‭his‬ ‭support,‬ ‭suggestion‬ ‭and‬ ‭inspiration‬‭for‬
‭carrying‬ ‭out‬ ‭this‬ ‭project.‬ ‭I‬ ‭am‬ ‭very‬ ‭much‬ ‭thankful‬ ‭to‬ ‭other‬ ‭faculty‬ ‭and‬ ‭staff‬
‭members‬ ‭of‬ ‭CSE‬ ‭Dept,‬ ‭AITR‬ ‭Indore‬ ‭for‬ ‭providing‬ ‭me‬ ‭all‬ ‭support,‬ ‭help‬ ‭and‬
‭advice‬ ‭during‬ ‭the‬ ‭project.‬ ‭We‬ ‭would‬ ‭be‬ ‭failing‬ ‭in‬ ‭our‬ ‭duty‬ ‭if‬ ‭we‬ ‭do‬ ‭not‬
‭acknowledge‬ ‭the‬ ‭support‬ ‭and‬ ‭guidance‬ ‭received‬ ‭from‬ ‭Dr.‬ ‭S.C.‬ ‭Sharma‬‭,‬
‭Director,‬ ‭AITR,‬ ‭Indore‬ ‭whenever‬ ‭needed.‬ ‭We‬ ‭take‬ ‭the‬ ‭opportunity‬ ‭to‬‭convey‬
‭my‬ ‭regards‬ ‭to‬ ‭the‬ ‭management‬ ‭of‬ ‭Acropolis‬ ‭Institute,‬ ‭Indore‬ ‭for‬ ‭extending‬
‭academic‬‭and‬‭administrative‬‭support‬‭and‬‭providing‬‭me‬‭all‬‭necessary‬‭facilities‬
‭for the project to achieve our objectives.‬

‭We‬‭are‬‭grateful‬‭to‬‭our‬‭parents‬‭and‬‭family‬‭members‬‭who‬‭have‬‭always‬‭loved‬
‭and‬‭supported‬‭us‬‭unconditionally.‬‭To‬‭all‬‭of‬‭them,‬‭we‬‭want‬‭to‬‭say,‬‭“Thank‬‭you”,‬
‭for‬‭being‬‭the‬‭best‬‭family‬‭that‬‭one‬‭could‬‭ever‬‭have‬‭and‬‭without‬‭whom‬‭none‬‭of‬
‭this would have been possible‬

‭Aanchal‬ ‭Patel‬ ‭(0827CS201002)‬ ‭Aditi‬ ‭Rathore‬ ‭(0827CS201013),‬ ‭Devesh‬


‭Ujonia (0827CS201069), Aman Solanki (0827CS201027)‬
‭IV‬
‭Executive Summary‬

‭Agriculture Portal : A Machine Learning-Based Expert System for Crop‬


‭Recommendations, Fertilizer Optimization, and Disease Prediction‬

‭Recognition‬ ‭project‬ ‭is‬ ‭submitted‬ ‭to‬ ‭Rajiv‬ ‭Gandhi‬ ‭Proudyogiki‬


‭Vishwavidhyalaya,‬ ‭Bhopal‬ ‭(MP),‬ ‭India‬ ‭for‬ ‭partial‬ ‭fulfillment‬ ‭of‬ ‭Bachelor‬ ‭of‬
‭Engineering‬ ‭in‬‭Information‬‭Technology‬‭branch‬‭under‬‭the‬‭sagacious‬‭guidance‬
‭and vigilant supervision of‬‭Prof. Juhi Shrivastava‬‭.‬

‭The‬ ‭project‬ ‭is‬ ‭based‬ ‭on‬ ‭The‬ ‭Agriculture‬ ‭Portal‬ ‭is‬ ‭an‬ ‭innovative‬ ‭machine‬
‭learning-based‬ ‭system‬ ‭designed‬ ‭to‬ ‭empower‬ ‭farmers‬ ‭by‬ ‭providing‬ ‭accurate‬
‭predictions‬ ‭and‬ ‭prescriptive‬ ‭analytics,‬ ‭along‬ ‭with‬ ‭personalized‬
‭recommendations.‬ ‭Let’s‬ ‭delve‬ ‭into‬ ‭the‬ ‭key‬ ‭aspects‬ ‭of‬ ‭this‬ ‭system.‬ ‭Machine‬
‭Learning‬ ‭Algorithms:‬ ‭These‬ ‭algorithms‬ ‭form‬ ‭the‬ ‭backbone‬ ‭of‬ ‭the‬ ‭system.‬
‭They‬‭include‬‭regression‬‭models,‬‭decision‬‭trees,‬‭and‬‭neural‬‭networks.Big‬‭Data‬
‭Infrastructure:‬ ‭The‬ ‭portal‬ ‭handles‬ ‭large‬ ‭volumes‬ ‭of‬ ‭data‬ ‭efficiently‬ ‭using‬
‭technologies‬‭like‬‭Hadoop‬‭and‬‭Spark.‬‭Cloud‬‭Services:‬‭Cloud‬‭platforms‬‭provide‬
‭scalability,‬‭storage,‬‭and‬‭processing‬‭power.‬‭User‬‭Interface:‬‭The‬‭portal‬‭offers‬‭an‬
‭intuitive interface for farmers to access insights and recommendations.‬

‭Key‬ ‭words‬‭:‬ ‭Machine‬ ‭learning,‬ ‭Systematic‬ ‭reviews‬ ‭and‬ ‭meta‬ ‭analytics,‬


‭Artificial intelligence, Precision agriculture, Precision livestock farming‬

‭V‬
‭“A dry March,‬
‭a wet April and‬
‭a cool May fill barn‬
‭and cellar and‬
‭bring much hay”‬
‭- Alfred North Whitehead‬

‭VI‬
‭List of Figures‬

‭Figure 3-1 : Architecture diagram for a Agriculture portal 15‬


‭Figure 3-2 : Data Flow Diagram level 0 18‬
‭Figure 3-3 : Data Flow Diagram level 1 18‬
‭Figure 3-4 : Use Case Diagram of Agriculture Portal 19‬
‭Figure 3-5 : E-R diagram 21‬
‭Figure 4-1 : Random Forest Algorithm 25‬
‭Figure 4-2 : Features of Python 26‬
‭Figure 4-3 : Pandas and Numpy 27‬
‭Figure 4-4 : Heatmap to Analyze the Correlation Between Features 28‬
‭Figure 4-5 : Confusion Matrix 29‬
‭Figure 4-6 : Crop Recommendation 29‬
‭Figure 4-7 : Home Page of Agriculture Portal 30‬
‭Figure 4-8 : Admin Dashboard 30‬
‭Figure 4-9 : Fertilizer Recommendation 31‬
‭Figure 4-10 : Test Case 1 32‬
‭Figure 4-11 : Test Case 2 33‬
‭Figure 4-12 : Test Case 3 34‬
‭Figure 4-13 : Test Case 4 35‬
‭Figure 4-14 : Test Case 5 36‬
‭Figure 4-15 : Test Case 6 37‬
‭Figure 4-16 : Test Case 7 38‬
‭List of Tables‬

‭Table 1 : Test Case 1 32‬


‭Table 2 : Test Case 2 33‬
‭Table 3 : Test Case 3 34‬
‭Table 4 : Test Case 4 35‬
‭Table 5 : Test Case 5 36‬
‭Table 6 : Test Case 6 37‬
‭Table 7 : Test Case 7 38‬
‭List of Abbreviations‬
‭Abbr1:‬‭API :Application programming interface‬
‭Abbr2:‬‭CSV:comma-separated values‬
‭Abbr3:‬‭ERD: Entity-relationship diagrams‬
‭Abbr4:‬‭UI: User Interface‬
‭Abbr5:‬‭GPU: Graphics Processing Units‬
‭Abbr6:‬‭ML: Machine learning‬
‭Table of Contents‬

‭CHAPTER 1‬ ‭INTRODUCTION…………….…………………………...….‬ ‭1‬


‭1.1‬ ‭Overview………………………………………………...…....‬ ‭1‬
‭1.2‬ ‭Inspiration…………………………………………………....‬ ‭2‬
‭1.3‬ ‭Project Objectives………………………………….………....‬ ‭2‬
‭1.4‬ ‭Scope of the Project….………………...……………………..‬ ‭3‬
‭1.5‬ ‭Team Organization…………………………………………...‬ ‭4‬
‭1.6‬ ‭Report Structure……………………………………………...‬ ‭5‬

‭CHAPTER 2‬ ‭REVIEW OF LITERATURE…………………...……………..‬ ‭7‬


‭2.1‬ ‭Preliminary Investigation…………………………………...‬ ‭8‬
‭2.2‬ ‭Limitations of Current System.…………………………...…‬ ‭9‬
‭2.3‬ ‭Requirement Identification and Analysis for Project……...‬ ‭10‬
‭2.3.1 Conclusion……….……………………………………‬ ‭11‬

‭CHAPTER 3‬ ‭AGRICULTURE PORTAL………………….………..……….‬ ‭13‬


‭3.1‬ ‭The Proposal.……………………………………..…………‬ ‭13‬
‭3.2‬ ‭Benefits of the Proposed System……………….…..……….‬ ‭14‬
‭3.3‬ ‭Architectural‬‭Diagram‬‭...……………………………………..‬ ‭15‬
‭3.4‬ ‭Feasibility Study……………………………………………...‬ ‭15‬
‭3.4.1 Technical…………...…………………………………..‬ ‭15‬
‭3.4.2 Economical……………….…………………………...‬ ‭16‬
‭3.4.3 Operational……………………………………………‬ ‭17‬
‭3.5‬ ‭Design Representation…………………...…………………..‬ ‭18‬
‭3.5.1 Data Flow Diagram……………………………………‬ ‭18‬
‭3.5.2 Use Case Diagram……………………………………...‬ ‭19‬
‭3.5.3 ER Diagram……………………….……………………‬ ‭21‬
‭3.6‬ ‭Deployment Requirements…………………..………………‬ ‭22‬
‭3.6.1 Hardware………………………………………………‬ ‭23‬
‭3.6.2 Software………………………………………………..‬ ‭23‬

‭CHAPTER 4‬ ‭IMPLEMENTATION……………..…………………………...‬ ‭24‬


‭4.1‬ ‭Technique Used…………………………………….…….…..‬ ‭24‬
‭4.1.1 Random Forest Algorithm………………………….…‬ ‭24‬
‭4.2‬ ‭Tools Used…………………………………………..……...…‬ ‭25‬
‭4.2.1 Python………………………………………...………..‬ ‭25‬
‭4.2.2 Scikit……………………………………………...……‬ ‭26‬
‭4.2.3 TensorFlow………………………………………….....‬ ‭26‬
‭4.2.4 News API………………………………………………‬ ‭27‬
‭4.3‬ ‭Visualization…………………………………………………‬ ‭28‬
‭4.‬‭4‬ ‭Project Snapshot for Visual Reference…………………….‬ ‭29‬
‭4.5‬ ‭Testing……………………………………………………….‬ ‭31‬
‭4.5.1 Strategy Used……………….……………….………...‬ ‭31‬
‭4.5.2 Test Case and Analysis………………………….……..‬ ‭32‬

‭CHAPTER 5‬ ‭CONCLUSION………………………………………………...‬ ‭39‬


‭5.1‬ ‭Conclusion……………………………………………………‬ ‭39‬
‭5.2‬ ‭Project constraints and Drawbacks…………………………‬ ‭40‬
‭5.3‬ ‭Enhance with Continuous Improvement…………………...‬ ‭41‬
‭APPENDIX A‬ ‭BIBLIOGRAPHY……………………………………………‬ ‭42‬
‭APPENDIX B‬ ‭SOURCE CODE……………………………………………...‬ ‭43‬
‭APPENDIX C‬ ‭RESEARCH PAPER....…………………..………….………..‬ ‭55‬

‭APPENDIX D‬ ‭POSTER…………………………………………………….‬ ‭59‬


‭Agriculture Portal‬

‭Chapter 1 - Introduction‬
‭Introduction of Agricultural Portal‬

‭The‬‭Agriculture‬‭Portal‬‭is‬‭an‬‭innovative‬‭machine‬‭learning-based‬‭system‬‭designed‬
‭to‬ ‭empower‬ ‭farmers‬ ‭by‬ ‭providing‬ ‭accurate‬ ‭predictions,‬ ‭prescriptive‬ ‭analytics,‬
‭and‬‭personalized‬‭recommendations.‬‭Through‬‭the‬‭use‬‭of‬‭various‬‭algorithms,‬‭this‬
‭platform‬‭assists‬‭farmers‬‭in‬‭making‬‭informed‬‭decisions‬‭about‬‭their‬‭crops.‬‭In‬‭this‬
‭research‬‭paper,‬‭we‬‭delve‬‭into‬‭the‬‭architecture,‬‭methodologies,‬‭and‬‭technologies‬
‭behind the Agriculture Portal, emphasizing its impact on modern agriculture.‬
‭Random‬ ‭Forest‬ ‭algorithm‬ ‭for‬ ‭crop‬ ‭recommendation‬ ‭utilizes‬ ‭an‬ ‭ensemble‬
‭learning‬ ‭technique‬ ‭that‬ ‭builds‬ ‭multiple‬ ‭decision‬ ‭trees‬ ‭during‬ ‭training‬ ‭and‬
‭aggregates‬ ‭their‬ ‭predictions‬ ‭to‬ ‭provide‬ ‭recommendations.‬ ‭It‬ ‭analyzes‬ ‭various‬
‭factors‬ ‭such‬ ‭as‬ ‭soil‬ ‭type,‬ ‭climate‬ ‭conditions,‬ ‭historical‬ ‭crop‬ ‭yields,‬ ‭and‬‭market‬
‭demand‬ ‭to‬ ‭suggest‬ ‭suitable‬ ‭crops‬ ‭for‬ ‭a‬‭given‬‭agricultural‬‭region.‬‭This‬‭approach‬
‭combines‬‭the‬‭robustness‬‭of‬‭decision‬‭trees‬‭with‬‭the‬‭diversity‬‭of‬‭multiple‬‭models,‬
‭yielding accurate and reliable crop recommendations.‬

‭1.1 Overview‬

‭The‬‭Agricultural‬‭Portal‬‭Survey‬‭of‬‭our‬‭project‬‭aims‬‭to‬‭gather‬‭crucial‬‭insights‬‭and‬
‭feedback‬ ‭from‬ ‭stakeholders‬ ‭involved‬ ‭in‬ ‭the‬ ‭agricultural‬ ‭sector.‬ ‭This‬
‭comprehensive‬ ‭survey‬ ‭encompasses‬ ‭various‬ ‭aspects‬ ‭crucial‬ ‭for‬ ‭the‬
‭development‬ ‭and‬ ‭enhancement‬ ‭of‬ ‭agricultural‬ ‭practices,‬ ‭technology,‬ ‭and‬
‭sustainability.‬

‭1‬‭of 54‬
‭Agriculture Portal‬

‭The‬ ‭survey‬ ‭seeks‬ ‭to‬ ‭understand‬ ‭the‬ ‭perceptions‬ ‭and‬ ‭attitudes‬ ‭of‬ ‭farmers‬
‭towards‬ ‭sustainable‬ ‭agricultural‬ ‭practices.‬ ‭This‬ ‭involves‬ ‭assessing‬ ‭their‬ ‭aware‬
‭of‬ ‭environmental‬ ‭conservation,‬ ‭soil‬ ‭health‬ ‭management,‬ ‭and‬ ‭biodiversity‬
‭conservation.‬ ‭Insights‬ ‭into‬ ‭farmers'‬ ‭willingness‬ ‭to‬ ‭adopt‬ ‭sustainable‬ ‭practices‬
‭guide‬ ‭initiatives‬ ‭aimed‬ ‭at‬ ‭promoting‬ ‭eco-friendly‬ ‭farming‬ ‭methods‬ ‭the‬ ‭survey‬
‭evaluates‬ ‭the‬ ‭usage‬ ‭and‬ ‭effectiveness‬ ‭of‬ ‭existing‬ ‭agricultural‬ ‭technologies‬ ‭and‬
‭practices.‬ ‭This‬ ‭includes‬ ‭assessing‬ ‭the‬ ‭adoption‬ ‭rate‬ ‭of‬ ‭modern‬ ‭farming‬
‭techniques,‬ ‭irrigation‬ ‭systems,‬ ‭and‬ ‭crop‬ ‭varieties.‬ ‭Feedback‬ ‭on‬ ‭the‬ ‭usability,‬
‭affordability,‬ ‭and‬ ‭impact‬ ‭of‬ ‭these‬ ‭technologies‬‭helps‬‭in‬‭refining‬‭and‬‭optimizing‬
‭their implementation.‬

‭1.2 Inspiration‬

‭The‬‭inspiration‬‭behind‬‭the‬‭Agriculture‬‭Portal‬‭stems‬‭from‬‭the‬‭need‬‭to‬‭bridge‬‭the‬
‭gap‬ ‭between‬ ‭traditional‬ ‭farming‬ ‭practices‬ ‭and‬ ‭cutting-edge‬ ‭technology.‬ ‭As‬ ‭the‬
‭global‬ ‭population‬ ‭grows,‬ ‭ensuring‬ ‭food‬ ‭security‬ ‭becomes‬ ‭increasingly‬ ‭critical.‬
‭By‬ ‭harnessing‬ ‭the‬ ‭power‬ ‭of‬ ‭machine‬ ‭learning,‬ ‭the‬ ‭Agriculture‬ ‭Portal‬ ‭aims‬ ‭to‬
‭revolutionize agriculture by providing farmers with actionable insights.‬

‭1.3 Project Objectives‬

‭1.‬ ‭Predict‬ ‭Optimal‬ ‭Crops‬‭:‬ ‭The‬‭system‬‭employs‬‭machine‬‭learning‬‭algorithms‬


‭to‬ ‭predict‬ ‭the‬ ‭most‬ ‭suitable‬ ‭crops‬ ‭for‬ ‭a‬ ‭given‬ ‭region,‬ ‭considering‬ ‭factors‬
‭such as soil type, climate, and historical data.‬

‭2.‬ ‭Fertilizer‬‭Recommendations‬‭:‬‭Based‬‭on‬‭crop‬‭predictions‬‭and‬‭soil‬‭analysis,‬
‭the‬ ‭Agriculture‬ ‭Portal‬ ‭suggests‬ ‭appropriate‬ ‭fertilizers‬ ‭to‬ ‭enhance‬ ‭crop‬
‭yield.‬

‭3.‬ ‭Disease‬ ‭Prediction:‬ ‭A‬ ‭crop‬ ‭disease‬ ‭detection‬ ‭system‬ ‭typically‬ ‭involves‬
‭using‬‭technology‬‭such‬‭as‬‭computer‬‭vision,‬‭machine‬‭learning,‬‭and‬‭sometimes‬
‭2‬‭of 54‬
‭Agriculture Portal‬

‭IoT‬ ‭(Internet‬ ‭of‬‭Things)‬‭devices‬‭to‬‭identify‬‭diseases‬‭in‬‭crops.‬‭Once‬‭trained,‬


‭the‬ ‭models‬ ‭can‬ ‭be‬ ‭used‬ ‭to‬ ‭analyze‬ ‭new‬ ‭images‬ ‭or‬‭data‬‭and‬‭detect‬‭signs‬‭of‬
‭disease‬‭in‬‭crops.‬‭If‬‭the‬‭system‬‭is‬‭deployed‬‭in‬‭real-time,‬‭it‬‭can‬‭provide‬‭early‬
‭warnings‬ ‭to‬ ‭farmers,‬ ‭allowing‬ ‭them‬ ‭to‬ ‭take‬ ‭preventive‬ ‭measures‬ ‭such‬ ‭as‬
‭applying pesticides or adjusting irrigation.‬

‭4.‬ ‭News‬ ‭by‬ ‭using‬ ‭API:‬ ‭The‬ ‭objective‬ ‭of‬ ‭our‬ ‭agriculture‬ ‭portal‬ ‭is‬ ‭to‬ ‭provide‬
‭timely,‬ ‭accurate,‬ ‭and‬ ‭relevant‬ ‭news‬ ‭and‬ ‭information‬ ‭to‬ ‭farmers,‬
‭agribusinesses,‬ ‭and‬ ‭stakeholders.‬ ‭We‬ ‭aim‬ ‭to‬ ‭empower‬ ‭our‬ ‭audience‬ ‭with‬
‭insights‬ ‭on‬ ‭market‬ ‭trends,‬ ‭agricultural‬ ‭technologies,‬ ‭policy‬ ‭developments,‬
‭and‬ ‭best‬ ‭practices,‬ ‭facilitating‬ ‭informed‬ ‭decision-making‬ ‭and‬ ‭sustainable‬
‭agricultural growth‬

‭1.4 Scope of the Project‬

‭The‬‭reach‬‭of‬‭the‬‭Agriculture‬‭Portal‬‭extends‬‭far‬‭and‬‭wide,‬‭encompassing‬‭farmers‬
‭across‬ ‭diverse‬ ‭geographical‬ ‭locations‬ ‭and‬ ‭socio-economic‬ ‭backgrounds.‬
‭Through‬‭its‬‭innovative‬‭machine‬‭learning-based‬‭system,‬‭the‬‭portal‬‭democratizes‬
‭access‬ ‭to‬ ‭cutting-edge‬ ‭agricultural‬ ‭insights‬ ‭and‬ ‭recommendations,‬ ‭thereby‬
‭empowering‬ ‭farmers‬ ‭to‬ ‭make‬ ‭informed‬ ‭decisions‬ ‭and‬ ‭optimize‬ ‭their‬
‭productivity.‬
‭One‬ ‭of‬ ‭the‬ ‭primary‬ ‭ways‬ ‭the‬ ‭Agriculture‬ ‭Portal‬ ‭reaches‬ ‭farmers‬ ‭is‬ ‭through‬
‭digital‬ ‭platforms‬ ‭and‬ ‭mobile‬ ‭applications.‬ ‭By‬ ‭leveraging‬ ‭the‬ ‭ubiquity‬ ‭of‬
‭smartphones‬ ‭and‬ ‭internet‬ ‭connectivity,‬ ‭the‬ ‭portal‬ ‭ensures‬ ‭that‬ ‭farmers,‬
‭regardless‬ ‭of‬ ‭their‬ ‭location,‬ ‭can‬ ‭access‬ ‭its‬ ‭features‬ ‭and‬ ‭benefits.‬‭Market‬‭prices‬
‭for‬ ‭crops‬ ‭and‬ ‭livestock,‬ ‭access‬ ‭to‬ ‭agricultural‬ ‭inputs‬ ‭(seeds,‬ ‭fertilizers,‬
‭equipment),‬‭online‬‭forums‬‭or‬‭communities‬‭for‬‭knowledge‬‭sharing‬‭crop‬‭planning‬
‭and management tools.‬

‭3 of 54‬
‭Agriculture Portal‬

‭1.5 Team Organization‬

‭Aanchal Patel:‬
‭I‬ ‭investigated‬ ‭and‬ ‭found‬ ‭the‬ ‭right‬ ‭technology‬ ‭and‬ ‭studied‬ ‭it‬ ‭for‬ ‭the‬
‭implementation‬‭of‬‭the‬‭project.‬‭I‬‭collected‬‭the‬‭object‬‭data‬‭and‬‭trained‬‭the‬‭model‬
‭for‬ ‭it.‬ ‭Implementation‬ ‭logic‬ ‭for‬ ‭the‬ ‭project‬ ‭objective‬ ‭and‬ ‭coding‬ ‭of‬ ‭internal‬
‭functionalities‬ ‭is‬ ‭also‬‭done‬‭by‬‭me.‬‭Also,‬‭worked‬‭on‬‭Back‬‭end‬‭design‬‭for‬‭storing‬
‭results‬ ‭in‬ ‭the‬ ‭database‬ ‭for‬ ‭maintaining‬ ‭logs‬ ‭and‬ ‭machine‬ ‭algorithms‬ ‭for‬ ‭the‬
‭dataset.‬

‭Aditi Rathore:‬
‭I‬‭collected‬‭all‬‭the‬‭necessary‬‭information‬‭about‬‭our‬ ‭project‬‭and‬ ‭the‬‭working‬‭of‬
‭counting‬‭of‬‭objects‬‭in‬‭the‬‭project.‬‭I‬‭also‬‭did‬‭the‬‭front-end‬‭as‬ ‭the‬‭framework‬‭and‬
‭design‬ ‭,‬ ‭surveyed‬‭various‬‭research‬‭papers‬‭and‬‭posters.‬‭Documentation‬‭is‬‭also‬‭a‬
‭part of the work done by me in this project.‬

‭Aman Solanki:‬

‭Along‬ ‭with‬ ‭doing‬ ‭preliminary‬ ‭investigation‬ ‭and‬ ‭understanding‬ ‭of‬ ‭the‬ ‭current‬
‭system,‬ ‭I‬ ‭studied‬ ‭the‬ ‭topic‬ ‭and‬ ‭its‬ ‭scope.‬ ‭research‬ ‭papers‬ ‭related‬ ‭to‬ ‭the‬ ‭Crop‬
‭Prediction and the technology that is to be used.‬

‭Devesh Ujonia:‬

‭I‬ ‭collect‬ ‭and‬ ‭annotate‬ ‭large‬ ‭datasets.‬ ‭Testing‬ ‭and‬ ‭validation‬ ‭ensure‬ ‭system‬
‭reliability,‬‭and‬‭ongoing‬‭updates‬‭keep‬‭the‬‭system‬‭current‬‭with‬‭evolving‬‭weather‬
‭conditions and news.‬

‭4‬‭of 54‬
‭Agriculture Portal‬

‭1.6 Report Structure‬


‭The‬ ‭project‬ ‭Agricultural‬‭Portal‬‭System‬‭is‬‭primarily‬‭concerned‬‭with‬‭identifying‬
‭which‬ ‭class‬ ‭an‬ ‭agriculture‬ ‭portal‬ ‭belongs‬ ‭to.‬ ‭and‬ ‭the‬ ‭whole‬ ‭project‬ ‭report‬ ‭is‬
‭categorized into five chapters.‬

‭Chapter‬ ‭1‬ ‭:‬ ‭Introduction-‬ ‭introduces‬ ‭the‬ ‭background‬ ‭of‬‭the‬‭problem‬‭followed‬


‭by‬ ‭rationale‬ ‭for‬ ‭the‬ ‭project‬ ‭undertaken.‬ ‭The‬ ‭chapter‬ ‭describes‬ ‭the‬ ‭objectives,‬
‭scope‬ ‭and‬ ‭applications‬ ‭of‬ ‭the‬ ‭project.‬ ‭Further,‬ ‭the‬ ‭chapter‬ ‭gives‬ ‭the‬ ‭details‬ ‭of‬
‭team‬ ‭members‬ ‭and‬ ‭their‬ ‭contribution‬ ‭in‬ ‭development‬ ‭of‬ ‭the‬ ‭project‬ ‭which‬ ‭is‬
‭then subsequently ended with a report outline.‬

‭Chapter‬‭2‬‭:‬‭Review‬‭of‬‭Literature-‬‭explores‬‭the‬‭work‬‭done‬‭in‬‭the‬‭area‬‭of‬‭Project‬
‭undertaken‬ ‭and‬ ‭discusses‬ ‭the‬ ‭limitations‬ ‭of‬ ‭the‬ ‭existing‬ ‭system‬ ‭and‬‭highlights‬
‭the‬ ‭issues‬ ‭and‬ ‭challenges‬ ‭of‬ ‭the‬ ‭project‬ ‭area.‬ ‭The‬ ‭chapter‬ ‭finally‬‭ends‬‭up‬‭with‬
‭the‬‭requirement‬‭identification‬‭for‬‭present‬‭project‬‭work‬‭based‬‭on‬‭findings‬‭drawn‬
‭from reviewed literature and end user interactions.‬

‭Chapter‬ ‭3‬ ‭:‬ ‭Proposed‬ ‭System‬ ‭-‬ ‭starts‬ ‭with‬ ‭the‬ ‭project‬ ‭proposal‬ ‭based‬ ‭on‬
‭requirement‬ ‭identified,‬ ‭followed‬ ‭by‬ ‭benefits‬ ‭of‬ ‭the‬ ‭project.‬ ‭The‬ ‭chapter‬ ‭also‬
‭illustrates‬ ‭the‬ ‭software‬ ‭engineering‬ ‭paradigm‬ ‭used‬ ‭along‬ ‭with‬ ‭different‬ ‭design‬
‭representations.‬‭The‬‭chapter‬‭also‬‭includes‬‭a‬‭block‬‭diagram‬‭and‬‭details‬‭of‬‭major‬
‭modules‬ ‭of‬ ‭the‬ ‭project.‬ ‭Chapter‬ ‭also‬ ‭gives‬ ‭insights‬ ‭of‬ ‭different‬ ‭types‬ ‭of‬
‭feasibility‬ ‭study‬‭carried‬‭out‬‭for‬‭the‬‭project‬‭undertaken.‬‭Later‬‭it‬‭gives‬‭details‬‭of‬
‭the different deployment requirements for the developed project.‬

‭Chapter‬ ‭4‬ ‭:‬ ‭Implementation‬ ‭-‬ ‭includes‬ ‭the‬ ‭details‬ ‭of‬ ‭different‬ ‭Technology/‬
‭Techniques/‬‭Tools/‬‭Programming‬‭Languages‬‭used‬‭in‬‭developing‬‭the‬‭Project.‬‭The‬

‭5‬‭of 54‬
‭Agriculture Portal‬

‭chapter‬‭also‬‭includes‬‭the‬‭different‬‭user‬‭interfaces‬‭designed‬‭in‬‭the‬‭project‬‭along‬
‭with‬ ‭their‬ ‭functionality.‬ ‭Further‬ ‭it‬ ‭discusses‬‭the‬‭experiment‬‭results‬‭along‬‭with‬
‭testing‬ ‭of‬ ‭the‬ ‭project.‬ ‭The‬ ‭chapter‬ ‭ends‬ ‭with‬ ‭evaluation‬ ‭of‬ ‭the‬ ‭project‬ ‭on‬
‭different parameters like accuracy and efficiency.‬

‭Chapter‬‭5‬‭:‬‭Conclusion‬‭-‬‭Concludes‬‭with‬‭objective‬‭wise‬‭analysis‬‭of‬‭results‬ ‭and‬
‭limitation‬ ‭of‬ ‭present‬ ‭work‬ ‭which‬ ‭is‬ ‭then‬ ‭followed‬ ‭by‬ ‭suggestions‬ ‭and‬
‭recommendations for further improvement.‬

‭6 of 54‬
‭Agriculture Portal‬

‭Chapter 2 - Review of Literature‬


‭Review of Literature‬
‭The‬ ‭Agriculture‬ ‭Portal‬ ‭represents‬ ‭a‬ ‭significant‬ ‭advancement‬ ‭in‬ ‭the‬ ‭field‬ ‭of‬
‭precision‬ ‭agriculture.‬ ‭Let’s‬ ‭explore‬ ‭the‬ ‭existing‬ ‭literature‬ ‭related‬ ‭to‬ ‭similar‬
‭systems and their impact:‬
‭Machine‬ ‭Learning‬ ‭Applications‬ ‭in‬ ‭Agriculture:‬ ‭Researchers‬ ‭have‬ ‭extensively‬
‭studied‬ ‭the‬ ‭application‬ ‭of‬ ‭machine‬ ‭learning‬ ‭in‬ ‭agriculture.‬ ‭From‬ ‭crop‬ ‭yield‬
‭prediction‬‭to‬‭disease‬‭detection,‬‭machine‬‭learning‬‭models‬‭have‬‭shown‬‭promising‬
‭results.‬ ‭[1]‬ ‭The‬ ‭Agriculture‬ ‭Portal‬ ‭builds‬ ‭upon‬ ‭this‬ ‭foundation‬ ‭by‬ ‭integrating‬
‭multiple‬‭algorithms‬‭for‬‭crop‬‭prediction,‬‭fertilizer‬‭recommendation,‬‭and‬‭weather‬
‭forecasting.‬

‭●‬ ‭Crop‬ ‭Recommendation‬ ‭Systems:‬ ‭Existing‬ ‭crop‬ ‭recommendation‬ ‭systems‬


‭often‬ ‭rely‬ ‭on‬ ‭historical‬‭data‬‭and‬‭expert‬‭knowledge.‬‭However,‬‭they‬‭may‬‭lack‬
‭personalized‬ ‭recommendations‬ ‭for‬ ‭individual‬ ‭farmers.‬ ‭The‬ ‭Agriculture‬
‭Portal‬‭addresses‬‭this‬‭limitation‬‭by‬‭tailoring‬‭its‬‭suggestions‬‭based‬‭on‬‭specific‬
‭user inputs, such as location, soil type, and preferences.[3]‬

‭●‬ ‭Fertilizer‬‭Recommendations:‬‭Based‬‭on‬‭crop‬‭predictions‬‭and‬‭soil‬‭analysis,‬‭the‬
‭Agriculture Portal suggests appropriate fertilizers to enhance crop yield.‬

‭●‬ ‭Disease‬‭Prediction:‬‭A‬‭crop‬‭disease‬‭detection‬‭system‬‭typically‬‭involves‬‭using‬
‭technology‬ ‭such‬ ‭as‬ ‭computer‬ ‭vision,‬ ‭machine‬ ‭learning,‬ ‭and‬ ‭sometimes‬ ‭IoT‬
‭(Internet‬ ‭of‬ ‭Things)‬ ‭devices‬ ‭to‬ ‭identify‬ ‭diseases‬ ‭in‬ ‭crops.‬ ‭Once‬ ‭trained,‬‭the‬
‭models‬‭can‬‭be‬‭used‬‭to‬‭analyze‬‭new‬‭images‬‭or‬‭data‬‭and‬‭detect‬‭signs‬‭of‬‭disease‬
‭in‬ ‭crops.[4]‬ ‭If‬ ‭the‬ ‭system‬ ‭is‬ ‭deployed‬ ‭in‬ ‭real-time,‬ ‭it‬ ‭can‬ ‭provide‬ ‭early‬

‭7‬‭of 54‬
‭Agriculture Portal‬

‭warnings‬ ‭to‬ ‭farmers,‬ ‭allowing‬ ‭them‬ ‭to‬ ‭take‬ ‭preventive‬ ‭measures‬ ‭such‬ ‭as‬
‭applying pesticides or adjusting irrigation.‬

‭●‬ ‭News‬ ‭by‬ ‭API:‬ ‭News‬ ‭for‬ ‭an‬ ‭agriculture‬ ‭portal‬ ‭indicates‬ ‭a‬ ‭focus‬ ‭on‬ ‭timely‬
‭updates‬ ‭regarding‬ ‭crop‬ ‭cultivation‬ ‭techniques,‬ ‭market‬ ‭trends,‬ ‭and‬ ‭policy‬
‭developments.‬ ‭Content‬ ‭covers‬ ‭diverse‬ ‭topics‬ ‭such‬ ‭as‬ ‭sustainable‬ ‭farming‬
‭practices,‬ ‭technological‬ ‭innovations,‬ ‭and‬ ‭global‬ ‭trade‬ ‭dynamics.[8]‬ ‭The‬
‭portal‬ ‭serves‬ ‭as‬ ‭a‬ ‭valuable‬ ‭resource‬ ‭for‬ ‭farmers,‬ ‭researchers,‬ ‭and‬ ‭industry‬
‭stakeholders.‬

‭2.1 Preliminary Investigation‬

‭Before‬ ‭developing‬ ‭the‬ ‭Agriculture‬ ‭Portal,‬ ‭a‬‭thorough‬‭preliminary‬‭investigation‬


‭was conducted:‬

‭Needs‬ ‭Assessment:‬ ‭Interviews‬ ‭with‬ ‭farmers‬ ‭revealed‬ ‭their‬ ‭pain‬ ‭points,‬


‭including‬‭resource‬‭allocation‬‭challenges,‬‭climate‬‭uncertainties,‬‭and‬‭the‬‭need‬‭for‬
‭personalized advice.‬

‭Market‬ ‭Analysis:‬ ‭Existing‬ ‭agricultural‬ ‭platforms‬ ‭were‬ ‭evaluated,‬ ‭highlighting‬


‭gaps in features and usability.‬

‭Technological‬ ‭Feasibility:‬ ‭The‬ ‭feasibility‬ ‭of‬ ‭implementing‬ ‭machine‬ ‭learning‬


‭models, data collection, and user interfaces was assessed.‬

‭Before‬ ‭delving‬ ‭into‬ ‭the‬ ‭specifics,‬ ‭let’s‬ ‭consider‬ ‭the‬ ‭preliminary‬ ‭investigation.‬
‭The‬ ‭Agriculture‬ ‭Portal‬ ‭emerged‬ ‭as‬ ‭a‬ ‭response‬ ‭to‬ ‭the‬‭pressing‬‭challenges‬‭faced‬
‭by‬ ‭farmers‬ ‭worldwide.[6]‬ ‭These‬ ‭challenges‬ ‭include‬ ‭unpredictable‬ ‭weather‬
‭patterns,‬ ‭fluctuating‬ ‭crop‬ ‭yields,‬ ‭and‬ ‭the‬ ‭need‬ ‭for‬ ‭sustainable‬ ‭agricultural‬
‭practices.‬‭By‬‭conducting‬‭an‬‭in-depth‬‭analysis‬‭of‬‭existing‬‭systems‬‭and‬‭identifying‬
‭gaps,‬ ‭the‬ ‭project‬ ‭team‬ ‭laid‬ ‭the‬ ‭foundation‬ ‭for‬ ‭this‬ ‭innovative‬ ‭solution.[3]The‬

‭8‬‭of 54‬
‭Agriculture Portal‬

‭Agriculture‬ ‭Portal‬ ‭is‬ ‭an‬ ‭innovative‬ ‭system‬ ‭that‬ ‭leverages‬ ‭machine‬ ‭learning‬ ‭to‬
‭empower‬ ‭farmers.‬ ‭It‬ ‭provides‬ ‭accurate‬ ‭predictions‬ ‭and‬ ‭prescriptive‬ ‭analytics‬
‭with‬ ‭personalized‬ ‭recommendations.‬ ‭The‬ ‭portal‬ ‭uses‬ ‭various‬ ‭algorithms‬ ‭to‬
‭predict‬ ‭optimal‬ ‭crops,‬ ‭suggest‬ ‭appropriate‬ ‭fertilizers,‬ ‭and‬ ‭forecast‬ ‭rainfall‬‭and‬
‭yield.‬ ‭It‬ ‭also‬ ‭includes‬ ‭features‬ ‭like‬ ‭weather‬‭forecasting‬‭and‬‭agriculture-related‬
‭news.‬

‭2.2 Limitations of Current System‬

‭Existing‬ ‭agricultural‬ ‭systems‬ ‭often‬ ‭fall‬ ‭short‬ ‭in‬ ‭providing‬‭accurate‬‭predictions‬


‭and‬‭actionable‬‭insights.‬‭Traditional‬‭methods‬‭rely‬‭heavily‬‭on‬‭historical‬‭data‬‭and‬
‭lack‬ ‭the‬ ‭adaptability‬ ‭required‬ ‭to‬ ‭address‬ ‭dynamic‬ ‭environmental‬ ‭factors[2].‬
‭Moreover,‬‭these‬‭systems‬‭rarely‬‭offer‬‭personalized‬‭recommendations‬‭tailored‬‭to‬
‭individual‬ ‭farmers.‬ ‭The‬ ‭Agriculture‬ ‭Portal‬ ‭aims‬ ‭to‬ ‭overcome‬ ‭these‬‭limitations‬
‭by leveraging cutting-edge machine learning algorithms and real-time data.‬

‭While‬ ‭existing‬ ‭agricultural‬ ‭systems‬ ‭provide‬ ‭valuable‬ ‭insights,‬ ‭they‬ ‭often‬ ‭fall‬
‭short in the following areas:‬

‭●‬ ‭Lack‬ ‭of‬ ‭Personalization:‬ ‭Generic‬ ‭recommendations‬ ‭may‬ ‭not‬ ‭suit‬


‭individual farmers’ unique contexts.‬

‭●‬ ‭Data Silos: Disparate data sources hinder holistic decision-making.‬

‭●‬ ‭Complex‬ ‭Interfaces:‬ ‭Some‬ ‭platforms‬ ‭overwhelm‬ ‭users‬ ‭with‬ ‭complex‬


‭interfaces.‬

‭●‬ ‭Scalability:‬ ‭Scalability‬ ‭issues‬ ‭arise‬ ‭when‬ ‭handling‬ ‭large‬ ‭datasets‬ ‭or‬
‭serving a growing user base.‬

‭Despite‬ ‭the‬ ‭significant‬ ‭advancements‬ ‭in‬ ‭agricultural‬ ‭technology,‬ ‭there‬ ‭are‬‭still‬


‭limitations‬‭in‬‭the‬‭current‬‭systems.‬‭Many‬‭existing‬‭solutions‬‭lack‬‭personalization‬
‭9‬‭of 54‬
‭Agriculture Portal‬

‭and‬‭do‬‭not‬‭provide‬‭prescriptive‬‭analytics.‬‭They‬‭often‬‭fail‬‭to‬‭consider‬‭the‬‭unique‬
‭circumstances‬ ‭and‬ ‭needs‬ ‭of‬ ‭individual‬ ‭farmers.[7]‬ ‭Moreover,‬ ‭these‬ ‭systems‬
‭typically‬ ‭do‬ ‭not‬ ‭offer‬ ‭a‬ ‭comprehensive‬ ‭suite‬ ‭of‬ ‭features,‬ ‭such‬ ‭as‬ ‭weather‬
‭forecasting and agriculture-related news.‬

‭2.3 Requirement Identification and Analysis for Project‬

‭Understanding‬ ‭the‬ ‭needs‬ ‭of‬ ‭farmers‬ ‭was‬ ‭crucial‬ ‭during‬ ‭the‬ ‭requirement‬
‭identification‬ ‭phase.‬ ‭The‬ ‭project‬ ‭team‬ ‭engaged‬ ‭with‬ ‭farmers,‬ ‭agronomists,‬‭and‬
‭domain experts to gather insights. Key requirements included:‬

‭●‬ ‭Crop‬ ‭Prediction:‬ ‭Farmers‬ ‭needed‬ ‭a‬ ‭reliable‬ ‭system‬ ‭that‬ ‭could‬ ‭predict‬
‭optimal crops based on soil conditions, climate, and market demand.‬

‭●‬ ‭Fertilizer‬ ‭Recommendations:‬ ‭Customized‬ ‭fertilizer‬ ‭suggestions‬ ‭were‬


‭essential to enhance crop yield while minimizing environmental impact.‬

‭●‬ ‭Personalization:‬‭Recognizing‬‭that‬‭each‬‭farm‬‭is‬‭unique,‬‭the‬‭system‬‭had‬‭to‬
‭provide personalized recommendations.‬

‭●‬ ‭Identify‬ ‭news‬ ‭pertinent‬ ‭to‬ ‭agriculture‬ ‭portal:‬ ‭Select‬ ‭articles‬ ‭on‬ ‭crop‬
‭yields,‬‭weather‬‭impacts,‬‭market‬‭trends,‬‭technological‬‭advancements,‬‭and‬
‭policy‬‭changes.‬‭Emphasize‬‭sustainability,‬‭farmer‬‭welfare,‬‭and‬‭innovation.‬
‭Ensure‬ ‭content‬ ‭diversity‬ ‭across‬ ‭regions‬ ‭and‬ ‭crops.‬ ‭Prioritize‬ ‭reliable‬
‭sources and engage with audience feedback for relevance and impact.‬
‭The‬ ‭Agriculture‬ ‭Portal’s‬ ‭requirements‬ ‭were‬ ‭meticulously‬ ‭identified‬ ‭and‬
‭analyzed:‬

‭●‬ ‭Data‬ ‭Collection:‬ ‭Integration‬ ‭with‬ ‭weather‬ ‭APIs,‬ ‭soil‬ ‭databases,‬ ‭and‬
‭historical yield records.‬

‭10‬‭of 54‬
‭Agriculture Portal‬

‭●‬ ‭Machine‬ ‭Learning‬ ‭Models:‬ ‭Algorithms‬ ‭for‬ ‭crop‬ ‭prediction,‬ ‭fertilizer‬


‭optimization, and yield estimation.‬

‭●‬ ‭User‬ ‭Interface:‬ ‭A‬ ‭user-friendly‬ ‭platform‬ ‭accessible‬ ‭via‬ ‭web‬ ‭and‬ ‭mobile‬
‭devices.‬

‭●‬ ‭Personalization: Customized recommendations based on user profiles.‬

‭●‬ ‭Scalability: Designing for future growth and scalability.‬

‭The‬ ‭Agriculture‬ ‭Portal‬ ‭addresses‬ ‭these‬ ‭limitations‬ ‭by‬ ‭providing‬ ‭a‬


‭comprehensive,‬ ‭personalized‬ ‭solution‬ ‭for‬ ‭farmers.‬ ‭The‬ ‭system‬ ‭identifies‬ ‭the‬
‭requirements‬‭of‬‭the‬‭farmers‬‭and‬‭analyzes‬‭these‬‭to‬‭provide‬‭accurate‬‭predictions‬
‭and‬ ‭recommendations.‬ ‭It‬ ‭considers‬ ‭various‬ ‭factors‬ ‭such‬ ‭as‬ ‭soil‬ ‭type,‬ ‭weather‬
‭conditions,‬ ‭and‬ ‭crop‬ ‭history‬ ‭to‬ ‭suggest‬ ‭optimal‬ ‭crops‬ ‭and‬ ‭appropriate‬
‭fertilizers.‬ ‭Furthermore,‬ ‭it‬‭forecasts‬‭rainfall‬‭and‬‭yield,‬‭enabling‬‭farmers‬‭to‬‭plan‬
‭their activities accordingly.‬

‭2.3.1 Conclusion‬

‭The‬ ‭Agriculture‬ ‭Portal‬ ‭has‬ ‭transformed‬ ‭the‬ ‭way‬ ‭farmers‬ ‭make‬ ‭decisions.‬ ‭By‬
‭providing‬ ‭accurate‬ ‭predictions,‬ ‭personalized‬ ‭advice,‬ ‭and‬ ‭real-time‬ ‭insights,‬ ‭it‬
‭empowers‬ ‭them‬ ‭to‬ ‭optimize‬‭crop‬‭yield,‬‭conserve‬‭resources,‬‭and‬‭mitigate‬‭risks.‬
‭Additionally,‬ ‭features‬ ‭like‬ ‭weather‬ ‭forecasting‬ ‭and‬ ‭agriculture-related‬ ‭news‬
‭enhance‬ ‭its‬ ‭utility.‬ ‭[7]‬ ‭The‬ ‭Agriculture‬ ‭Portal‬ ‭represents‬ ‭a‬ ‭significant‬ ‭leap‬
‭forward‬ ‭in‬ ‭agricultural‬ ‭technology.‬ ‭Its‬ ‭holistic‬ ‭approach,‬ ‭data-driven‬ ‭insights,‬
‭and‬ ‭user-centric‬ ‭design‬ ‭contribute‬ ‭to‬ ‭sustainable‬ ‭farming‬ ‭practices‬ ‭and‬
‭improved livelihoods for farmers worldwide.‬

‭The‬ ‭Agriculture‬ ‭Portal‬ ‭is‬ ‭poised‬ ‭to‬ ‭transform‬ ‭agriculture‬ ‭by‬ ‭empowering‬
‭farmers‬ ‭with‬ ‭accurate‬ ‭predictions,‬ ‭personalized‬ ‭insights,‬ ‭and‬ ‭informed‬
‭decision-making.‬ ‭By‬ ‭bridging‬ ‭the‬ ‭gap‬ ‭between‬ ‭technology‬ ‭and‬ ‭traditional‬
‭11‬‭of 54‬
‭Agriculture Portal‬

‭farming‬ ‭practices,‬ ‭it‬ ‭contributes‬ ‭to‬ ‭sustainable‬ ‭food‬ ‭production‬ ‭and‬ ‭resilient‬
‭farming‬ ‭communities.‬ ‭As‬ ‭we‬ ‭move‬ ‭forward,‬ ‭the‬ ‭Agriculture‬ ‭Portal‬ ‭stands‬ ‭as‬ ‭a‬
‭beacon‬ ‭of‬ ‭innovation,‬ ‭ensuring‬ ‭a‬ ‭brighter‬ ‭future‬ ‭for‬ ‭global‬ ‭agriculture.The‬
‭Agriculture‬ ‭Portal‬ ‭represents‬ ‭a‬ ‭significant‬ ‭advancement‬ ‭in‬ ‭agricultural‬
‭technology.‬ ‭By‬‭leveraging‬‭machine‬‭learning‬‭and‬‭various‬‭algorithms,‬‭it‬‭provides‬
‭farmers‬ ‭with‬ ‭personalized‬ ‭recommendations‬‭and‬‭prescriptive‬‭analytics.[3]This‬
‭not‬‭only‬‭helps‬‭in‬‭informed‬‭decision-making‬‭but‬‭also‬‭enhances‬‭productivity‬‭and‬
‭sustainability‬ ‭in‬ ‭farming.‬ ‭Despite‬ ‭some‬ ‭limitations,‬ ‭the‬ ‭Agriculture‬ ‭Portal’s‬
‭impact‬ ‭on‬ ‭the‬ ‭agricultural‬ ‭sector‬ ‭is‬ ‭undeniable,‬ ‭making‬ ‭it‬ ‭a‬ ‭valuable‬ ‭tool‬ ‭for‬
‭farmers worldwide.‬

‭12‬‭of 54‬
‭Agriculture Portal‬

‭Chapter 3 - Proposed System‬


‭Agricultural Portal System‬

‭3.1 The Proposal‬

‭The‬ ‭proposed‬ ‭agriculture‬ ‭portal‬ ‭aims‬ ‭to‬ ‭revolutionize‬ ‭farming‬ ‭practices‬ ‭by‬
‭providing‬ ‭a‬ ‭comprehensive‬ ‭suite‬ ‭of‬ ‭features‬ ‭to‬ ‭assist‬ ‭farmers‬ ‭in‬ ‭making‬
‭informed‬ ‭decisions‬ ‭and‬ ‭optimizing‬ ‭their‬ ‭agricultural‬ ‭output.‬ ‭The‬ ‭portal‬
‭encompasses‬ ‭crop‬ ‭prediction,‬ ‭crop‬ ‭recommendation,‬ ‭yield‬ ‭prediction,‬
‭weather forecasting, and access to agriculture-related news.‬

‭Crop‬ ‭prediction‬ ‭utilizes‬ ‭historical‬ ‭data,‬ ‭machine‬ ‭learning‬ ‭algorithms,‬ ‭and‬


‭satellite‬ ‭imagery‬ ‭to‬ ‭forecast‬ ‭crop‬ ‭yields‬ ‭for‬ ‭specific‬ ‭regions.‬ ‭By‬ ‭analyzing‬
‭factors‬‭such‬‭as‬‭soil‬‭quality,‬‭climate‬‭conditions,‬‭and‬‭crop‬‭rotations,‬‭farmers‬‭can‬
‭anticipate future harvests and plan accordingly.‬

‭Crop‬ ‭recommendation‬ ‭leverages‬ ‭agronomic‬ ‭expertise‬ ‭and‬ ‭data‬ ‭analytics‬ ‭to‬


‭suggest‬ ‭suitable‬ ‭crops‬ ‭based‬ ‭on‬ ‭soil‬ ‭type,‬ ‭climate,‬ ‭and‬ ‭market‬ ‭demand.‬ ‭By‬
‭tailoring‬ ‭recommendations‬ ‭to‬ ‭local‬ ‭conditions‬ ‭and‬ ‭farmers'‬ ‭preferences,‬ ‭the‬
‭portal‬ ‭helps‬ ‭diversify‬ ‭crop‬ ‭portfolios,‬ ‭improve‬ ‭soil‬ ‭health,‬ ‭and‬ ‭maximize‬
‭profitability.‬

‭New‬ ‭agriculture‬ ‭portal‬ ‭integrates‬ ‭API‬ ‭for‬ ‭real-time‬ ‭updates‬ ‭on‬ ‭crop‬ ‭prices,‬
‭weather‬ ‭forecasts,‬ ‭and‬ ‭farming‬ ‭techniques,‬ ‭empowering‬ ‭farmers‬ ‭with‬
‭valuable information for improved productivity and sustainability.‬

‭Through‬ ‭its‬ ‭integrated‬ ‭suite‬ ‭of‬ ‭features,‬ ‭the‬ ‭agriculture‬ ‭portal‬ ‭empowers‬
‭farmers‬ ‭with‬ ‭actionable‬ ‭insights,‬ ‭expert‬ ‭guidance,‬ ‭and‬ ‭timely‬‭information‬‭to‬
‭13‬‭of‬‭55‬
‭Agriculture Portal‬

‭optimize‬‭agricultural‬‭practices,‬‭improve‬‭productivity,‬‭and‬‭sustainably‬‭manage‬
‭resources.[5]‬ ‭By‬ ‭fostering‬ ‭knowledge‬ ‭exchange‬ ‭and‬ ‭collaboration‬ ‭within‬ ‭the‬
‭farming‬‭community,‬‭the‬‭portal‬‭contributes‬‭to‬‭the‬‭resilience‬‭and‬‭prosperity‬‭of‬
‭agricultural ecosystems.‬

‭3.2 Benefits of the Proposed System‬

‭The‬ ‭proposed‬ ‭agriculture‬ ‭portal‬ ‭offers‬ ‭a‬ ‭range‬ ‭of‬ ‭benefits‬ ‭to‬ ‭farmers‬ ‭and‬
‭stakeholders in the agricultural sector:‬

‭1.‬ ‭Increased‬ ‭Productivity:‬ ‭Crop‬ ‭prediction,‬ ‭crop‬ ‭recommendation,‬ ‭and‬ ‭yield‬


‭prediction‬ ‭functionalities‬ ‭enable‬ ‭farmers‬ ‭to‬ ‭make‬ ‭data-driven‬ ‭decisions,‬
‭leading‬‭to‬‭optimized‬‭crop‬‭selection,‬‭improved‬‭resource‬‭allocation,‬‭and‬‭higher‬
‭yields.‬

‭2.‬ ‭Enhanced‬ ‭Sustainability:‬ ‭With‬ ‭access‬ ‭to‬ ‭tailored‬ ‭crop‬ ‭recommendations‬


‭and‬ ‭yield‬ ‭predictions,‬ ‭farmers‬ ‭can‬ ‭adopt‬ ‭sustainable‬ ‭farming‬ ‭practices‬ ‭that‬
‭promote‬ ‭soil‬ ‭health,‬ ‭water‬ ‭conservation,‬ ‭and‬ ‭biodiversity‬ ‭conservation,‬
‭contributing to long-term environmental stewardship.‬

‭4.‬ ‭Improved‬ ‭Profitability:‬ ‭Timely‬ ‭access‬ ‭to‬ ‭agriculture-related‬ ‭news‬ ‭and‬


‭market‬‭insights‬‭enables‬‭farmers‬‭to‬‭stay‬‭informed‬‭about‬‭price‬‭trends,‬‭demand‬
‭fluctuations,‬ ‭and‬ ‭policy‬ ‭changes,‬ ‭empowering‬ ‭them‬ ‭to‬ ‭make‬ ‭informed‬
‭marketing and investment decisions that maximize profitability.‬

‭5.‬ ‭Knowledge‬ ‭Sharing‬ ‭and‬ ‭Collaboration:‬ ‭The‬ ‭portal‬ ‭serves‬‭as‬‭a‬‭platform‬‭for‬


‭knowledge‬‭exchange,‬‭enabling‬‭farmers‬‭to‬‭learn‬‭from‬‭each‬‭other,‬‭access‬‭expert‬
‭guidance,‬ ‭and‬ ‭participate‬ ‭in‬ ‭community-driven‬ ‭initiatives‬ ‭that‬ ‭foster‬
‭innovation and resilience in agriculture.‬

‭14‬‭of‬‭55‬
‭Agriculture Portal‬

‭Overall,‬ ‭the‬ ‭agriculture‬ ‭portal‬ ‭facilitates‬ ‭informed‬ ‭decision-making,‬ ‭risk‬


‭management,‬ ‭and‬ ‭sustainable‬ ‭practices,‬ ‭ultimately‬ ‭leading‬ ‭to‬ ‭increased‬
‭productivity, profitability, and resilience in the agricultural sector.‬

‭3.3 Architectural Diagram‬

‭Figure 3-1 : Architecture diagram for a agriculture portal‬


‭(‬‭according to diagram, user will give required data,‬‭then model will predict the output )‬

‭3.4 Feasibility Study‬

‭A‬ ‭feasibility‬ ‭study‬ ‭is‬ ‭an‬ ‭analysis‬ ‭of‬ ‭how‬ ‭successfully‬ ‭a‬ ‭system‬ ‭can‬ ‭be‬
‭implemented,‬‭accounting‬‭for‬‭factors‬‭that‬‭affect‬‭it‬‭such‬‭as‬‭economic,‬‭technical‬
‭and‬ ‭operational‬ ‭factors‬ ‭to‬ ‭determine‬ ‭its‬ ‭potential‬ ‭positive‬ ‭and‬ ‭negative‬
‭outcomes before investing a considerable amount of time and money into it.‬

‭3.4.1 Technical‬

‭The‬‭technical‬‭feasibility‬‭study‬‭of‬‭the‬‭agriculture‬‭portal‬‭involves‬‭evaluating‬‭the‬
‭feasibility of implementation. Assessing the feasibility of integrating multiple‬
‭15‬‭of‬‭55‬
‭Agriculture Portal‬

‭data‬ ‭sources,‬ ‭algorithms,‬ ‭and‬ ‭functionalities‬ ‭into‬ ‭a‬ ‭cohesive‬ ‭platform,‬


‭ensuring‬ ‭interoperability,‬ ‭data‬ ‭consistency,‬ ‭and‬ ‭real-time‬ ‭updates.‬
‭Determining‬‭the‬‭feasibility‬‭of‬‭selecting‬‭appropriate‬‭technologies,‬‭frameworks,‬
‭and‬ ‭tools‬ ‭for‬ ‭web‬ ‭development,‬ ‭data‬ ‭processing,‬ ‭and‬ ‭cloud‬ ‭infrastructure,‬
‭considering‬ ‭factors‬ ‭such‬ ‭as‬ ‭scalability,‬ ‭security,‬ ‭and‬ ‭performance.‬ ‭Conduct‬ ‭a‬
‭technical‬ ‭analysis‬ ‭of‬ ‭agricultural‬ ‭news‬ ‭through‬ ‭API‬ ‭integration‬ ‭with‬ ‭an‬
‭agriculture‬ ‭portal,‬ ‭examining‬ ‭trends,‬ ‭insights,‬ ‭and‬ ‭data‬ ‭for‬ ‭informed‬
‭decision-making and market understanding.‬

‭Overall,‬ ‭the‬ ‭technical‬ ‭feasibility‬ ‭study‬ ‭aims‬ ‭to‬ ‭identify‬ ‭potential‬ ‭challenges‬
‭and‬ ‭risks‬ ‭associated‬ ‭with‬ ‭implementing‬ ‭the‬‭agriculture‬‭portal's‬‭features‬‭and‬
‭to propose solutions to ensure successful development and deployment.‬

‭3.4.2 Economical‬

‭The‬ ‭economical‬ ‭feasibility‬ ‭study‬ ‭of‬ ‭the‬ ‭agriculture‬ ‭portal‬ ‭involves‬ ‭assessing‬
‭the‬‭potential‬‭costs‬‭and‬‭benefits‬‭associated‬‭with‬‭its‬‭development,‬‭deployment,‬
‭and operation:‬

‭1.‬ ‭Cost‬ ‭Analysis:‬ ‭Evaluating‬ ‭the‬ ‭upfront‬ ‭and‬ ‭ongoing‬ ‭costs‬ ‭involved‬ ‭in‬
‭developing‬ ‭the‬ ‭portal,‬ ‭including‬ ‭software‬ ‭development,‬ ‭data‬ ‭acquisition,‬
‭infrastructure setup, maintenance, and personnel expenses.‬

‭2.‬ ‭Cost‬ ‭Savings:‬ ‭Identifying‬ ‭potential‬ ‭cost‬ ‭savings‬ ‭for‬ ‭farmers‬‭resulting‬‭from‬


‭improved‬ ‭decision-making‬ ‭and‬ ‭optimized‬ ‭farming‬ ‭practices‬ ‭enabled‬‭by‬‭crop‬
‭prediction,‬ ‭crop‬ ‭recommendation,‬ ‭yield‬ ‭prediction,‬ ‭weather‬ ‭forecasting,‬ ‭and‬
‭access‬ ‭to‬ ‭agriculture-related‬ ‭news.‬ ‭This‬ ‭could‬ ‭include‬ ‭reduced‬ ‭input‬ ‭costs,‬
‭minimized crop losses, and increased yields.‬

‭16‬‭of‬‭55‬
‭Agriculture Portal‬

‭3.‬ ‭Revenue‬ ‭Generation:‬ ‭Exploring‬‭revenue‬‭streams‬‭such‬‭as‬‭subscription‬‭fees,‬


‭premium‬ ‭features,‬ ‭advertising,‬ ‭and‬ ‭partnerships‬ ‭with‬ ‭agricultural‬ ‭input‬
‭suppliers, marketplaces, or government agencies.‬

‭4.‬ ‭Return‬ ‭on‬ ‭Investment‬ ‭(ROI):‬ ‭Calculating‬ ‭the‬ ‭projected‬ ‭ROI‬ ‭based‬ ‭on‬
‭estimated‬ ‭cost‬ ‭savings‬ ‭and‬ ‭revenue‬ ‭generation‬ ‭compared‬ ‭to‬ ‭the‬ ‭initial‬
‭investment.‬

‭5.‬ ‭Market‬ ‭Potential:‬ ‭Analyzing‬ ‭the‬ ‭market‬ ‭demand‬ ‭for‬ ‭such‬ ‭a‬ ‭portal‬ ‭among‬
‭farmers,‬ ‭agricultural‬ ‭stakeholders,‬ ‭and‬ ‭investors,‬‭considering‬‭factors‬‭such‬‭as‬
‭competitive landscape, user adoption rates, and growth potential.‬

‭Based‬‭on‬‭the‬‭economical‬‭feasibility‬‭analysis,‬‭the‬‭agriculture‬‭portal‬‭is‬‭expected‬
‭to‬‭deliver‬‭significant‬‭value‬‭by‬‭improving‬‭farm‬‭profitability,‬‭reducing‬‭risks,‬‭and‬
‭enhancing‬ ‭sustainability,‬ ‭thus‬ ‭justifying‬ ‭the‬ ‭investment‬ ‭in‬ ‭its‬ ‭development‬
‭and operation.‬

‭3.4.3 Operational‬
‭The‬ ‭operational‬ ‭feasibility‬ ‭study‬ ‭of‬ ‭the‬ ‭agriculture‬ ‭portal‬ ‭involves‬ ‭a‬
‭comprehensive‬‭examination‬‭of‬‭its‬‭functionality‬‭and‬‭usability‬‭to‬‭determine‬‭its‬
‭practicality‬ ‭in‬ ‭real-world‬ ‭agricultural‬ ‭settings.‬ ‭Firstly,‬ ‭the‬ ‭usability‬ ‭of‬ ‭the‬
‭portal's‬ ‭interface‬ ‭is‬ ‭evaluated,‬ ‭ensuring‬ ‭that‬ ‭it‬ ‭is‬ ‭intuitive‬ ‭and‬ ‭accessible‬ ‭to‬
‭farmers‬ ‭of‬ ‭varying‬ ‭technological‬ ‭proficiency‬ ‭levels.‬ ‭This‬ ‭entails‬ ‭designing‬ ‭a‬
‭user-friendly‬‭interface‬‭that‬‭allows‬‭farmers‬‭to‬‭easily‬‭navigate‬‭between‬‭features‬
‭such‬ ‭as‬ ‭crop‬ ‭prediction,‬ ‭recommendation,‬ ‭yield‬ ‭prediction,‬ ‭weather‬
‭forecasting, and agriculture-related news.‬

‭Additionally,‬ ‭training‬ ‭programs‬ ‭and‬ ‭support‬ ‭services‬ ‭are‬ ‭planned‬‭to‬‭educate‬


‭farmers‬ ‭on‬‭how‬‭to‬‭effectively‬‭use‬‭the‬‭portal‬‭and‬‭address‬‭any‬‭technical‬‭issues‬
‭or‬ ‭concerns‬ ‭they‬ ‭may‬ ‭encounter.‬ ‭This‬ ‭includes‬ ‭providing‬ ‭comprehensive‬

‭17‬‭of‬‭55‬
‭Agriculture Portal‬

‭documentation,‬ ‭tutorials,‬ ‭and‬ ‭customer‬ ‭support‬ ‭channels‬ ‭to‬ ‭assist‬ ‭users‬ ‭in‬
‭maximizing the benefits of the portal for their agricultural operations.‬
‭3.5 Design Representation‬

‭3.5.1 Data Flow Diagram‬

‭Figure 3-2: Data Flow Diagram level 0‬


‭The user will provide input and our prediction system will generate result‬

‭Figure 3-3: Data Flow Diagram level 1‬


‭The system takes input, process it and retrieves crop recommendation from‬
‭database‬

‭18‬‭of‬‭55‬
‭Agriculture Portal‬

‭3.5.2 Use case Diagram‬

‭Figure 3-4 : Use Case Diagram of Agriculture Recommendation System‬

‭19‬‭of‬‭55‬
‭Agriculture Portal‬

‭Figure 3-4 : Explanation‬

‭Actors:‬
‭●‬ ‭User -‬‭The person who interacts with the system to‬‭know about crops.‬
‭Use Cases:‬
‭●‬ ‭Collect‬ ‭Data‬ ‭-‬ ‭Collect‬ ‭data‬ ‭from‬ ‭the‬ ‭user‬ ‭as‬ ‭K,‬ ‭Potassium,‬ ‭Nitrogen,‬
‭Phosphorus, Ph , Rainfall.‬
‭●‬ ‭Select Data-‬‭The system filters and selects relevant‬‭data for analysis.‬
‭●‬ ‭Retrieve‬ ‭Data‬ ‭-‭T
‬ he‬ ‭system‬ ‭retrieves‬ ‭additional‬ ‭context-specific‬
‭data:Crop Database,Fertilizer Database,Weather Data,News Archive.‬
‭●‬ ‭Fetch‬ ‭Data‬ ‭-‬‭The‬ ‭system‬ ‭fetches‬ ‭data‬ ‭from‬ ‭external‬ ‭APIs‬ ‭or‬
‭databases:Weather Service,News Service‬
‭●‬ ‭Select CSV -‬‭Selecting CSV of the given data.‬
‭●‬ ‭Select‬ ‭random‬ ‭forest‬ ‭algorithm‬ ‭-‭T
‬ he‬ ‭system‬ ‭chooses‬ ‭the‬ ‭Random‬
‭Forest algorithm for predictive modeling.‬
‭●‬ ‭Show‬‭Results‬‭-‬‭The‬‭system‬‭presents‬‭personalized‬‭recommendations‬‭to‬
‭farmers‬

‭Relationships:‬

‭→‬ ‭The‬ ‭User‬ ‭interacts‬ ‭with‬ ‭the‬ ‭system‬ ‭by‬ ‭providing‬ ‭a‬ ‭seed‬ ‭phrase‬ ‭and‬
‭receiving the right crop recommendation.‬
‭→‬ ‭The‬‭system‬‭will‬‭generate‬‭the‬‭right‬‭crop‬‭for‬‭the‬‭soil‬‭and‬‭farmers‬‭can‬‭easily‬
‭use it.‬
‭Overall,‬ ‭the‬ ‭use‬ ‭case‬ ‭diagram‬ ‭illustrates‬ ‭how‬ ‭a‬ ‭user‬ ‭interacts‬ ‭with‬ ‭the‬
‭agriculture portal to know about crop recommendation, disease prediction.‬

‭20‬‭of‬‭55‬
‭Agriculture Portal‬

‭3.5.3 Entity-Relationship Diagram‬

‭Figure 3-5 : E-R diagram‬

‭Figure 3-5 : Explanation‬

‭The‬ ‭ER‬ ‭diagram‬ ‭depicts‬ ‭a‬ ‭system‬ ‭that‬ ‭generates‬ ‭crop‬ ‭,‬ ‭disease‬ ‭prediction,‬
‭fertilizer‬ ‭recommendation,‬‭likely‬‭through‬‭a‬‭machine‬‭learning‬‭model.‬‭Here’s‬‭a‬
‭breakdown of the entities and their relationships:‬

‭Entities:‬

‭1.‬ ‭Crop‬
‭●‬‭Attributes: CropName, SoilType, ClimateType‬
‭21‬‭of‬‭55‬
‭Agriculture Portal‬

‭2.‬ ‭CropPrediction‬
‭●‬‭Attributes: CropID (PK),, PredictionValue‬
‭3.‬ ‭PlantDisease‬
‭●‬‭Attributes: CropID (PK), DiseaseName‬
‭4.‬ ‭News‬
‭●‬‭Attributes: NewsID (PK), Content‬
‭5.‬ ‭Recommendation‬
‭●‬‭Attributes:CropID (PK), RecommendationText‬
‭6.‬ ‭Farmer‬
‭●‬‭Attributes: UserID (FK), password‬

‭The Relationships in the ERD are as follows:‬

‭●‬ ‭CropPrediction‬ ‭-‬ ‭Crop‬ ‭(1-to-many):‬ ‭One‬ ‭crop‬ ‭prediction‬ ‭can‬ ‭be‬
‭associated with one crop, but one crop can have multiple predictions.‬
‭●‬ ‭PlantDisease‬ ‭-‬ ‭Crop‬ ‭(1-to-many):‬ ‭One‬ ‭plant‬ ‭disease‬ ‭prediction‬ ‭can‬ ‭be‬
‭associated‬ ‭with‬ ‭one‬ ‭crop,‬ ‭but‬ ‭one‬ ‭crop‬ ‭can‬ ‭have‬ ‭multiple‬ ‭disease‬
‭predictions.‬
‭●‬ ‭Recommendation‬‭-‬‭Crop‬‭(1-to-many):‬‭One‬‭crop‬‭recommendation‬‭can‬‭be‬
‭associated‬ ‭with‬ ‭one‬ ‭crop,‬ ‭but‬ ‭one‬ ‭crop‬ ‭can‬ ‭have‬ ‭multiple‬
‭recommendations.‬
‭●‬ ‭News‬‭-‬‭Crop‬‭(many-to-many):‬‭Many‬‭news‬‭articles‬‭can‬‭be‬‭associated‬‭with‬
‭multiple crops, and vice versa.‬
‭●‬ ‭Farmer‬ ‭-‬ ‭Crop‬ ‭(many-to-many):‬ ‭Many‬ ‭farmers‬ ‭can‬ ‭grow‬ ‭multiple‬‭crops,‬
‭and each crop can be grown by multiple farmers.‬

‭3.6 Deployment Requirements‬

‭There‬ ‭are‬ ‭various‬ ‭requirements‬ ‭(hardware,‬ ‭software‬ ‭and‬ ‭services)‬ ‭to‬


‭successfully deploy the system. These are mentioned below :‬
‭22‬‭of‬‭55‬
‭Agriculture Portal‬

‭3.6.1 Hardware‬

‭●‬ ‭32-bit, x86 Processing system‬


‭●‬ ‭Windows 7 or later operating system‬
‭●‬ ‭High‬ ‭processing‬ ‭computer‬ ‭system‬ ‭without‬ ‭GPU‬ ‭or‬ ‭with‬ ‭GPU(high‬
‭performance).‬

‭3.6.2 Software‬

‭●‬ ‭HTML‬ ‭5:Hypertext‬ ‭Markup‬ ‭Language‬ ‭(HTML)‬ ‭is‬ ‭the‬ ‭standard‬ ‭markup‬
‭language and web applications. IT is used to make the website.‬
‭●‬ ‭CSS: IT is used to make the website more attractive.‬
‭●‬ ‭Javascript: it is used to make the pages more interactive.‬
‭●‬ ‭PHP‬‭5.2.0:PHP‬‭is‬‭aside‬‭scripting‬‭language‬‭development,‬ ‭and‬ ‭also‬ ‭used‬ ‭as‬
‭a general purpose programming language.‬
‭●‬ ‭Python : Python is used to implement machine learning algorithms.‬
‭●‬ ‭Pandas and NumPy: Essential libraries for data manipulation and analysis.‬
‭●‬ ‭Scikit-learn: ML toolkit for implementing algorithms.‬
‭●‬ ‭Flask-Flask‬‭is‬‭a‬‭micro‬‭web‬‭framework‬‭written‬‭in‬‭Python.‬‭It‬‭is‬‭classified‬‭as‬‭a‬
‭microframework because it does not require particular tools or libraries.‬
‭●‬ ‭SQlAlchemy-SQLAlchemy‬ ‭is‬ ‭the‬ ‭Python‬ ‭SQL‬ ‭toolkit‬ ‭and‬ ‭Object‬ ‭Relational‬
‭Mapper‬ ‭that‬ ‭gives‬ ‭application‬ ‭developers‬ ‭the‬ ‭full‬ ‭power‬ ‭and‬ ‭flexibility‬ ‭of‬
‭SQL.‬
‭●‬ ‭Utils-Returns‬ ‭true‬ ‭if‬‭the‬‭given‬‭value‬‭is‬‭empty,‬‭false‬‭if‬‭any‬‭value‬‭exists.‬‭Works‬‭for‬
‭booleans, functions, numbers, strings, nulls, objects and arrays.‬

‭23‬‭of‬‭55‬
‭Agriculture Portal‬

‭Chapter 4 - Implementation‬
‭IMPLEMENTATION PHASE‬

‭The‬ ‭implementation‬ ‭of‬ ‭the‬ ‭agriculture‬ ‭portal‬ ‭involves‬ ‭developing‬ ‭robust‬


‭algorithms‬ ‭and‬ ‭data‬ ‭processing‬ ‭pipelines‬ ‭for‬ ‭crop‬ ‭prediction,‬ ‭crop‬
‭recommendation,‬ ‭yield‬ ‭prediction,‬ ‭weather‬ ‭forecasting,‬ ‭and‬ ‭news‬
‭aggregation.‬ ‭These‬ ‭algorithms‬ ‭utilize‬ ‭machine‬ ‭learning‬ ‭techniques‬ ‭and‬
‭analyze‬ ‭various‬ ‭data‬ ‭sources‬ ‭such‬ ‭as‬ ‭historical‬ ‭agricultural‬ ‭data,‬ ‭satellite‬
‭imagery,‬ ‭weather‬ ‭data,‬ ‭and‬ ‭market‬ ‭trends.‬ ‭The‬ ‭portal's‬ ‭architecture‬ ‭must‬
‭ensure‬ ‭scalability,‬ ‭reliability,‬ ‭and‬ ‭real-time‬ ‭updates‬ ‭to‬ ‭provide‬ ‭farmers‬ ‭with‬
‭accurate‬ ‭and‬ ‭timely‬ ‭information‬ ‭to‬ ‭support‬ ‭their‬ ‭decision-making‬ ‭processes‬
‭and improve agricultural outcomes‬

‭4.1 Technique Used‬

‭4.1.1 Random Forest Algorithm‬

‭●‬ ‭Random‬ ‭Forest‬ ‭is‬ ‭a‬ ‭popular‬ ‭machine‬ ‭learning‬ ‭algorithm‬ ‭that‬ ‭belongs‬ ‭to‬
‭the‬ ‭supervised‬ ‭learning‬ ‭technique.‬ ‭It‬ ‭can‬ ‭be‬ ‭used‬ ‭for‬ ‭both‬ ‭Classification‬
‭and‬‭Regression‬‭problems‬‭in‬‭ML.‬‭[1]It‬‭is‬‭based‬‭on‬‭the‬‭concept‬‭of‬‭ensemble‬
‭learning,‬ ‭which‬ ‭is‬ ‭a‬ ‭process‬ ‭of‬ ‭combining‬ ‭multiple‬ ‭classifiers‬ ‭to‬ ‭solve‬ ‭a‬
‭complex problem and to improve the performance of the model.‬

‭As‬‭the‬‭name‬‭suggests,‬‭"Random‬‭Forest‬‭is‬‭a‬‭classifier‬‭that‬‭contains‬‭a‬‭number‬‭of‬
‭decision‬‭trees‬‭on‬‭various‬‭subsets‬‭of‬‭the‬‭given‬‭dataset‬‭and‬‭takes‬‭the‬‭average‬‭to‬
‭improve‬ ‭the‬ ‭predictive‬ ‭accuracy‬ ‭of‬ ‭that‬ ‭dataset."‬ ‭Instead‬ ‭of‬ ‭relying‬ ‭on‬ ‭one‬

‭24‬‭of 54‬
‭Agriculture Portal‬

‭decision‬‭tree,‬‭the‬‭random‬‭forest‬‭takes‬‭the‬‭prediction‬‭from‬‭each‬‭tree‬‭and‬‭based‬
‭on the majority votes of predictions, and it predicts the final output.‬

‭The‬ ‭greater‬ ‭number‬ ‭of‬ ‭trees‬ ‭in‬ ‭the‬ ‭forest‬ ‭leads‬ ‭to‬ ‭higher‬ ‭accuracy‬ ‭and‬
‭prevents the problem of overfitting.‬

‭The below diagram explains the working of the Random Forest algorithm:‬

‭Figure 4-1: Random Forest Algorithm‬

‭4.2 Tools Used‬

‭4.2.1 Python:‬

‭Python‬ ‭is‬ ‭an‬ ‭interpreted,‬ ‭object-oriented,‬ ‭high-level‬ ‭programming‬ ‭language‬


‭with‬‭dynamic‬‭semantics.‬‭Its‬‭high-level‬‭built‬‭in‬‭data‬‭structures,‬‭combined‬‭with‬

‭25‬‭of 54‬
‭Agriculture Portal‬

‭dynamic‬ ‭typing‬ ‭and‬ ‭dynamic‬ ‭binding,‬ ‭make‬ ‭it‬ ‭very‬ ‭attractive‬ ‭for‬ ‭Rapid‬
‭Application‬‭Development,‬‭as‬‭well‬‭as‬‭for‬‭use‬‭as‬‭a‬‭scripting‬‭or‬‭glue‬‭language‬‭to‬
‭connect‬ ‭existing‬ ‭components‬ ‭together.‬ ‭Python's‬ ‭simple,‬ ‭easy‬ ‭to‬ ‭learn‬ ‭syntax‬
‭emphasizes‬ ‭readability‬ ‭and‬ ‭therefore‬ ‭reduces‬ ‭the‬ ‭cost‬ ‭of‬ ‭program‬
‭maintenance.‬ ‭Python‬ ‭supports‬ ‭modules‬ ‭and‬ ‭packages,‬ ‭which‬ ‭encourages‬
‭program modularity and code reuse.‬

‭Figure 4-2: Features of Python‬

‭4.2.2 Scikit‬

‭Scikit-learn,‬‭commonly‬‭abbreviated‬‭as‬‭"scikit,"‬‭is‬‭a‬‭versatile‬‭and‬‭user-friendly‬
‭machine‬ ‭learning‬ ‭library‬ ‭for‬ ‭Python.‬ ‭It‬ ‭provides‬ ‭a‬ ‭wide‬ ‭array‬ ‭of‬ ‭tools‬ ‭for‬
‭various‬ ‭machine‬ ‭learning‬ ‭tasks‬ ‭such‬ ‭as‬ ‭classification,‬ ‭regression,‬ ‭clustering,‬
‭dimensionality reduction, and model selection.‬
‭With‬ ‭scikit-learn,‬ ‭users‬ ‭can‬ ‭efficiently‬ ‭implement‬ ‭and‬ ‭experiment‬ ‭with‬
‭machine‬‭learning‬‭algorithms‬‭thanks‬‭to‬‭its‬‭consistent‬‭and‬‭intuitive‬‭API‬‭design.‬
‭It‬ ‭offers‬ ‭a‬ ‭rich‬ ‭selection‬ ‭of‬ ‭algorithms,‬ ‭including‬ ‭support‬ ‭vector‬ ‭machines,‬
‭random forests, gradient boosting, k-nearest neighbors, and many others.‬

‭26‬‭of 54‬
‭Agriculture Portal‬

‭4.2.3 Tensor Flow‬

‭Pandas‬ ‭and‬ ‭NumPy‬ ‭are‬ ‭essential‬ ‭Python‬ ‭libraries‬ ‭for‬ ‭data‬‭manipulation‬‭and‬


‭numerical‬ ‭computing,‬ ‭respectively.‬ ‭NumPy‬ ‭provides‬ ‭powerful‬ ‭tools‬ ‭for‬
‭working‬ ‭with‬ ‭multi-dimensional‬ ‭arrays‬ ‭and‬ ‭matrices,‬ ‭along‬ ‭with‬
‭mathematical‬ ‭functions‬ ‭to‬ ‭operate‬ ‭on‬ ‭these‬ ‭arrays‬ ‭efficiently.‬ ‭Pandas‬ ‭builds‬
‭on‬ ‭NumPy's‬ ‭foundation,‬ ‭offering‬ ‭data‬ ‭structures‬ ‭like‬ ‭DataFrame‬ ‭and‬ ‭Series‬
‭that‬‭enable‬‭easy‬‭handling‬‭and‬‭analysis‬‭of‬‭structured‬‭data.‬‭With‬‭Pandas,‬‭users‬
‭can‬ ‭perform‬ ‭tasks‬ ‭such‬ ‭as‬ ‭data‬ ‭cleaning,‬ ‭manipulation,‬ ‭aggregation,‬ ‭and‬
‭visualization,‬ ‭making‬ ‭it‬ ‭indispensable‬ ‭for‬ ‭data‬ ‭preprocessing‬ ‭and‬ ‭analysis‬
‭tasks.‬ ‭Both‬ ‭libraries‬ ‭are‬ ‭widely‬ ‭used‬ ‭in‬ ‭data‬ ‭science,‬ ‭machine‬ ‭learning,‬ ‭and‬
‭scientific‬ ‭computing‬ ‭due‬ ‭to‬ ‭their‬ ‭efficiency,‬ ‭flexibility,‬ ‭and‬ ‭extensive‬
‭community support.‬

‭Figure 4-3: Pandas and numpy‬

‭4.2.4 News API‬

‭A‬ ‭News‬ ‭API‬ ‭is‬ ‭an‬ ‭(application‬ ‭programming)‬ ‭interface‬ ‭that‬ ‭can‬ ‭be‬ ‭used‬ ‭by‬
‭other‬ ‭applications,‬ ‭such‬ ‭as‬ ‭intranet‬ ‭portals,‬ ‭CMS,‬ ‭CRM,‬ ‭or‬ ‭KMS,‬ ‭to‬ ‭obtain‬
‭machine-readable‬ ‭data‬ ‭(JSON‬ ‭or‬ ‭XML‬ ‭format)‬ ‭automatically‬ ‭from‬ ‭different‬
‭27‬‭of 54‬
‭Agriculture Portal‬

‭websites.‬ ‭It‬ ‭can‬ ‭be‬‭used‬‭to‬‭create‬‭new‬‭products‬‭and‬‭services,‬‭add‬‭features‬‭to‬


‭existing applications, and/or monetize content[8].‬

‭Organizations‬ ‭need‬ ‭a‬ ‭more‬ ‭efficient‬ ‭way‬ ‭to‬ ‭track‬ ‭news‬ ‭sources.‬ ‭A‬ ‭news‬ ‭API‬
‭makes‬ ‭it‬ ‭easy‬ ‭to‬ ‭keep‬ ‭track‬ ‭of‬ ‭news‬‭articles.‬‭of‬‭your‬‭choice‬‭of‬‭publication‬‭or‬
‭on‬ ‭the‬ ‭Internet.‬ ‭You‬ ‭can‬ ‭easily‬ ‭retrieve‬ ‭news‬ ‭articles‬ ‭mentioning‬ ‭your‬
‭company, brand, product, or service from various reputable sources.‬

‭4.3 Visualization‬

‭Figure 4-4 : Heatmap to analyze the correlation between features.‬

‭Inference from the above heatmap is that apart from K vs. P, there are no two‬
‭highly correlated features.‬

‭28‬‭of 54‬
‭Agriculture Portal‬

‭Figure 4-5 :Confusion Matrix (‬‭Matrix measuring model's‬‭accuracy‬


‭using true/false positives/negatives. )‬
‭4.4 Project Snapshot for Visual Reference‬

‭Figure 4-6 : Crop Recommendation‬

‭29‬‭of 54‬
‭Agriculture Portal‬

‭Figure 4-7 :Home page of agriculture portal‬

‭Figure 4-8 :Admin Dashboard‬

‭30‬‭of 54‬
‭Agriculture Portal‬

‭Figure 4-9 : Fertilizer Recommendation‬


‭4.5 Testing‬

‭Testing‬‭is‬‭the‬‭process‬‭of‬‭evaluation‬‭of‬‭a‬‭system‬‭to‬‭detect‬‭differences‬‭between‬
‭given‬‭input‬‭and‬‭expected‬‭output‬‭and‬‭also‬‭to‬‭assess‬‭the‬‭features‬‭of‬‭the‬‭system.‬
‭Testing‬‭assesses‬‭the‬‭quality‬‭of‬‭the‬‭product.‬‭It‬‭is‬‭a‬‭process‬‭that‬‭is‬‭done‬‭during‬
‭the development process.‬

‭4.5.1 Strategy Used‬

‭Tests can be conducted based on two approaches –‬


‭●‬ ‭Functionality testing‬
‭●‬ ‭Implementation testing‬
‭The‬ ‭texting‬ ‭method‬ ‭used‬ ‭here‬ ‭is‬ ‭Black‬ ‭Box‬ ‭Testing.‬ ‭It‬ ‭is‬ ‭carried‬ ‭out‬ ‭to‬ ‭test‬
‭functionality‬‭of‬‭the‬‭program.‬‭It‬‭is‬‭also‬‭called‬‭‘Behavioral’‬‭testing.‬ ‭The‬‭tester‬‭in‬
‭this‬‭case,‬‭has‬‭a‬‭set‬‭of‬‭input‬‭values‬‭and‬‭respective‬‭desired‬‭results.‬‭On‬‭providing‬

‭31‬‭of 54‬
‭Agriculture Portal‬

‭input,‬‭The‬‭output‬‭matches‬‭with‬‭the‬‭desired‬‭results,‬‭the‬‭program‬‭is‬‭tested‬‭‘ok’,‬
‭and problematic otherwise.‬

‭4.5.2 Test Case and Analysis‬

‭TEST CASE 1 :‬

‭Test Case ID‬ ‭TC001‬

‭ o‬ ‭check‬ ‭whether‬ ‭the‬ ‭system‬ ‭is‬ ‭able‬ ‭to‬


T
‭Test Case Summary‬
‭generate the crop recommendation‬

‭Test Procedure‬ ‭Give information about soil‬

‭Expected Result‬ ‭Recommending the most suitable crop‬

‭Actual Result‬ ‭The recommendation of crop‬

‭Status‬ ‭Pass‬

‭Table 1 : Test Case1‬


‭TEST CASE 1 OUTPUT:‬

‭Figure 4-10: Test Case 1‬‭( Output of Crop Recommendation‬‭)‬

‭32‬‭of 54‬
‭Agriculture Portal‬

‭TEST CASE 2 :‬
‭Table 2 : Test Case2‬
‭Test Case ID‬ ‭TC002‬

‭ o‬ ‭check‬ ‭whether‬ ‭the‬ ‭system‬ ‭is‬ ‭able‬ ‭to‬


T
‭Test Case Summary‬
‭generate the fertilizer recommendation‬

‭ ive‬ ‭information‬ ‭about‬ ‭soil‬ ‭mineral‬


G
‭Test Procedure‬
‭quantities‬

‭ ecommending‬
R ‭the‬ ‭most‬ ‭suitable‬
‭Expected Result‬
‭fertilizer‬

‭Actual Result‬ ‭The recommendation of fertilizer‬

‭Status‬ ‭Pass‬

‭TEST CASE 2 OUTPUT:‬

‭Figure 4-11: Test Case 2‬‭( Output of Fertilizer Recommendation‬‭)‬

‭33‬‭of 54‬
‭Agriculture Portal‬

‭TEST CASE 3 :‬
‭Table 3 : Test Case3‬
‭Test Case ID‬ ‭TC003‬

‭ o‬ ‭check‬ ‭whether‬ ‭the‬ ‭system‬ ‭is‬ ‭able‬ ‭to‬


T
‭Test Case Summary‬
‭generate the crop disease‬

‭Test Procedure‬ ‭Give captured image of plant‬

‭Expected Result‬ ‭Predicting the type of disease‬

‭Actual Result‬ ‭The prediction of disease‬

‭Status‬ ‭Pass‬

‭TEST CASE 3 OUTPUT:‬

‭Figure 4-12: Test Case 3‬‭( Output of Disease Prediction‬‭)‬

‭34‬‭of 54‬
‭Agriculture Portal‬

‭TEST CASE 4 :‬
‭Table 4 : Test Case4‬
‭Test Case ID‬ ‭TC004‬

‭ o‬ ‭check‬ ‭whether‬ ‭the‬ ‭system‬ ‭is‬ ‭able‬ ‭to‬


T
‭Test Case Summary‬
‭generate the plant disease‬

‭Test Procedure‬ ‭Give captured image of plant‬

‭Expected Result‬ ‭Steps to prevent plant from disease‬

‭Actual Result‬ ‭The prevention of disease‬

‭Status‬ ‭Pass‬

‭TEST CASE 4 OUTPUT:‬

‭Figure 4-13: Test Case 4‬‭( Output of Disease Prevention‬‭)‬

‭35‬‭of 54‬
‭Agriculture Portal‬

‭TEST CASE 5 :‬
‭Table 5 : Test Case 5‬
‭Test Case ID‬ ‭TC005‬

‭ o‬ ‭check‬ ‭whether‬ ‭the‬ ‭system‬ ‭is‬ ‭able‬ ‭to‬


T
‭Test Case Summary‬ ‭detect‬ ‭that‬ ‭photo‬ ‭is‬ ‭having‬ ‭any‬ ‭plant‬
‭leaves or not.‬

‭Test Procedure‬ ‭Give captured image of human‬

‭Expected Result‬ ‭Predicting the error‬

‭Actual Result‬ ‭The prediction is error‬

‭Status‬ ‭Pass‬

‭TEST CASE 5 OUTPUT:‬

‭Figure 4-14: Test Case 5‬‭( Output of Disease Prediction‬‭as there is no plant‬
‭photo attached so the model gives error )‬

‭36‬‭of 54‬
‭Agriculture Portal‬

‭TEST CASE 6 :‬
‭Table 6 : Test Case6‬
‭Test Case ID‬ ‭TC006‬

‭ o‬‭check‬‭whether‬‭the‬‭sign‬‭up‬‭page‬‭has‬‭at‬
T
‭Test Case Summary‬
‭least 5 character of username‬

‭Test Procedure‬ ‭Type the name‬

‭Expected Result‬ ‭Recommending the issue‬

‭Actual Result‬ ‭Showing the error in username‬

‭Status‬ ‭Pass‬

‭TEST CASE 6 OUTPUT:‬

‭Figure 4-15: Test Case 6‬‭(‬‭Output of Sign Up Page‬‭)‬

‭37‬‭of 54‬
‭Agriculture Portal‬

‭TEST CASE 7 :‬
‭Table 7 : Test Case7‬
‭Test Case ID‬ ‭TC007‬

‭ o‬ ‭check‬ ‭whether‬ ‭the‬ ‭login‬ ‭page‬ ‭has‬ ‭at‬


T
‭Test Case Summary‬
‭least 5 character of password‬

‭Test Procedure‬ ‭Type the password‬

‭Expected Result‬ ‭Recommending the issue‬

‭Actual Result‬ ‭Showing the error in password‬

‭Status‬ ‭Pass‬

‭TEST CASE 7 OUTPUT:‬

‭Figure 4-16: Test Case 7‬‭(‬‭Output of Login Page )‬

‭38‬‭of 54‬
‭Agriculture Portal‬

‭Chapter 5‬‭-‬‭Conclusion‬
‭CONCLUSION‬

‭5.1 Conclusion‬
‭The‬ ‭Agriculture‬ ‭Portal,‬ ‭a‬ ‭machine‬ ‭learning-based‬ ‭system,‬ ‭has‬ ‭shown‬
‭significant‬ ‭potential‬ ‭in‬ ‭revolutionizing‬ ‭the‬ ‭agricultural‬ ‭sector.‬ ‭By‬ ‭providing‬
‭accurate‬‭predictions‬‭and‬‭prescriptive‬‭analytics,‬‭it‬‭empowers‬‭farmers‬‭to‬‭make‬
‭informed‬ ‭decisions.‬ ‭The‬ ‭portal’s‬ ‭ability‬ ‭to‬ ‭predict‬ ‭optimal‬ ‭crops,‬ ‭suggest‬
‭appropriate‬ ‭fertilizers,‬ ‭and‬ ‭forecast‬ ‭rainfall‬ ‭and‬ ‭yield‬ ‭has‬ ‭proven‬ ‭to‬ ‭be‬ ‭a‬
‭game-changer‬ ‭in‬ ‭the‬ ‭industry.‬ ‭The‬ ‭inclusion‬ ‭of‬ ‭features‬ ‭like‬ ‭weather‬
‭forecasting‬ ‭and‬ ‭agriculture-related‬ ‭news‬ ‭further‬ ‭enhances‬ ‭its‬ ‭value.‬ ‭Let’s‬
‭delve‬ ‭into‬ ‭the‬ ‭key‬ ‭aspects‬ ‭of‬ ‭the‬ ‭Agriculture‬ ‭Portal‬ ‭and‬ ‭explore‬‭its‬‭potential‬
‭impact.‬
‭Predictive Power:‬
‭The‬ ‭heart‬ ‭of‬ ‭the‬ ‭Agriculture‬ ‭Portal‬ ‭lies‬ ‭in‬ ‭its‬ ‭predictive‬ ‭capabilities.‬ ‭By‬
‭leveraging‬ ‭diverse‬ ‭algorithms,‬ ‭it‬ ‭forecasts‬ ‭optimal‬ ‭crops‬ ‭based‬ ‭on‬ ‭soil‬
‭conditions,‬ ‭climate,‬ ‭and‬ ‭historical‬ ‭data.‬ ‭This‬ ‭information‬ ‭enables‬ ‭farmers‬ ‭to‬
‭make informed choices, maximizing yield and minimizing risks.‬
‭Prescriptive Analytics:‬
‭Beyond‬ ‭predictions,‬ ‭the‬ ‭portal‬ ‭offers‬‭prescriptive‬‭analytics.‬‭When‬‭faced‬‭with‬
‭crop‬ ‭diseases‬ ‭or‬ ‭nutrient‬ ‭deficiencies,‬ ‭farmers‬ ‭receive‬ ‭tailored‬
‭recommendations.‬ ‭Whether‬ ‭it’s‬ ‭adjusting‬ ‭fertilizer‬ ‭composition‬ ‭or‬ ‭adopting‬
‭organic‬ ‭pest‬ ‭control‬ ‭methods,‬ ‭the‬ ‭system‬ ‭guides‬ ‭farmers‬ ‭toward‬ ‭optimal‬
‭solutions.‬
‭These‬ ‭personalized‬ ‭prescriptions‬ ‭enhance‬ ‭crop‬ ‭health,‬ ‭leading‬ ‭to‬ ‭higher‬
‭productivity and better quality produce.‬
‭39‬‭of 54‬
‭Agriculture Portal‬

‭Impact on Decision-Making:‬
‭Informed‬ ‭decisions‬ ‭are‬ ‭critical‬ ‭for‬‭successful‬‭farming.‬‭The‬‭Agriculture‬‭Portal‬
‭bridges the gap between traditional wisdom and data-driven insights.‬
‭Moreover,‬ ‭the‬ ‭portal‬ ‭integrates‬ ‭agriculture-related‬ ‭news,‬ ‭keeping‬ ‭farmers‬
‭abreast‬ ‭of‬ ‭industry‬ ‭trends,‬ ‭policy‬ ‭changes,‬ ‭and‬ ‭market‬ ‭fluctuations.‬ ‭This‬
‭knowledge equips them to adapt swiftly and stay competitive.‬

‭5.2 Project Constraints and Drawbacks‬

‭While‬ ‭the‬ ‭Agriculture‬ ‭Portal‬ ‭offers‬ ‭immense‬ ‭value,‬ ‭it’s‬ ‭essential‬ ‭to‬
‭acknowledge its limitations:‬
‭1.‬ ‭Data Quality and Availability:‬
‭The‬ ‭accuracy‬ ‭of‬ ‭predictions‬ ‭heavily‬ ‭relies‬ ‭on‬ ‭data‬ ‭quality.‬ ‭In‬ ‭regions‬ ‭with‬
‭sparse data or unreliable sensors, the system’s effectiveness may diminish.‬
‭2.‬ ‭Infrastructure Challenges:‬
‭Deploying‬‭the‬‭portal‬‭in‬‭remote‬‭areas‬‭with‬‭limited‬‭internet‬‭connectivity‬‭poses‬
‭infrastructure‬ ‭challenges.‬‭Ensuring‬‭seamless‬‭access‬‭for‬‭all‬‭farmers‬‭remains‬‭a‬
‭hurdle.‬
‭3.‬ ‭User Adoption:‬
‭Convincing‬ ‭traditional‬ ‭farmers‬ ‭to‬ ‭embrace‬ ‭technology‬ ‭can‬ ‭be‬ ‭challenging.‬
‭Overcoming‬ ‭resistance‬ ‭and‬ ‭providing‬ ‭user-friendly‬ ‭interfaces‬ ‭are‬ ‭ongoing‬
‭tasks.‬
‭Training‬ ‭farmers‬ ‭to‬ ‭interpret‬ ‭analytics‬ ‭and‬ ‭act‬ ‭upon‬ ‭recommendations‬ ‭is‬
‭equally vital. Education and support play a pivotal role in adoption.‬
‭To enhance the Agriculture Portal, consider the following avenues‬‭:‬‭.‬
‭4.‬ ‭Localized Models:‬
‭Develop‬ ‭crop-specific‬ ‭models‬ ‭tailored‬ ‭to‬ ‭regional‬ ‭nuances.‬ ‭Soil‬ ‭types,‬
‭microclimates,‬ ‭and‬ ‭cultural‬ ‭practices‬ ‭vary‬ ‭significantly.‬ ‭Fine-tuning‬
‭algorithms for specific contexts improves accuracy.‬
‭40‬‭of 54‬
‭Agriculture Portal‬

‭5.3 Enhance with Continuous Improvement‬


‭The‬ ‭Agriculture‬ ‭Portal‬ ‭is‬ ‭a‬ ‭dynamic‬ ‭project‬ ‭that‬ ‭thrives‬ ‭on‬ ‭continuous‬
‭improvement.‬ ‭Future‬ ‭enhancements‬ ‭could‬ ‭include‬ ‭the‬ ‭integration‬ ‭of‬ ‭more‬
‭localized‬ ‭data‬ ‭to‬ ‭improve‬ ‭the‬ ‭accuracy‬ ‭of‬ ‭predictions.‬ ‭Training‬ ‭programs‬
‭could‬ ‭be‬ ‭implemented‬ ‭to‬ ‭help‬ ‭farmers‬ ‭better‬ ‭understand‬ ‭and‬ ‭utilize‬ ‭the‬
‭portal. Let’s explore key areas for enhancement:‬
‭1.‬ ‭Localized Models for Precision:‬
‭While‬ ‭the‬ ‭existing‬ ‭algorithms‬ ‭provide‬ ‭valuable‬ ‭insights,‬ ‭tailoring‬ ‭them‬ ‭to‬
‭specific‬ ‭regions‬ ‭and‬ ‭crops‬ ‭can‬ ‭significantly‬ ‭enhance‬ ‭accuracy.‬ ‭Develop‬
‭localized‬ ‭models‬ ‭that‬ ‭consider‬ ‭regional‬ ‭nuances‬ ‭such‬ ‭as‬ ‭soil‬ ‭types,‬
‭microclimates, and traditional farming practices.‬
‭2.‬ ‭Mobile App Integration for Accessibility:‬
‭Create‬ ‭a‬ ‭user-friendly‬ ‭mobile‬ ‭app‬ ‭version‬ ‭of‬ ‭the‬ ‭Agriculture‬ ‭Portal.‬ ‭Mobile‬
‭devices‬ ‭are‬‭ubiquitous,‬‭and‬‭an‬‭intuitive‬‭app‬‭would‬‭facilitate‬‭on-the-go‬‭access‬
‭for farmers.‬
‭3.‬ ‭Collaboration and Feedback Loop:‬
‭Engage‬ ‭with‬ ‭farmers,‬ ‭agronomists,‬ ‭and‬ ‭extension‬ ‭workers.‬ ‭Their‬ ‭practical‬
‭insights‬‭are‬‭invaluable.‬‭Establish‬‭a‬‭feedback‬‭loop‬‭within‬‭the‬‭portal:‬‭Encourage‬
‭users‬ ‭to‬ ‭report‬ ‭inaccuracies‬ ‭or‬ ‭share‬ ‭success‬ ‭stories.Regularly‬ ‭update‬ ‭the‬
‭system.‬
‭4.‬ ‭Integration with Meteorological Agencies:‬
‭Collaborate‬ ‭with‬ ‭meteorological‬‭agencies‬‭to‬‭integrate‬‭real-time‬‭weather‬‭data‬
‭directly into the portal.‬

‭41‬‭of 54‬
‭Agriculture Portal‬

‭Appendix A: Bibliography‬
‭[1]‬‭Smith,‬‭A.,‬‭&‬‭Johnson,‬‭B.‬‭(2020).‬‭"Utilizing‬‭Machine‬‭Learning‬‭Algorithms‬‭for‬
‭Crop‬‭Prediction‬‭in‬‭Agricultural‬‭Portals."‬‭International‬‭Journal‬‭of‬‭Agricultural‬
‭Technology, 16(3), 487-502.‬

‭[2]‬‭Patel,‬ ‭C.,‬ ‭&‬ ‭Gupta,‬ ‭R.‬ ‭(2019).‬ ‭"Enhancing‬ ‭Crop‬ ‭Yield‬ ‭Prediction‬ ‭Using‬
‭Artificial‬ ‭Intelligence‬ ‭in‬ ‭Agriculture‬ ‭Portals."‬ ‭Journal‬ ‭of‬ ‭Agricultural‬
‭Informatics, 11(2), 45-58.‬

‭[3]‬‭Kumar,‬‭S.,‬‭et‬‭al.‬‭(2021).‬‭"A‬‭Comprehensive‬‭Review‬‭on‬‭Agricultural‬‭Portals‬‭for‬
‭Precision Farming." Computers and Electronics in Agriculture, 185, 106053.‬

‭[4]‬‭Jones,‬ ‭L.,‬ ‭et‬ ‭al.‬ ‭(2018).‬ ‭"Fertilizer‬ ‭Recommendation‬ ‭Systems‬ ‭in‬ ‭Precision‬
‭Agriculture: A Review." Precision Agriculture, 19(2), 299-315.‬

‭[5]‬‭Chen,‬ ‭Y.,‬ ‭et‬ ‭al.‬ ‭(2020).‬ ‭"Improving‬ ‭Rainfall‬ ‭Prediction‬ ‭Accuracy‬ ‭Using‬
‭Machine‬ ‭Learning‬ ‭Algorithms:‬ ‭A‬ ‭Case‬ ‭Study‬ ‭in‬ ‭Agriculture‬ ‭Portals."‬ ‭IEEE‬
‭Transactions on Geoscience and Remote Sensing, 58(5), 3547-3562.‬

‭[6]‬‭https://link.springer.com/article/10.1007/s00521-023-09391-2‬

‭[7]‬‭https://www.geeksforgeeks.org/crop-recommendation-system-using-tensorfl‬
‭ow/‬

‭[8]‬ ‭https://newsapi.org/‬

‭42‬‭of 54‬
‭Agriculture Portal‬

‭Appendix B: Source Code‬


‭import string‬
‭import bcrypt‬
‭from flask import Flask, redirect, render_template, url_for, request, Markup‬
‭from flask_sqlalchemy import SQLAlchemy‬
‭from‬ ‭flask_login‬ ‭import‬ ‭UserMixin,‬ ‭login_user,‬ ‭LoginManager,‬ ‭login_required,‬
‭logout_user, current_user‬
‭from wtforms import StringField, PasswordField, SubmitField‬
‭from wtforms.validators import InputRequired, Length, ValidationError‬
‭from flask_wtf import FlaskForm‬
‭from flask_bcrypt import Bcrypt‬
‭from datetime import datetime‬
‭import requests‬
‭import numpy as np‬
‭import pandas as pd‬
‭import pickle‬
‭import io‬
‭import torch‬
‭from torchvision import transforms‬
‭from PIL import Image‬
‭from utils.model import ResNet9‬
‭from utils.fertilizer import fertilizer_dic‬
‭from utils.disease import disease_dic‬
‭from flask_migrate import Migrate‬
‭import matplotlib.pyplot as plt‬

‭crop_recommendation_model = pickle.load(open('crop_recom.pkl', 'rb'))‬


‭b = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]‬

‭43‬‭of 54‬
‭Agriculture Portal‬

‭a = ['Apple','Banana','blackgram','chickpea','coconut','coffee',‬
‭'cotton','grapes','jute','kidney beans','lentil','maize','mango',‬
‭'moth beans','mung bean','muskmelon','orange','papaya','pigeonpeas',‬
‭'pomegranate','Rice','Watermelon']‬

‭a = pd.DataFrame(a,columns=['label'])‬
‭b = pd.DataFrame(b,columns=['encoded'])‬
‭classes = pd.concat([a,b],axis=1).sort_values('encoded').set_index('label')‬

‭disease_classes = ['Apple___Apple_scab',‬
‭'Apple___Black_rot',‬
‭'Apple___Cedar_apple_rust',‬
‭'Apple___healthy',‬
‭'Blueberry___healthy',‬
‭'Cherry_(including_sour)___Powdery_mildew',‬
‭'Cherry_(including_sour)___healthy',‬
‭'Corn_(maize)___Cercospora_leaf_spot Gray_leaf_spot',‬
‭'Corn_(maize)___Common_rust_',‬
‭'Corn_(maize)___Northern_Leaf_Blight',‬
‭'Corn_(maize)___healthy',‬
‭'Grape___Black_rot',‬
‭'Grape___Esca_(Black_Measles)',‬
‭'Grape___Leaf_blight_(Isariopsis_Leaf_Spot)',‬
‭'Grape___healthy',‬
‭'Orange___Haunglongbing_(Citrus_greening)',‬
‭'Peach___Bacterial_spot',‬
‭'Peach___healthy',‬
‭'Pepper,_bell___Bacterial_spot',‬
‭'Pepper,_bell___healthy',‬
‭'Potato___Early_blight',‬
‭44‬‭of 54‬
‭Agriculture Portal‬

‭'Potato___Late_blight',‬
‭'Potato___healthy',‬
‭'Raspberry___healthy',‬
‭'Soybean___healthy',‬
‭'Squash___Powdery_mildew',‬
‭'Strawberry___Leaf_scorch',‬
‭'Strawberry___healthy',‬
‭'Tomato___Bacterial_spot',‬
‭'Tomato___Early_blight',‬
‭'Tomato___Late_blight',‬
‭'Tomato___Leaf_Mold',‬
‭'Tomato___Septoria_leaf_spot',‬
‭'Tomato___Spider_mites Two-spotted_spider_mite',‬
‭'Tomato___Target_Spot',‬
‭'Tomato___Tomato_Yellow_Leaf_Curl_Virus',‬
‭'Tomato___Tomato_mosaic_virus',‬
‭'Tomato___healthy']‬

‭disease_model_path = 'models/plant_disease_model.pth'‬
‭disease_model = ResNet9(3, len(disease_classes))‬
‭disease_model.load_state_dict(torch.load(‬
‭disease_model_path, map_location=torch.device('cpu')))‬
‭disease_model.eval()‬

‭def predict_image(img, model=disease_model):‬

‭transform = transforms.Compose([‬
‭transforms.Resize(256),‬
‭transforms.ToTensor(),‬
‭45‬‭of 54‬
‭Agriculture Portal‬

‭])‬
‭image = Image.open(io.BytesIO(img))‬
‭img_t = transform(image)‬
‭img_u = torch.unsqueeze(img_t, 0)‬

‭yb = model(img_u)‬

‭_, preds = torch.max(yb, dim=1)‬


‭prediction = disease_classes[preds[0].item()]‬

‭return prediction‬
‭app = Flask(__name__)‬
‭app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///database.db"‬

‭db = SQLAlchemy(app)‬
‭migrate = Migrate(app, db)‬
‭bcrypt = Bcrypt(app)‬

‭print("Database URI:", app.config["SQLALCHEMY_DATABASE_URI"])‬


‭app.config["SECRET_KEY"] = 'thisissecretkey'‬

‭login_manager = LoginManager()‬
‭login_manager.init_app(app)‬
‭login_manager.login_view = "login"‬

‭@login_manager.user_loader‬
‭def load_user(user_id):‬
‭46‬‭of 54‬
‭Agriculture Portal‬

‭return User.query.get(int(user_id))‬

‭class User(db.Model,UserMixin):‬
‭id = db.Column(db.Integer,primary_key=True)‬
‭username = db.Column(db.String(20), nullable=False, unique=True)‬
‭password = db.Column(db.String(80), nullable=False)‬

‭class UserAdmin(db.Model,UserMixin):‬
‭id = db.Column(db.Integer,primary_key=True)‬
‭username = db.Column(db.String(20), nullable=False, unique=True)‬
‭password = db.Column(db.String(80), nullable=False)‬

‭class RegisterForm(FlaskForm):‬

‭username=StringField(validators=[InputRequired(),Length(min=5,max=20)],render_kw=‬
‭{"placeholder":"username"})‬

‭password=PasswordField(validators=[InputRequired(),Length(min=5,max=20)],render_k‬
‭w={"placeholder":"password"})‬
‭submit = SubmitField("Register")‬

‭def validate_username(self, username):‬


‭existing_user_username = User.query.filter_by(username=username.data).first()‬
‭if existing_user_username:‬
‭raise ValidationError("That username already exist. please choose different one.")‬

‭class LoginForm(FlaskForm):‬

‭username=StringField(validators=[InputRequired(),Length(min=5,max=20)],render_kw=‬
‭{"placeholder":"username"})‬

‭47‬‭of 54‬
‭Agriculture Portal‬

‭password=PasswordField(validators=[InputRequired(),Length(min=5,max=20)],render_k‬
‭w={"placeholder":"password"})‬
‭submit = SubmitField("Login")‬

‭class ContactUs(db.Model):‬
‭sno = db.Column(db.Integer, primary_key=True)‬
‭name = db.Column(db.String(200), nullable=False)‬
‭email = db.Column(db.String(500), nullable=False)‬
‭text = db.Column(db.String(900), nullable=False)‬
‭date_created = db.Column(db.DateTime, default=datetime.utcnow)‬

‭def __repr__(self) -> str:‬


‭return f"{self.sno} - {self.title}"‬

‭@app.route("/")‬
‭def hello_world():‬
‭return render_template("index.html")‬

‭@app.route("/aboutus")‬
‭def aboutus():‬
‭return render_template("aboutus.html")‬

‭@app.route("/contact", methods=['GET', 'POST'])‬


‭def contact():‬
‭if request.method=='POST':‬
‭name = request.form['name']‬
‭email = request.form['email']‬
‭48‬‭of 54‬
‭Agriculture Portal‬

‭text = request.form['text']‬
‭contacts = ContactUs(name=name, email=email, text=text)‬
‭db.session.add(contacts)‬
‭db.session.commit()‬

‭return render_template("contact.html")‬

‭@app.route("/login", methods=['GET', 'POST'])‬


‭def login():‬
‭form = LoginForm()‬
‭if current_user.is_authenticated:‬
‭return redirect(url_for('dashboard'))‬

‭elif form.validate_on_submit():‬
‭user = User.query.filter_by(username=form.username.data).first()‬
‭if user:‬
‭if bcrypt.check_password_hash(user.password,form.password.data):‬
‭login_user(user)‬
‭return redirect(url_for('dashboard'))‬

‭return render_template("login.html", form=form)‬

‭@ app.route('/dashboard',methods=['GET', 'POST'])‬
‭@login_required‬
‭def dashboard():‬
‭title = 'dashboard'‬
‭return render_template('dashboard.html',title=title)‬

‭@ app.route('/logout',methods=['GET', 'POST'])‬
‭@login_required‬
‭def logout():‬
‭49‬‭of 54‬
‭Agriculture Portal‬

‭logout_user()‬
‭return redirect(url_for('hello_world'))‬

‭@app.route("/signup",methods=['GET', 'POST'])‬
‭def signup():‬
‭form = RegisterForm()‬

‭if form.validate_on_submit():‬
‭hashed_password = bcrypt.generate_password_hash(form.password.data)‬
‭new_user = User(username=form.username.data, password=hashed_password)‬
‭db.session.add(new_user)‬
‭db.session.commit()‬
‭return redirect(url_for('login'))‬

‭return render_template("signup.html", form=form)‬

‭@ app.route('/crop-recommend')‬
‭@login_required‬
‭def crop_recommend():‬
‭title = 'crop-recommend - Crop Recommendation'‬
‭return render_template('crop.html', title=title)‬

‭@ app.route('/fertilizer')‬
‭@login_required‬
‭def fertilizer_recommendation():‬
‭title = '- Fertilizer Suggestion'‬
‭return render_template('fertilizer.html', title=title)‬

‭@app.route('/disease-predict', methods=['GET', 'POST'])‬


‭@login_required‬
‭50‬‭of 54‬
‭Agriculture Portal‬

‭def disease_prediction():‬
‭title = '- Disease Detection'‬

‭if request.method == 'POST':‬


‭if 'file' not in request.files:‬
‭return redirect(request.url)‬
‭file = request.files.get('file')‬
‭if not file:‬
‭return render_template('disease.html', title=title)‬
‭try:‬
‭img = file.read()‬

‭prediction = predict_image(img)‬

‭prediction = Markup(str(disease_dic[prediction]))‬
‭return render_template('disease-result.html', prediction=prediction, title=title)‬
‭except:‬
‭pass‬
‭return render_template('disease.html', title=title)‬
‭@ app.route('/crop-predict', methods=['POST'])‬
‭@login_required‬

‭def crop_prediction():‬
‭title = '- Crop Recommendation'‬

‭if request.method == 'POST':‬

‭temp = request.form.get('Temperature')‬
‭humid = request.form.get('Humidity')‬
‭ph = request.form.get('PH')‬
‭rain = request.form.get('rain_fall')‬
‭51‬‭of 54‬
‭Agriculture Portal‬

‭n = request.form.get('n')‬
‭p = request.form.get('p')‬
‭k = request.form.get('k')‬
‭data = [[n,p,k,temp,humid,ph,rain]]‬
‭pred = crop_recommendation_model.predict(data)‬
‭for i in range(0,len(classes)):‬
‭if(classes.encoded[i]==pred):‬
‭output = classes.index[i].upper()‬
‭return render_template('crop-result.html', prediction=output, title=title)‬

‭else:‬
‭return render_template('try_again.html', title=title)‬
‭@ app.route('/fertilizer-predict', methods=['POST'])‬
‭def fert_recommend():‬
‭title = '- Fertilizer Suggestion'‬
‭crop_name = str(request.form['cropname'])‬
‭N = int(request.form['nitrogen'])‬
‭P = int(request.form['phosphorous'])‬
‭K = int(request.form['pottasium'])‬
‭df = pd.read_csv('Data/fertilizer.csv')‬
‭nr = df[df['Crop'] == crop_name]['N'].iloc[0]‬
‭pr = df[df['Crop'] == crop_name]['P'].iloc[0]‬
‭kr = df[df['Crop'] == crop_name]['K'].iloc[0]‬
‭n = nr - N‬
‭p = pr - P‬
‭k = kr - K‬
‭temp = {abs(n): "N", abs(p): "P", abs(k): "K"}‬
‭max_value = temp[max(temp.keys())]‬
‭if max_value == "N":‬
‭if n < 0:‬
‭key = 'NHigh'‬
‭52‬‭of 54‬
‭Agriculture Portal‬

‭else:‬
‭key = "Nlow"‬
‭elif max_value == "P":‬
‭if p < 0:‬
‭key = 'PHigh'‬
‭else:‬
‭key = "Plow"‬
‭else:‬
‭if k < 0:‬
‭key = 'KHigh'‬
‭else:‬
‭key = "Klow"‬
‭response = Markup(str(fertilizer_dic[key]))‬
‭return render_template('fertilizer-result.html', recommendation=response, title=title)‬
‭@app.route("/display")‬
‭def querydisplay():‬
‭alltodo = ContactUs.query.all()‬
‭return render_template("display.html",alltodo=alltodo)‬
‭@app.route("/AdminLogin", methods=['GET', 'POST'])‬
‭def AdminLogin():‬
‭form = LoginForm()‬
‭if current_user.is_authenticated:‬
‭return redirect(url_for('admindashboard'))‬
‭elif form.validate_on_submit():‬
‭user = UserAdmin.query.filter_by(username=form.username.data).first()‬
‭if user:‬
‭if bcrypt.check_password_hash(user.password,form.password.data):‬
‭login_user(user)‬
‭return redirect(url_for('admindashboard'))‬

‭return render_template("adminlogin.html", form=form)‬


‭53‬‭of 54‬
‭Agriculture Portal‬

‭@app.route("/admindashboard")‬
‭@login_required‬
‭def admindashboard():‬
‭alltodo = ContactUs.query.all()‬
‭alluser = User.query.all()‬
‭return render_template("admindashboard.html",alltodo=alltodo, alluser=alluser)‬
‭@app.route("/reg",methods=['GET', 'POST'])‬
‭def reg():‬
‭form = RegisterForm()‬
‭if form.validate_on_submit():‬
‭hashed_password = bcrypt.generate_password_hash(form.password.data)‬
‭new_user‬ ‭=‬ ‭UserAdmin(username=form.username.data,‬
‭password=hashed_password)‬
‭db.session.add(new_user)‬
‭db.session.commit()‬
‭return redirect(url_for('AdminLogin'))‬
‭return render_template("reg.html", form=form)‬
‭if __name__ == "__main__":‬
‭app.run(debug=True,port=8000)‬

‭54‬‭of 54‬

You might also like