├── AIBackend ├── 5s.pt ├── Detection.py ├── Procfile └── requirements.txt ├── AnnadataZulipBot ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-38.pyc │ ├── air.cpython-38.pyc │ ├── annadata.cpython-38.pyc │ ├── converter.cpython-38.pyc │ ├── fire.cpython-38.pyc │ ├── location.cpython-38.pyc │ ├── pincode.cpython-38.pyc │ ├── pollen.cpython-38.pyc │ ├── soil.cpython-38.pyc │ ├── utils.cpython-38.pyc │ ├── waterVapour.cpython-38.pyc │ └── weather.cpython-38.pyc ├── air.py ├── annadata.py ├── doc.md ├── fire.py ├── location.py ├── pincode.py ├── pollen.py ├── soil.py ├── test_converter.py ├── utils.py ├── waterVapour.py ├── weather.py └── zuliprc ├── CropRecommender ├── .gitignore ├── Procfile ├── Readme.md ├── recom.py ├── recommender.pkl └── requirements.txt ├── NodeBackend ├── .env ├── .eslintignore ├── .eslintrc.yml ├── .github │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.md │ │ └── feature_request.md │ └── pull_request_template.md ├── .gitignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── middleware │ └── auth.js ├── models │ ├── Info.js │ ├── Item.js │ ├── Question.js │ ├── UploadFile.js │ └── User.js ├── package-lock.json ├── package.json ├── routes │ └── api │ │ ├── ambeedata.js │ │ ├── ambeedataEndpoints.js │ │ ├── auth.js │ │ ├── infos.js │ │ ├── items.js │ │ ├── otp.js │ │ ├── questions.js │ │ ├── upload.js │ │ ├── users.js │ │ └── weatherForecast.js ├── server.js └── utils │ └── utility.js ├── README.md ├── ReactWebsite ├── .eslintignore ├── .eslintrc.yml ├── .github │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.md │ │ └── feature_request.md │ └── pull_request_template.md ├── .gitignore ├── .npmignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── img │ │ ├── bee-2.jpeg │ │ ├── bee-3.jpeg │ │ ├── bee.jpeg │ │ ├── css │ │ │ ├── all.min.css │ │ │ └── fontawesome.min.css │ │ ├── horticulture-2.jpeg │ │ ├── horticulture-3.gif │ │ ├── horticulture.jpeg │ │ ├── husbandry-2.jpeg │ │ ├── husbandry-3.webp │ │ ├── husbandry.png │ │ ├── product-10.png │ │ ├── product-11.jpeg │ │ ├── product-12.jpeg │ │ ├── product-13.png │ │ ├── product-14.jpeg │ │ ├── product-15.jpeg │ │ ├── product-16.jpeg │ │ ├── product-9.jpeg │ │ └── webfonts │ │ │ ├── fa-brands-400.eot │ │ │ ├── fa-brands-400.svg │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.eot │ │ │ ├── fa-regular-400.svg │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.eot │ │ │ ├── fa-solid-900.svg │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff │ │ │ └── fa-solid-900.woff2 │ ├── index.html │ ├── manifest.json │ └── robots.txt └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── actions │ ├── authActions.js │ ├── errorActions.js │ ├── infoActions.js │ ├── itemActions.js │ ├── questionActions.js │ ├── soilActions.js │ └── types.js │ ├── components │ ├── About.js │ ├── AppNavbar.js │ ├── Button.js │ ├── Buy.js │ ├── Carousel.js │ ├── Cart │ │ ├── Cart.js │ │ ├── CartColumns.js │ │ ├── CartItem.js │ │ ├── CartList.js │ │ ├── CartTotals.js │ │ ├── EmptyCart.js │ │ └── package.json │ ├── Community.js │ ├── Context.js │ ├── Crop.js │ ├── CropSuggest.js │ ├── Default.js │ ├── Details.js │ ├── FarmersAskFarmers.js │ ├── Features.js │ ├── Footer.js │ ├── Infos.js │ ├── ItemModal.js │ ├── Location.js │ ├── Modal.js │ ├── ModernFarming.js │ ├── Navbar.js │ ├── Product.js │ ├── ProductList.js │ ├── QuestionModal.js │ ├── Schemes.js │ ├── Scroll.js │ ├── ShoppingList.js │ ├── SideIncome.css │ ├── SideIncome.js │ ├── Soil.js │ ├── Testimonial.js │ ├── Title.js │ └── auth │ │ ├── LoginModal.js │ │ ├── Logout.js │ │ └── RegisterModal.js │ ├── data.js │ ├── images │ ├── arc.jpg │ ├── complete.PNG │ ├── fasal.png │ ├── icon1.png │ ├── icon2.png │ ├── icon3.png │ ├── icon4.png │ ├── icon5.png │ ├── noInternet.png │ ├── plantDisease.PNG │ └── plantDiseaseDetected.PNG │ ├── index.js │ ├── logo.svg │ ├── reducers │ ├── authReducer.js │ ├── errorReducer.js │ ├── index.js │ ├── infoReducer.js │ ├── itemReducer.js │ ├── questionReducer.js │ └── soilReducer.js │ ├── reportWebVitals.js │ ├── service-worker.js │ ├── serviceWorkerRegistration.js │ ├── setupTests.js │ └── store.js └── package.json /AIBackend/5s.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AIBackend/5s.pt -------------------------------------------------------------------------------- /AIBackend/Detection.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from PIL import Image 3 | import requests 4 | import torch 5 | import time 6 | import io 7 | from collections import Counter 8 | from flask import Flask, request, jsonify, render_template 9 | device=torch.device('cuda' if torch.cuda.is_available() else 'cpu') 10 | from flask_cors import CORS, cross_origin 11 | 12 | app = Flask(__name__) 13 | model = torch.hub.load('ultralytics/yolov5', 'yolov5s', classes=30, autoshape = False) 14 | model.load_state_dict(torch.load('5s.pt', map_location = 'cpu')['model'].state_dict()) 15 | model = model.autoshape() 16 | # model = torch.hub.load('ultralytics/yolov5', 'custom', path_or_model = 'best.pt', map_location = 'cpu') 17 | model = model.to(device).eval() 18 | classes = ['Apple Scab Leaf', 'Apple leaf', 'Apple rust leaf', 'Bell_pepper spot leaf', 'Bell_pepper leaf', 19 | 'Blueberry leaf', 'Cherry leaf', 'Corn Gray spot leaf', 'Corn blight leaf', 'Corn rust leaf', 20 | 'Peach leaf', 'Potato leaf early blight', 'Potato leaf late blight', 'Potato leaf', 'Raspberry leaf', 21 | 'Soyabean leaf', 'Soybean leaf', 'Squash Powdery mildew leaf', 'Strawberry leaf', 'Tomato Early blight leaf', 22 | 'Tomato Septoria spot leaf', 'Tomato bacterial spot leaf', 'Tomato late blight leaf', 'Tomato mosaic virus leaf', 23 | 'Tomato yellow virus leaf', 'Tomato leaf', 'Tomato mold leaf', 'Tomato two spotted spider mites leaf', 24 | 'grape black rot leaf', 'grape leaf'] 25 | 26 | @app.route('/predict', methods=['POST']) 27 | @cross_origin(supports_credentials=True) 28 | def predict(): 29 | if request.method == 'POST': 30 | file = request.files['file'] 31 | img_bytes = file.read() 32 | start=time.time() 33 | im = Image.open(io.BytesIO(img_bytes)) 34 | print("request time ",time.time()-start) 35 | h, w = im.size 36 | 37 | im = im.resize((416,416)) 38 | start=time.time() 39 | result=model(np.array(im)) 40 | print("inference time ",time.time()-start) 41 | result=result.xyxy[0].cpu().numpy() 42 | result=result.tolist() 43 | # list containing dictionary of all bounding box of individual image 44 | out={'boxes' : []} 45 | all_classes = [] 46 | for i in range(len(result)): 47 | temp={} 48 | temp['box']= result[i][:4] 49 | modify= [w/416, h/416, w/416, h/416] 50 | temp['box'] = [ int(temp['box'][j] * modify[j]) for j in range(4) ] 51 | 52 | temp['confidence']=float(result[i][4]) 53 | temp['class']=classes[ int(result[i][5])] 54 | all_classes.append(temp['class']) 55 | out['boxes'].append(temp) 56 | 57 | freq = Counter(all_classes).most_common(1)[0][0] 58 | print(freq) 59 | out['plant_name'] = freq.split()[0] 60 | if len(freq.split()) == 2: 61 | out['disease'] = False 62 | out['disease_name'] = '' 63 | else: 64 | out['disease'] = True 65 | out['disease_name'] = ' '.join(freq.split()[1:-1]) 66 | 67 | return jsonify(out) 68 | 69 | if __name__ == "__main__": 70 | app.run(port = 8000) -------------------------------------------------------------------------------- /AIBackend/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn Detection:app -------------------------------------------------------------------------------- /AIBackend/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==1.1.2 2 | gunicorn==19.9.0 3 | matplotlib>=3.2.2 4 | numpy>=1.18.5 5 | opencv-python>=4.1.2 6 | Pillow 7 | PyYAML>=5.3.1 8 | scipy>=1.4.1 9 | # torch==1.8.1+cpu 10 | # https://download.pytorch.org/whl/cpu/torch-1.8.1%2Bcpu-cp39-cp39-linux_x86_64.whl 11 | # https://download.pytorch.org/whl/cpu/torchvision-0.9.1%2Bcpu-cp39-cp39-linux_x86_64.whl 12 | tqdm>=4.41.0 13 | 14 | # logging ------------------------------------- 15 | tensorboard>=2.4.1 16 | # wandb 17 | 18 | # plotting ------------------------------------ 19 | seaborn>=0.11.0 20 | pandas 21 | 22 | # export -------------------------------------- 23 | # coremltools>=4.1 24 | # onnx>=1.8.1 25 | # scikit-learn==0.19.2 # for coreml quantization 26 | 27 | # extras -------------------------------------- 28 | thop # FLOPS computation 29 | pycocotools>=2.0 # COCO mAP 30 | -------------------------------------------------------------------------------- /AnnadataZulipBot/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__init__.py -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/air.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/air.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/annadata.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/annadata.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/converter.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/converter.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/fire.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/fire.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/location.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/location.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/pincode.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/pincode.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/pollen.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/pollen.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/soil.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/soil.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/waterVapour.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/waterVapour.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/__pycache__/weather.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/AnnadataZulipBot/__pycache__/weather.cpython-38.pyc -------------------------------------------------------------------------------- /AnnadataZulipBot/air.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getAirInfoGeo(lat, lng): 4 | url = "http://localhost:5000/api/ambeedata/air/geospatial?lat={}&lng={}".format(lat, lng) 5 | results = requests.get(url) 6 | data = results.json() 7 | NO2 = data["stations"][0]["NO2"] 8 | PM10 = data["stations"][0]["PM10"] 9 | PM25 = data["stations"][0]["PM25"] 10 | CO = data["stations"][0]["CO"] 11 | SO2 = data["stations"][0]["SO2"] 12 | OZONE = data["stations"][0]["OZONE"] 13 | AQI = data["stations"][0]["AQI"] 14 | 15 | pollutant = data["stations"][0]["aqiInfo"]["pollutant"] 16 | concentration = data["stations"][0]["aqiInfo"]["concentration"] 17 | category = data["stations"][0]["aqiInfo"]["category"] 18 | 19 | info = { 20 | "NO2": NO2, 21 | "PM10": PM10, 22 | "PM25": PM25, 23 | "CO": CO, 24 | "SO2": SO2, 25 | "OZONE": OZONE, 26 | "AQI": AQI, 27 | "pollutant": pollutant, 28 | "concentration": concentration, 29 | "category": category 30 | } 31 | 32 | return info 33 | -------------------------------------------------------------------------------- /AnnadataZulipBot/doc.md: -------------------------------------------------------------------------------- 1 | # Annadata bot 2 | 3 | This bot users to receive various real time information about farming. 4 | One can receive information about soil, fire alert, pollen and weed data, weather forecast, air quality and water vapour content. 5 | User can receive this information by providing either their geolocation coordinates, pin code or city name 6 | The message **@annadata help** posts a short description of how to use 7 | the plugin, along with a list of all supported commands. 8 | 9 | ## Usage 10 | 11 | Run this bot as described in [here](https://zulip.com/api/running-bots#running-a-bot). 12 | 13 | ### Usage examples 14 | 15 | Usage examples: 16 | `@annadata soil geolocation 28 77` 17 | `@annadata soil name bengaluru` 18 | `@annadata soil pincode 121001` 19 | `@annadata fire geolocation 28 77` 20 | `@annadata fire name bengaluru` 21 | `@annadata fire pincode 121001` 22 | `@annadata pollen geolocation 28 77` 23 | `@annadata pollen name bengaluru` 24 | `@annadata pollen pincode 121001` 25 | `@annadata weather geolocation 28 77` 26 | `@annadata weather name bengaluru` 27 | `@annadata weather pincode 121001` 28 | 29 | ## Notes 30 | 31 | * Enter `@annadata help` to display a quick overview of the annadata's functionality. 32 | 33 | -------------------------------------------------------------------------------- /AnnadataZulipBot/fire.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getFireInfoGeo(lat, lng): 4 | url = "http://localhost:5000/api/ambeedata/fire?lat={}&lng={}".format(lat, lng) 5 | results = requests.get(url) 6 | data = results.json() 7 | confidence = data["data"][0]["confidence"] 8 | # Fire radiative power in MW 9 | frp = data["data"][0]["frp"] 10 | detection_time = data["data"][0]["detection_time"] 11 | distance = data["data"][0]["distance"] 12 | 13 | info = { 14 | "confidence": confidence, 15 | "frp": frp, 16 | "detection_time": detection_time, 17 | "distance": distance 18 | } 19 | 20 | return info 21 | -------------------------------------------------------------------------------- /AnnadataZulipBot/location.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getLocationFromName(place): 4 | results = requests.get('https://maps.googleapis.com/maps/api/geocode/json?address='+place+',®ion=in&key=AIzaSyBKmBYERZyz9Cj7-F9bT7WMWVuSHiaX9kU') 5 | data = results.json() 6 | # print(data["results"][0]["geometry"]["location"]["lat"]) 7 | # print(data["results"][0]["geometry"]["location"]["lng"]) 8 | info = { 9 | "lat": data["results"][0]["geometry"]["location"]["lat"], 10 | "lng": data["results"][0]["geometry"]["location"]["lng"] 11 | } 12 | return info 13 | -------------------------------------------------------------------------------- /AnnadataZulipBot/pincode.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getLocationFromPincode(pincode): 4 | url = "http://www.postalpincode.in/api/pincode/{}".format(pincode) 5 | results = requests.get(url) 6 | data = results.json() 7 | return data["PostOffice"][0]["District"] 8 | -------------------------------------------------------------------------------- /AnnadataZulipBot/pollen.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getPollenInfoGeo(lat, lng): 4 | url = "http://localhost:5000/api/ambeedata/pollen?lat={}&lng={}".format(lat, lng) 5 | results = requests.get(url) 6 | data = results.json() 7 | grass_pollen_count = data["data"][0]["Count"]["grass_pollen"] 8 | tree_pollen_count = data["data"][0]["Count"]["tree_pollen"] 9 | weed_pollen_count = data["data"][0]["Count"]["weed_pollen"] 10 | grass_pollen_risk = data["data"][0]["Risk"]["grass_pollen"] 11 | tree_pollen_risk = data["data"][0]["Risk"]["tree_pollen"] 12 | weed_pollen_risk = data["data"][0]["Risk"]["weed_pollen"] 13 | 14 | info = { 15 | "grass_pollen_count": grass_pollen_count, 16 | "tree_pollen_count": tree_pollen_count, 17 | "weed_pollen_count": weed_pollen_count, 18 | "grass_pollen_risk": grass_pollen_risk, 19 | "tree_pollen_risk": tree_pollen_risk, 20 | "weed_pollen_risk": weed_pollen_risk 21 | } 22 | 23 | return info 24 | -------------------------------------------------------------------------------- /AnnadataZulipBot/soil.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getSoilInfoGeo(lat, lng): 4 | url = "http://localhost:5000/api/ambeedata/soil?lat={}&lng={}".format(lat, lng) 5 | results = requests.get(url) 6 | data = results.json() 7 | scantime = data["data"][0]["scantime"] 8 | soil_temperature = data["data"][0]["soil_temperature"] 9 | soil_moisture = data["data"][0]["soil_moisture"] 10 | 11 | soilInfo = { 12 | "scantime": scantime, 13 | "soil_temperature": soil_temperature, 14 | "soil_moisture": soil_moisture, 15 | } 16 | 17 | return soilInfo 18 | -------------------------------------------------------------------------------- /AnnadataZulipBot/test_converter.py: -------------------------------------------------------------------------------- 1 | from zulip_bots.test_lib import BotTestCase, DefaultTests 2 | 3 | from zulip_bots.bots.converter import utils 4 | 5 | class TestConverterBot(BotTestCase, DefaultTests): 6 | bot_name = "converter" 7 | 8 | def test_bot(self) -> None: 9 | dialog = [ 10 | ("", 'Too few arguments given. Enter `@annadata help` ' 11 | 'for help on using the annadata.\n'), 12 | ] 13 | self.verify_dialog(dialog) 14 | -------------------------------------------------------------------------------- /AnnadataZulipBot/utils.py: -------------------------------------------------------------------------------- 1 | 2 | HELP_MESSAGE = ('Annadata usage:\n' 3 | 4 | '`@annadata soil geolocation `\n' 5 | 'Get realtime soil temparature and moisture for given and location\n' 6 | '`@annadata soil name `\n' 7 | 'Get realtime soil temparature and moisture for given city_name\n' 8 | '`@annadata soil pincode `\n' 9 | 'Get realtime soil temparature and moisture for given location\n' 10 | 11 | '`@annadata fire geolocation `\n' 12 | '`@annadata fire name `\n' 13 | '`@annadata fire pincode `\n' 14 | 'Get realtime fire threat alert for your location\n' 15 | 16 | '`@annadata pollen geolocation `\n' 17 | '`@annadata pollen name `\n' 18 | '`@annadata pollen pincode `\n' 19 | 'Get realtime fire threat alert for your location\n' 20 | 21 | '`@annadata weather geolocation `\n' 22 | '`@annadata weather name `\n' 23 | '`@annadata weather pincode `\n' 24 | 'Get realtime weather forecast\n' 25 | 26 | '`@annadata watervapour geolocation `\n' 27 | '`@annadata watervapour name `\n' 28 | '`@annadata watervapour pincode `\n' 29 | 'Get realtime water vapour content\n' 30 | 31 | '`@annadata air geolocation `\n' 32 | '`@annadata air name `\n' 33 | '`@annadata air pincode `\n' 34 | 'Get realtime air quality information\n' 35 | 36 | 'Usage examples:\n' 37 | '* `@annadata soil geolocation 28 77`\n' 38 | '* `@annadata soil name bengaluru`\n' 39 | '* `@annadata soil pincode 121001`\n' 40 | '* `@annadata fire geolocation 28 77`\n' 41 | '* `@annadata fire name bengaluru`\n' 42 | '* `@annadata fire pincode 121001`\n' 43 | '* `@annadata pollen geolocation 28 77`\n' 44 | '* `@annadata pollen name bengaluru`\n' 45 | '* `@annadata pollen pincode 121001`\n' 46 | '* `@annadata weather geolocation 28 77`\n' 47 | '* `@annadata weather name bengaluru`\n' 48 | '* `@annadata weather pincode 121001`\n' 49 | ) 50 | 51 | QUICK_HELP = 'Enter `@annadata help` for help on using the converter.' 52 | -------------------------------------------------------------------------------- /AnnadataZulipBot/waterVapour.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getWaterVapourInfoGeo(lat, lng): 4 | url = "http://localhost:5000/api/ambeedata/waterVapour?lat={}&lng={}".format(lat, lng) 5 | results = requests.get(url) 6 | data = results.json() 7 | # Water vapor levels in meters (m) 8 | water_vapor = data["data"][0]["water_vapor"] 9 | print(data) 10 | info = { 11 | "water_vapor": water_vapor 12 | } 13 | return info 14 | -------------------------------------------------------------------------------- /AnnadataZulipBot/weather.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def getWeatherInfoGeo(lat, lng): 4 | url = "http://localhost:5000/api/ambeedata/weather?lat={}&lng={}".format(lat, lng) 5 | results = requests.get(url) 6 | data = results.json() 7 | time = data["data"]["time"] 8 | temperature = data["data"]["temperature"] 9 | dewPoint = data["data"]["dewPoint"] 10 | humidity = data["data"]["humidity"] 11 | pressure = data["data"]["pressure"] 12 | windSpeed = data["data"]["windSpeed"] 13 | windGust = data["data"]["windGust"] 14 | windBearing = data["data"]["windBearing"] 15 | cloudCover = data["data"]["cloudCover"] 16 | visibility = data["data"]["visibility"] 17 | ozone = data["data"]["ozone"] 18 | 19 | info = { 20 | "temperature": temperature, 21 | "dewPoint": dewPoint, 22 | "humidity": humidity, 23 | "pressure": pressure, 24 | "windSpeed": windSpeed, 25 | "windGust": windGust, 26 | "windBearing": windBearing, 27 | "cloudCover": cloudCover, 28 | "visibility": visibility, 29 | "ozone": ozone 30 | } 31 | 32 | return info 33 | -------------------------------------------------------------------------------- /AnnadataZulipBot/zuliprc: -------------------------------------------------------------------------------- 1 | [api] 2 | email=annadata-bot@annadata.zulipchat.com 3 | key=rI65FIhV3D3kSj8zJmwEluF3IijBh4uH 4 | site=https://annadata.zulipchat.com 5 | -------------------------------------------------------------------------------- /CropRecommender/.gitignore: -------------------------------------------------------------------------------- 1 | env/* 2 | env1/* -------------------------------------------------------------------------------- /CropRecommender/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn recom:app -------------------------------------------------------------------------------- /CropRecommender/Readme.md: -------------------------------------------------------------------------------- 1 | # CropRecommender 2 | 3 | This tool predicts that what will be the best crop to grow based on the soil conditions. 4 | 5 | # Setup 6 | 7 | 1. Create a virtual environment using the below command 8 | ```bash 9 | python3 -m venv env 10 | ``` 11 | 12 | 2. Activate the virtual environment 13 | ```bash 14 | source env/bin/activate 15 | ``` 16 | 17 | 3. All all the required dependencies specified in the requirement.txt file 18 | ``` 19 | pip install -r requirements.txt 20 | ``` 21 | 22 | 4. Start the server 23 | ```bash 24 | python3 recom.py 25 | ``` 26 | It will start the server on port 9000 27 | 28 | # Use 29 | Make a post request to `http://localhost:9000/predict` and send the below data as json: 30 | ```json 31 | { 32 | "n": "Value of Nitrogen content in the soil", 33 | "p": "Value of Phosphorus content in the soil", 34 | "k": "Value of Potassium content in the soil", 35 | "temp": "Average temperature of the region", 36 | "hum": "Average humidity of the region", 37 | "ph": "pH value of soil", 38 | "rain": "Average amount of rainfall in the region" 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /CropRecommender/recom.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import numpy as np 3 | import pandas as pd 4 | from flask import Flask, request, jsonify, render_template 5 | from flask_cors import CORS 6 | 7 | app = Flask(__name__) 8 | CORS(app) 9 | 10 | classes = ['apple', 'banana', 'blackgram', 'chickpea', 'coconut', 'coffee', 11 | 'cotton', 'grapes', 'jute', 'kidneybeans', 'lentil', 'maize', 12 | 'mango', 'mothbeans', 'mungbean', 'muskmelon', 'orange', 'papaya', 13 | 'pigeonpeas', 'pomegranate', 'rice', 'watermelon'] 14 | 15 | clf = pickle.load(open('recommender.pkl', 'rb')) 16 | 17 | @app.route('/predict', methods=['POST']) 18 | def predict(): 19 | if request.method == 'POST': 20 | features = [request.json.get('n'), request.json.get('p'), request.json.get('k'), request.json.get('temp'), request.json.get('hum'), request.json.get('ph'), request.json.get('rain')] 21 | for i in range(len(features)): 22 | features[i] = float(features[i]) 23 | print(features) 24 | pred = clf.predict([features]) 25 | 26 | return jsonify({'crop' : classes[pred[0]]}) 27 | 28 | if __name__ == "__main__": 29 | app.run(port = 9000) -------------------------------------------------------------------------------- /CropRecommender/recommender.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/CropRecommender/recommender.pkl -------------------------------------------------------------------------------- /CropRecommender/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.1.0 2 | gunicorn==19.9.0 3 | numpy>=1.18.5 4 | # Cython==0.29.21 5 | pandas 6 | scikit-learn 7 | flask_cors 8 | -------------------------------------------------------------------------------- /NodeBackend/.env: -------------------------------------------------------------------------------- 1 | NODE_ENV = 'development' 2 | MONGODB_URL = 'mongodb+srv://admin:admin@cluster0.x0dcn.mongodb.net/myFirstDatabase?retryWrites=true&w=majority' 3 | JWT_SECRET = 'hfghdvc31y8ytex1inqas' 4 | OPEN_WEATHER_API_KEY = '5c42af0b7a42f1e2c689800370107b9f' 5 | OPEN_WEATHER_API_URL = 'https://api.openweathermap.org/data/2.5/weather' 6 | TWILIO_ACCOUNT_SID = 'AC4fbc32cdbbf525e513a0d7fa8e9fdd98' 7 | TWILIO_AUTH_TOKEN = '683733cb602f41dca096739257a410aa' 8 | GMAIL_ID = 'help.annadata@gmail.com' 9 | GMAIL_PASSWORD = 'DownToEarth@123' 10 | CLOUDINARY_CLOUD_NAME = 'annadata' 11 | CLOUDINARY_API_KEY = '272658229675883' 12 | CLOUDINARY_API_SECRET = 'yt_GsWQwK3XAz781_FtFFd5Lpqw' 13 | AMBEEDATA_API_KEY = 'vbOFm1KGNhaoAIQM0KrSPaknrXIgMaoQdXSMKsd5' 14 | AMBEEDATA_API_BASE_URL = https://api.ambeedata.com 15 | -------------------------------------------------------------------------------- /NodeBackend/.eslintignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /config 3 | .DS_Store 4 | /*.env 5 | keys.js 6 | /public 7 | .min.js 8 | .min.css 9 | /coverage 10 | npm-debug.log 11 | tmp/* -------------------------------------------------------------------------------- /NodeBackend/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | extends: 2 | - standard 3 | - plugin:prettier/recommended 4 | env: 5 | es6: true 6 | root: true 7 | plugins: 8 | - react 9 | rules: 10 | arrow-spacing: 'error' 11 | no-const-assign: 'error' 12 | no-var: 'error' 13 | prefer-const: 'error' 14 | prefer-template: 'error' 15 | prefer-destructuring: ['error', { 'object': true, 'array': false }] 16 | object-curly-spacing: [2, 'always'] 17 | no-console: 'off' 18 | -------------------------------------------------------------------------------- /NodeBackend/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | 28 | - OS: [e.g. iOS] 29 | - Browser [e.g. chrome, safari] 30 | - Version [e.g. 22] 31 | 32 | **Smartphone (please complete the following information):** 33 | 34 | - Device: [e.g. iPhone6] 35 | - OS: [e.g. iOS8.1] 36 | - Browser [e.g. stock browser, safari] 37 | - Version [e.g. 22] 38 | 39 | **Additional context** 40 | Add any other context about the problem here. 41 | -------------------------------------------------------------------------------- /NodeBackend/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /NodeBackend/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Issue that this pull request solves 2 | 3 | Closes: # (issue number) 4 | 5 | ## Proposed changes 6 | 7 | Brief description of what is fixed or changed 8 | 9 | ## Types of changes 10 | 11 | _Put an `x` in the boxes that apply_ 12 | 13 | - [ ] Bugfix (non-breaking change which fixes an issue) 14 | - [ ] New feature (non-breaking change which adds functionality) 15 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | - [ ] Documentation update (Documentation content changed) 17 | - [ ] Other (please describe): 18 | 19 | ## Checklist 20 | 21 | _Put an `x` in the boxes that apply_ 22 | 23 | - [ ] My code follows the style guidelines of this project 24 | - [ ] I have performed a self-review of my own code 25 | - [ ] I have commented my code, particularly in hard-to-understand areas 26 | - [ ] I have made corresponding changes to the documentation 27 | - [ ] My changes generate no new warnings 28 | 29 | ## Screenshots 30 | 31 | Please attach the screenshots of the changes made in case of change in user interface 32 | 33 | ## Other information 34 | 35 | Any other information that is important to this pull request 36 | -------------------------------------------------------------------------------- /NodeBackend/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | npm-debug.log 3 | .DS_Store 4 | tmp/* -------------------------------------------------------------------------------- /NodeBackend/.prettierignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /config 3 | .DS_Store 4 | /*.env 5 | keys.js 6 | /public 7 | .min.js 8 | .min.css 9 | /coverage 10 | npm-debug.log 11 | tmp/* -------------------------------------------------------------------------------- /NodeBackend/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /NodeBackend/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Aman Dwivedi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NodeBackend/README.md: -------------------------------------------------------------------------------- 1 | # Backend for Annadata 2 | 3 | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) 4 | ![MIT](https://img.shields.io/github/license/AnnadataHackfest/NodeBackend?color=blue) 5 | 6 | Backend of Annadata 7 | 8 | ## Getting Started 9 | 10 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. 11 | 12 | ### Prerequisites 13 | 14 | Your machine should have Npm(or Yarn) and Node.js installed to use it locally. 15 | 16 | ## Setup and Installation 17 | 18 | ### Setting up the repository locally 19 | 20 | 1. First fork the repo :fork_and_knife: to your account. 21 | Go to the forked repo and clone it :busts_in_silhouette: to your local machine: 22 | 23 | ```sh 24 | git clone https://github.com/Your_Username/NodeBackend.git 25 | ``` 26 | 27 | This will make a copy of the code to your local machine. 28 | 29 | 2. Now move to the `NodeBackend` directory. 30 | 31 | ```sh 32 | cd NodeBackend 33 | ``` 34 | 35 | 3. Now check the remote of your local code by: 36 | 37 | ```sh 38 | git remote -v 39 | ``` 40 | 41 | The response should look like: 42 | 43 | ```sh 44 | origin https://github.com/Your_Username/NodeBackend.git (fetch) 45 | origin https://github.com/Your_Username/NodeBackend.git (push) 46 | ``` 47 | 48 | To add upstream to remote, run: 49 | 50 | ```sh 51 | git remote add upstream https://github.com/AnnadataHackfest/NodeBackend.git 52 | ``` 53 | 54 | Again run `git remote -v`, the response should look like: 55 | 56 | ```sh 57 | origin https://github.com/Your_Username/NodeBackend.git (fetch) 58 | origin https://github.com/Your_Username/NodeBackend.git (push) 59 | upstream https://github.com/AnnadataHackfest/NodeBackend (fetch) 60 | upstream https://github.com/AnnadataHackfest/NodeBackend (push) 61 | ``` 62 | 63 | 4. Once the remote is set, install all the necessary dependencies by the following command: 64 | 65 | ```sh 66 | npm install 67 | ``` 68 | 69 | ### Run locally 70 | 71 | Run the below command to start the server: 72 | 73 | ```sh 74 | npm run dev 75 | ``` 76 | 77 | Go to: [http://localhost:5000](http://localhost:5000) 78 | 79 | ## Tech stack 80 | 81 | - Used [Ambeedata API](https://docs.ambeedata.com/#soil-latest-geospatial) for realtime information about soil, pollen, fire alert, air quality, water vapour and weather information. 82 | 83 | - Used [Open Weather API](https://openweathermap.org/api) for weather forecast 84 | 85 | - Used [Twilio](https://www.twilio.com/) for sending SMS 86 | 87 | - Used [Node Mailer](https://nodemailer.com/about/) for sending email 88 | 89 | - Used [Cloudinary](https://cloudinary.com/) for storing media files like photos and videos 90 | 91 | - Used [MongoDB](https://www.mongodb.com/) for database 92 | 93 | - Used [JWT](https://jwt.io/) for secure authentication 94 | -------------------------------------------------------------------------------- /NodeBackend/middleware/auth.js: -------------------------------------------------------------------------------- 1 | const jwt = require('jsonwebtoken'); 2 | 3 | function auth(req, res, next) { 4 | const token = req.header('x-auth-token'); 5 | 6 | // Check for token 7 | if (!token) 8 | return res.status(401).json({ msg: 'No token, authorizaton denied' }); 9 | 10 | try { 11 | // Verify token 12 | const decoded = jwt.verify(token, process.env.JWT_SECRET); 13 | // Add user from payload 14 | req.user = decoded; 15 | next(); 16 | } catch (e) { 17 | res.status(400).json({ msg: 'Token is not valid' }); 18 | } 19 | } 20 | 21 | module.exports = auth; 22 | -------------------------------------------------------------------------------- /NodeBackend/models/Info.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const { Schema } = mongoose; 4 | 5 | const InfoSchema = new Schema({ 6 | question: { 7 | type: String, 8 | required: true, 9 | }, 10 | answer: { 11 | type: String, 12 | required: true, 13 | }, 14 | name: { 15 | type: String, 16 | required: true, 17 | }, 18 | phone: { 19 | type: String, 20 | required: true, 21 | }, 22 | date: { 23 | type: Date, 24 | default: Date.now, 25 | }, 26 | }); 27 | 28 | module.exports = mongoose.model('info', InfoSchema); 29 | -------------------------------------------------------------------------------- /NodeBackend/models/Item.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const { Schema } = mongoose; 4 | 5 | const ItemSchema = new Schema({ 6 | name: { 7 | type: String, 8 | required: true, 9 | }, 10 | date: { 11 | type: Date, 12 | default: Date.now, 13 | }, 14 | }); 15 | 16 | module.exports = mongoose.model('item', ItemSchema); 17 | -------------------------------------------------------------------------------- /NodeBackend/models/Question.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const { Schema } = mongoose; 4 | 5 | const QuestionSchema = new Schema({ 6 | question: { 7 | type: String, 8 | required: true, 9 | }, 10 | name: { 11 | type: String, 12 | required: true, 13 | }, 14 | phone: { 15 | type: String, 16 | required: true, 17 | }, 18 | date: { 19 | type: Date, 20 | default: Date.now, 21 | }, 22 | }); 23 | 24 | module.exports = mongoose.model('question', QuestionSchema); 25 | -------------------------------------------------------------------------------- /NodeBackend/models/UploadFile.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const UploadFileSchema = new mongoose.Schema({ 4 | fileUrl: { 5 | type: String, 6 | trim: true, 7 | default: '', 8 | }, 9 | created_date: { 10 | type: Date, 11 | default: Date.now, 12 | }, 13 | }); 14 | 15 | const UploadFile = mongoose.model('UploadFile', UploadFileSchema); 16 | module.exports = UploadFile; 17 | -------------------------------------------------------------------------------- /NodeBackend/models/User.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const { Schema } = mongoose; 4 | 5 | // Create Schema 6 | const UserSchema = new Schema({ 7 | name: { 8 | type: String, 9 | required: true, 10 | }, 11 | email: { 12 | type: String, 13 | required: false, 14 | unique: true, 15 | }, 16 | phone: { 17 | type: Number, 18 | required: true, 19 | unique: true, 20 | }, 21 | password: { 22 | type: String, 23 | required: true, 24 | }, 25 | register_date: { 26 | type: Date, 27 | default: Date.now, 28 | }, 29 | verified: { 30 | type: Boolean, 31 | default: false, 32 | }, 33 | uploadedFiles: [ 34 | { 35 | type: mongoose.Schema.Types.ObjectId, 36 | ref: 'File', 37 | }, 38 | ], 39 | }); 40 | 41 | module.exports = mongoose.model('user', UserSchema); 42 | -------------------------------------------------------------------------------- /NodeBackend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "annadata_backend", 3 | "version": "1.0.0", 4 | "description": "backend of annadata website and app", 5 | "main": "server.js", 6 | "engines": { 7 | "node": "12.16.3", 8 | "npm": "6.14.4" 9 | }, 10 | "scripts": { 11 | "start": "node server.js", 12 | "dev": "nodemon server.js", 13 | "format": "prettier --write .", 14 | "js:fix": "eslint ./ --fix", 15 | "test:js": "eslint ./", 16 | "fix": "npm run format && npm run js:fix && npm run test:js", 17 | "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client" 18 | }, 19 | "author": "Team Annadata", 20 | "license": "MIT", 21 | "dependencies": { 22 | "axios": "^0.21.1", 23 | "bcryptjs": "^2.4.3", 24 | "body-parser": "^1.19.0", 25 | "cloudinary": "^1.25.1", 26 | "cors": "^2.8.5", 27 | "dotenv": "^8.2.0", 28 | "express": "^4.17.1", 29 | "express-fileupload": "^1.2.1", 30 | "jsonwebtoken": "^8.5.1", 31 | "mongoose": "^5.12.6", 32 | "nodemailer": "^6.6.0", 33 | "twilio": "^3.61.0" 34 | }, 35 | "devDependencies": { 36 | "eslint": "^6.8.0", 37 | "eslint-config-prettier": "^6.12.0", 38 | "eslint-config-standard": "^14.1.1", 39 | "eslint-plugin-import": "^2.22.1", 40 | "eslint-plugin-node": "^11.1.0", 41 | "eslint-plugin-prettier": "^3.1.4", 42 | "eslint-plugin-promise": "^4.2.1", 43 | "eslint-plugin-react": "^7.21.2", 44 | "eslint-plugin-standard": "^4.0.1", 45 | "husky": "^4.3.0", 46 | "prettier": "2.2.1" 47 | }, 48 | "husky": { 49 | "hooks": { 50 | "pre-commit": "npm run format && npm run js:fix && npm run test:js" 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/ambeedata.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const axios = require('axios'); 5 | const { 6 | soilLatest, 7 | fireLatest, 8 | pollenLatest, 9 | // pollenForecast, 10 | waterVapourLatest, 11 | airQualityLatestGeospatial, 12 | airQualityLatestPostalCode, 13 | weatherLatest, 14 | } = require('./ambeedataEndpoints'); 15 | 16 | const AmbeedataApiBaseUrl = process.env.AMBEEDATA_API_BASE_URL; 17 | const AmbeedataApiKey = process.env.AMBEEDATA_API_KEY; 18 | 19 | // Sample Request Url: localhost:5000/api/ambeedata/soil?lat=28.68&lng=77.22 20 | router.get('/soil', (req, res) => { 21 | console.log(req.lat); 22 | const { lat } = req; 23 | const { lng } = req; 24 | console.log('latitude ', lat); 25 | console.log('longitude ', lng); 26 | const url = `${AmbeedataApiBaseUrl}${soilLatest}?lat=${lat}&lng=${lng}`; 27 | axios({ 28 | method: 'GET', 29 | url, 30 | headers: { 31 | 'x-api-key': AmbeedataApiKey, 32 | }, 33 | }) 34 | .then((response) => { 35 | console.log(response.data); 36 | res.json(response.data); 37 | }) 38 | .catch((error) => { 39 | console.log('Error occured in Ambeedata Api ', error); 40 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 41 | }); 42 | }); 43 | 44 | // Sample Request Url: localhost:5000/api/ambeedata/fire?lat=28.68&lng=77.22 45 | router.get('/fire', (req, res) => { 46 | const { lat, lng } = req.query; 47 | console.log('latitude ', lat); 48 | console.log('longitude ', lng); 49 | const url = `${AmbeedataApiBaseUrl}${fireLatest}?lat=${lat}&lng=${lng}`; 50 | axios({ 51 | method: 'GET', 52 | url, 53 | headers: { 54 | 'x-api-key': AmbeedataApiKey, 55 | }, 56 | }) 57 | .then((response) => { 58 | console.log(response.data); 59 | res.json(response.data); 60 | }) 61 | .catch((error) => { 62 | console.log('Error occured in Ambeedata Api ', error); 63 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 64 | }); 65 | }); 66 | 67 | // Sample Request Url: localhost:5000/api/ambeedata/pollen?lat=28.68&lng=77.22 68 | router.get('/pollen', (req, res) => { 69 | const { lat, lng } = req.query; 70 | console.log('latitude ', lat); 71 | console.log('longitude ', lng); 72 | const url = `${AmbeedataApiBaseUrl}${pollenLatest}?lat=${lat}&lng=${lng}`; 73 | axios({ 74 | method: 'GET', 75 | url, 76 | headers: { 77 | 'x-api-key': AmbeedataApiKey, 78 | }, 79 | }) 80 | .then((response) => { 81 | console.log(response.data); 82 | res.json(response.data); 83 | }) 84 | .catch((error) => { 85 | console.log('Error occured in Ambeedata Api ', error); 86 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 87 | }); 88 | }); 89 | 90 | // Sample Request Url: localhost:5000/api/ambeedata/waterVapour?lat=28.68&lng=77.22 91 | router.get('/waterVapour', (req, res) => { 92 | const { lat, lng } = req.query; 93 | console.log('latitude ', lat); 94 | console.log('longitude ', lng); 95 | const url = `${AmbeedataApiBaseUrl}${waterVapourLatest}?lat=${lat}&lng=${lng}`; 96 | axios({ 97 | method: 'GET', 98 | url, 99 | headers: { 100 | 'x-api-key': AmbeedataApiKey, 101 | }, 102 | }) 103 | .then((response) => { 104 | console.log(response.data); 105 | res.json(response.data); 106 | }) 107 | .catch((error) => { 108 | console.log('Error occured in Ambeedata Api ', error); 109 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 110 | }); 111 | }); 112 | 113 | // Sample Request Url: localhost:5000/api/ambeedata/air/geospatial?lat=28.68&lng=77.22 114 | router.get('/air/geospatial', (req, res) => { 115 | const { lat, lng } = req.query; 116 | console.log('latitude ', lat); 117 | console.log('longitude ', lng); 118 | const url = `${AmbeedataApiBaseUrl}${airQualityLatestGeospatial}?lat=${lat}&lng=${lng}`; 119 | axios({ 120 | method: 'GET', 121 | url, 122 | headers: { 123 | 'x-api-key': AmbeedataApiKey, 124 | }, 125 | }) 126 | .then((response) => { 127 | console.log(response.data); 128 | res.json(response.data); 129 | }) 130 | .catch((error) => { 131 | console.log('Error occured in Ambeedata Api ', error); 132 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 133 | }); 134 | }); 135 | 136 | // Sample Request Url: localhost:5000/api/ambeedata/air/postal?postalCode=560020&countryCode=IN 137 | router.get('/air/postal', (req, res) => { 138 | const { postalCode } = req.query; 139 | const countryCode = req.query.postalCode || 'IN'; 140 | console.log('postalCode ', postalCode); 141 | console.log('countryCode ', countryCode); 142 | const url = `${AmbeedataApiBaseUrl}${airQualityLatestPostalCode}?postalCode=${postalCode}&countryCode=${countryCode}`; 143 | axios({ 144 | method: 'GET', 145 | url, 146 | headers: { 147 | 'x-api-key': AmbeedataApiKey, 148 | }, 149 | }) 150 | .then((response) => { 151 | console.log(response.data); 152 | res.json(response.data); 153 | }) 154 | .catch((error) => { 155 | console.log('Error occured in Ambeedata Api ', error); 156 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 157 | }); 158 | }); 159 | 160 | // Sample Request Url: localhost:5000/api/ambeedata/weather?lat=28.68&lng=77.22 161 | router.get('/weather', (req, res) => { 162 | const { lat, lng } = req.query; 163 | console.log('latitude ', lat); 164 | console.log('longitude ', lng); 165 | const url = `${AmbeedataApiBaseUrl}${weatherLatest}?lat=${lat}&lng=${lng}`; 166 | axios({ 167 | method: 'GET', 168 | url, 169 | headers: { 170 | 'x-api-key': AmbeedataApiKey, 171 | }, 172 | }) 173 | .then((response) => { 174 | console.log(response.data); 175 | res.json(response.data); 176 | }) 177 | .catch((error) => { 178 | console.log('Error occured in Ambeedata Api ', error); 179 | return res.status(400).json({ msg: 'Error occured in Ambeedata Api' }); 180 | }); 181 | }); 182 | 183 | module.exports = router; 184 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/ambeedataEndpoints.js: -------------------------------------------------------------------------------- 1 | const soilLatest = '/soil/latest/by-lat-lng'; 2 | const fireLatest = '/latest/fire'; 3 | const pollenLatest = '/latest/pollen/by-lat-lng'; 4 | const pollenForecast = '/forecast/pollen/by-lat-lng'; 5 | const waterVapourLatest = '/waterVapor/latest/by-lat-lng'; 6 | const airQualityLatestGeospatial = '/latest/by-lat-lng'; 7 | const airQualityLatestPostalCode = '/latest/by-postal-code'; 8 | const weatherLatest = '/weather/latest/by-lat-lng'; 9 | 10 | module.exports = { 11 | soilLatest, 12 | fireLatest, 13 | pollenLatest, 14 | pollenForecast, 15 | waterVapourLatest, 16 | airQualityLatestGeospatial, 17 | airQualityLatestPostalCode, 18 | weatherLatest, 19 | }; 20 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/auth.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const bcrypt = require('bcryptjs'); 5 | const jwt = require('jsonwebtoken'); 6 | const auth = require('../../middleware/auth'); 7 | 8 | require('dotenv').config(); 9 | 10 | // User Model 11 | const User = require('../../models/User'); 12 | 13 | // @route POST api/auth 14 | // @desc Auth user 15 | // @access Public 16 | router.post('/', (req, res) => { 17 | const { phone, password } = req.body; 18 | 19 | // Simple validation 20 | if (!phone || !password) { 21 | return res.status(400).json({ msg: 'Please enter all fields' }); 22 | } 23 | 24 | // Check for existing user 25 | User.findOne({ phone }).then((user) => { 26 | if (!user) return res.status(400).json({ msg: 'User does not exist' }); 27 | 28 | // Validate password 29 | bcrypt.compare(password, user.password).then((isMatch) => { 30 | if (!isMatch) return res.status(400).json({ msg: 'Invalid credentials' }); 31 | 32 | jwt.sign( 33 | { id: user.id }, 34 | process.env.JWT_SECRET, 35 | { expiresIn: 3600 }, 36 | (err, token) => { 37 | if (err) throw err; 38 | res.json({ 39 | token, 40 | user: { 41 | id: user.id, 42 | name: user.name, 43 | email: user.email, 44 | phone: user.phone, 45 | }, 46 | }); 47 | } 48 | ); 49 | }); 50 | }); 51 | }); 52 | 53 | // @route GET api/auth/user 54 | // @desc Get user data 55 | // @access Private 56 | router.get('/user', auth, (req, res) => { 57 | User.findById(req.user.id) 58 | .select('-password') 59 | .then((user) => res.json(user)); 60 | }); 61 | 62 | module.exports = router; 63 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/infos.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const auth = require('../../middleware/auth'); 5 | 6 | // item model 7 | const Info = require('../../models/Info'); 8 | 9 | router.get('/', (req, res) => { 10 | Info.find() 11 | .sort({ date: -1 }) 12 | .then((infos) => res.json(infos)); 13 | }); 14 | 15 | router.post('/', auth, (req, res) => { 16 | const newInfo = new Info({ 17 | question: req.body.question, 18 | answer: req.body.answer, 19 | name: req.body.name, 20 | phone: req.body.phone, 21 | }); 22 | 23 | newInfo.save().then((info) => res.json(info)); 24 | }); 25 | 26 | // router.delete('/:id', auth, (req, res) => { 27 | // Item.findById(req.params.id) 28 | // .then(item => item.remove().then(() => res.json({success: true}))) 29 | // .catch(err => res.status(404).json({success: false})); 30 | // }); 31 | 32 | module.exports = router; 33 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/items.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const auth = require('../../middleware/auth'); 5 | 6 | // item model 7 | const Item = require('../../models/Item'); 8 | 9 | router.get('/', (req, res) => { 10 | Item.find() 11 | .sort({ date: -1 }) 12 | .then((items) => res.json(items)); 13 | }); 14 | 15 | router.post('/', auth, (req, res) => { 16 | const newItem = new Item({ 17 | name: req.body.name, 18 | }); 19 | 20 | newItem.save().then((item) => res.json(item)); 21 | }); 22 | 23 | router.delete('/:id', auth, (req, res) => { 24 | Item.findById(req.params.id) 25 | .then((item) => item.remove().then(() => res.json({ success: true }))) 26 | .catch((err) => { 27 | console.log(err); 28 | res.status(404).json({ success: false }); 29 | }); 30 | }); 31 | 32 | module.exports = router; 33 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/otp.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const nodemailer = require('nodemailer'); 3 | 4 | const router = express.Router(); 5 | const auth = require('../../middleware/auth'); 6 | const { randomString } = require('../../utils/utility'); 7 | const User = require('../../models/User'); 8 | 9 | const accountSid = process.env.TWILIO_ACCOUNT_SID; 10 | const authToken = process.env.TWILIO_AUTH_TOKEN; 11 | const client = require('twilio')(accountSid, authToken); 12 | 13 | let otpList = []; 14 | 15 | // Remove expired OTP from OPT_List 16 | const removeExpiredOTP = () => { 17 | const temp = otpList.filter((item) => { 18 | const current = new Date(); 19 | // Remove OTP expired 10 minutes ago 20 | return current.getTime() - item.generatedTime < 1000 * 60 * 10; 21 | }); 22 | otpList = temp; 23 | }; 24 | 25 | // Remove used OTP from OPT_List 26 | const removeUsedOTP = (OTP) => { 27 | const temp = otpList.filter((item) => item.OTP !== OTP.OTP); 28 | otpList = temp; 29 | }; 30 | 31 | // find OTP in otpList 32 | const findOTP = (givenOTP) => { 33 | const obj = otpList.find((o, i) => { 34 | if (o.OTP === givenOTP.OTP) { 35 | return true; // stop searching 36 | } 37 | }); 38 | if (obj === null || obj === undefined) { 39 | return false; 40 | } 41 | 42 | return true; 43 | }; 44 | 45 | // Get OTP via SMS 46 | router.post('/sms', (req, res) => { 47 | removeExpiredOTP(); 48 | const { phone } = req.body; 49 | const rstring = randomString(10); 50 | const d = new Date(); 51 | const otp = { 52 | OTP: rstring, 53 | generatedTime: d.getTime(), 54 | }; 55 | otpList.push(otp); 56 | client.messages 57 | .create({ 58 | body: `Welcome to Annadata. Your OTP is ${otp.OTP}`, 59 | from: '+14246257905', 60 | to: phone, 61 | }) 62 | .then((message) => { 63 | console.log(message.sid); 64 | res.json({ msg: 'Successfully sent OTP' }); 65 | }) 66 | .catch((error) => { 67 | console.log('Error occured in Twilio Api ', error); 68 | removeUsedOTP(otp); 69 | res.status(400).json({ msg: 'An error occured' }); 70 | }); 71 | }); 72 | 73 | // Get OTP via email 74 | router.post('/email', (req, res) => { 75 | removeExpiredOTP(); 76 | const { email } = req.body; 77 | console.log('email ', email); 78 | const rstring = randomString(10); 79 | const d = new Date(); 80 | const otp = { 81 | OTP: rstring, 82 | generatedTime: d.getTime(), 83 | }; 84 | otpList.push(otp); 85 | 86 | const sendorEmail = process.env.GMAIL_ID; 87 | const sendorPassword = process.env.GMAIL_PASSWORD; 88 | const transporter = nodemailer.createTransport({ 89 | service: 'gmail', 90 | auth: { 91 | user: sendorEmail, 92 | pass: sendorPassword, 93 | }, 94 | }); 95 | const emailmessage = `Welcome to Annadata.Your OTP is ${otp.OTP}`; 96 | const mailOptions = { 97 | from: sendorEmail, 98 | to: email, 99 | subject: 'Annadata OTP Verification', 100 | text: emailmessage, 101 | }; 102 | 103 | transporter.sendMail(mailOptions, (error, info) => { 104 | if (error) { 105 | console.log('Error occured in sending email ', error); 106 | res.status(400).json({ msg: 'An error occured' }); 107 | } else { 108 | console.log('Email sent ', info); 109 | res.json({ msg: 'Successfully sent OTP' }); 110 | } 111 | }); 112 | }); 113 | 114 | // verify OTP 115 | router.post('/verify', auth, (req, res) => { 116 | const { OTP } = req.body; 117 | // Simple validation 118 | if (!OTP) { 119 | return res.status(400).json({ msg: 'Please enter valid OTP' }); 120 | } 121 | if (findOTP(OTP)) { 122 | User.findById(req.user.id, (err, user) => { 123 | if (err || !user) { 124 | return res.status(400).json({ 125 | msg: 'User not found', 126 | }); 127 | } 128 | const savedUser = user; 129 | savedUser.verified = true; 130 | savedUser.save((error, updatedUser) => { 131 | if (error) { 132 | console.log('Error in updating user verify status', error); 133 | return res.status(400).json({ 134 | msg: 'User update failed', 135 | }); 136 | } 137 | removeUsedOTP(OTP); 138 | return res.json({ msg: 'Successfully verified OTP' }); 139 | }); 140 | }); 141 | } else { 142 | return res.status(400).json({ msg: 'Invalid OTP' }); 143 | } 144 | }); 145 | 146 | module.exports = router; 147 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/questions.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const auth = require('../../middleware/auth'); 5 | 6 | // item model 7 | const Question = require('../../models/Question'); 8 | 9 | router.get('/', (req, res) => { 10 | Question.find() 11 | .sort({ date: -1 }) 12 | .then((questions) => res.json(questions)); 13 | }); 14 | 15 | router.post('/', auth, (req, res) => { 16 | const newQuestion = new Question({ 17 | question: req.body.question, 18 | name: req.body.name, 19 | phone: req.body.phone, 20 | }); 21 | 22 | newQuestion.save().then((question) => res.json(question)); 23 | }); 24 | 25 | // router.delete('/:id', auth, (req, res) => { 26 | // Item.findById(req.params.id) 27 | // .then(item => item.remove().then(() => res.json({success: true}))) 28 | // .catch(err => res.status(404).json({success: false})); 29 | // }); 30 | 31 | module.exports = router; 32 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/upload.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const cloudinary = require('cloudinary').v2; 5 | const UploadFile = require('../../models/UploadFile'); 6 | const User = require('../../models/User'); 7 | const auth = require('../../middleware/auth'); 8 | 9 | cloudinary.config({ 10 | cloud_name: process.env.CLOUDINARY_CLOUD_NAME, 11 | api_key: process.env.CLOUDINARY_API_KEY, 12 | api_secret: process.env.CLOUDINARY_API_SECRET, 13 | }); 14 | 15 | router.post('/', auth, (req, res) => { 16 | const { file } = req.files; 17 | console.log(file); 18 | cloudinary.uploader.upload( 19 | file.tempFilePath, 20 | { resource_type: 'auto' }, 21 | function (err, result) { 22 | if (err) { 23 | console.log('Error occured in cloudinary upload ', err); 24 | return res 25 | .status(400) 26 | .json({ msg: 'Error occured in cloudinary upload' }); 27 | } 28 | console.log('Result is ', result); 29 | console.log('Hosted url is ', result.url); 30 | 31 | // TODO Save this URL in database ===================== 32 | const { id } = req.user; 33 | console.log('User id is ', id); 34 | User.findById(id).exec((err, user) => { 35 | if (err || !user) { 36 | console.log('Error user not found ', err); 37 | return res.status(400).json({ msg: 'Sign in to upload file' }); 38 | } 39 | 40 | const obj = new UploadFile({ 41 | fileUrl: result.url, 42 | }); 43 | user.uploadedFiles.push(obj); 44 | user.save((err, updatedUser) => { 45 | if (err || !updatedUser) { 46 | console.log('Error in saving url to database ', err); 47 | return res 48 | .status(400) 49 | .json({ msg: 'Error in saving url to database' }); 50 | } 51 | 52 | res.json({ 53 | msg: 'Successfully uploaded file to cloudinary', 54 | url: result.url, 55 | }); 56 | }); 57 | }); 58 | } 59 | ); 60 | }); 61 | 62 | module.exports = router; 63 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/users.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const bcrypt = require('bcryptjs'); 5 | const jwt = require('jsonwebtoken'); 6 | 7 | // User Model 8 | const User = require('../../models/User'); 9 | 10 | // @route POST api/users 11 | // @desc Register new user 12 | // @access Public 13 | router.post('/', (req, res) => { 14 | const { name, email, phone, password } = req.body; 15 | 16 | // Simple validation 17 | if (!name || !phone || !password) { 18 | return res.status(400).json({ msg: 'Please enter all fields' }); 19 | } 20 | 21 | // Check for existing user 22 | User.findOne({ phone }).then((user) => { 23 | if (user) return res.status(400).json({ msg: 'User already exists' }); 24 | 25 | const newUser = new User({ 26 | name, 27 | email, 28 | phone, 29 | password, 30 | }); 31 | 32 | // Create salt & hash 33 | bcrypt.genSalt(10, (err, salt) => { 34 | if (err) { 35 | console.log(err); 36 | return res.status(400).json({ msg: 'Error Occured in JWT' }); 37 | } 38 | try { 39 | bcrypt.hash(newUser.password, salt, (err, hash) => { 40 | if (err) throw err; 41 | newUser.password = hash; 42 | newUser.save().then((user) => { 43 | jwt.sign( 44 | { id: user.id }, 45 | process.env.JWT_SECRET, 46 | { expiresIn: 3600 }, 47 | (err, token) => { 48 | if (err) throw err; 49 | res.json({ 50 | token, 51 | user: { 52 | id: user.id, 53 | name: user.name, 54 | email: user.email, 55 | phone: user.phone, 56 | }, 57 | }); 58 | } 59 | ); 60 | }); 61 | }); 62 | } catch (error) { 63 | console.log(error); 64 | return res.status(400).json({ msg: 'Error Occured in JWT' }); 65 | } 66 | }); 67 | }); 68 | }); 69 | 70 | module.exports = router; 71 | -------------------------------------------------------------------------------- /NodeBackend/routes/api/weatherForecast.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const axios = require('axios'); 5 | 6 | // API keys 7 | const openWeatherApiKey = process.env.OPEN_WEATHER_API_KEY; 8 | const openWeatherApiUrl = process.env.OPEN_WEATHER_API_URL; 9 | 10 | // Sample Request Url: localhost:5000/api/weatherForecast/coordinates?lat=28.68&lon=77.22 11 | router.get('/coordinates', (req, res) => { 12 | const { lat, lon } = req.query; 13 | console.log('latitude ', lat); 14 | console.log('longitude ', lon); 15 | axios({ 16 | method: 'GET', 17 | url: `${openWeatherApiUrl}?lat=${lat}&lon=${lon}&appid=${openWeatherApiKey}`, 18 | }) 19 | .then((response) => { 20 | console.log(response.data); 21 | res.json(response.data); 22 | }) 23 | .catch((error) => { 24 | console.log('Error occured in Open Weather Api ', error); 25 | return res.status(400).json({ msg: 'Error occured in Open Weather Api' }); 26 | }); 27 | }); 28 | 29 | // Sample Request Url: localhost:5000/api/weatherForecast/pincode?pinCode=122001 30 | router.get('/pincode', (req, res) => { 31 | const { pinCode } = req.query; 32 | const countryCode = req.query.countryCode || 'in'; 33 | axios({ 34 | method: 'GET', 35 | url: `${openWeatherApiUrl}?zip=${pinCode},${countryCode}&appid=${openWeatherApiKey}`, 36 | }) 37 | .then((response) => { 38 | console.log(response.data); 39 | res.json(response.data); 40 | }) 41 | .catch((error) => { 42 | console.log('Error occured in Open Weather Api ', error); 43 | return res.status(400).json({ msg: 'Error occured in Open Weather Api' }); 44 | }); 45 | }); 46 | 47 | module.exports = router; 48 | -------------------------------------------------------------------------------- /NodeBackend/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const mongoose = require('mongoose'); 3 | const path = require('path'); 4 | const fileupload = require('express-fileupload'); 5 | const cors = require('cors'); 6 | 7 | const app = express(); 8 | require('dotenv').config(); 9 | 10 | // Bodyparser middleware 11 | app.use(express.json()); 12 | app.use(cors()); 13 | // fileupload middleware 14 | app.use( 15 | fileupload({ 16 | useTempFiles: true, 17 | }) 18 | ); 19 | 20 | // DB config 21 | const db = process.env.MONGODB_URL || 'mongodb://localhost/annadata'; 22 | 23 | // connect to mongo 24 | mongoose 25 | .connect(db, { 26 | useNewUrlParser: true, 27 | useUnifiedTopology: true, 28 | useCreateIndex: true, 29 | }) 30 | .then(() => console.log('Mongoose connected..')) 31 | .catch((err) => console.log(err)); 32 | 33 | // use routes 34 | app.use('/api/items', require('./routes/api/items')); 35 | app.use('/api/users', require('./routes/api/users')); 36 | app.use('/api/auth', require('./routes/api/auth')); 37 | app.use('/api/weatherForecast', require('./routes/api/weatherForecast')); 38 | app.use('/api/otp', require('./routes/api/otp')); 39 | app.use('/api/upload', require('./routes/api/upload')); 40 | app.use('/api/ambeedata', require('./routes/api/ambeedata')); 41 | 42 | app.use('/api/questions', require('./routes/api/questions')); 43 | app.use('/api/infos', require('./routes/api/infos')); 44 | 45 | // serve static assets if we are in production 46 | if (process.env.NODE_ENV === 'production') { 47 | // set static folder 48 | app.use(express.static('client/build')); 49 | 50 | app.get('*', (req, res) => { 51 | res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html')); 52 | }); 53 | } 54 | 55 | const port = process.env.PORT || 5000; 56 | 57 | app.listen(port, () => console.log(`server started on port ${port}`)); 58 | -------------------------------------------------------------------------------- /NodeBackend/utils/utility.js: -------------------------------------------------------------------------------- 1 | const randomString = (length) => { 2 | return Math.round( 3 | Math.pow(36, length + 1) - Math.random() * Math.pow(36, length) 4 | ) 5 | .toString(36) 6 | .slice(1); 7 | }; 8 | 9 | module.exports = { 10 | randomString, 11 | }; 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Annadata 2 | 3 | Annadata is a full-stack cross-platform application that provides complete assistance to farmers right from sowing to harvesting. 4 | Some of its features are 5 | 6 | 🎯 Using ML technology for plant disease detection from image and recommending crops to grow based on farmer's location 7 | 8 | 🎯 Real-time information about soil fertility, weed risk, fire alert, weather forecast, and air quality to make the right farming decisions 9 | 10 | 🎯 Detailed cost analysis of growing crop explaining investment required and potential revenue generated along with suggesting other income sources 11 | 12 | 🎯 Option to buy/sell/rent farming equipment 13 | 14 | 🎯 Farmers' community section having chat option, video upload, QnA, and many more other features to make our platform interactive 15 | 16 | ## Scripts 17 | 18 | To install all frontend dependencies, backend dependencies and concurrently. Run 19 | 20 | ```sh 21 | npm run install-all 22 | ``` 23 | 24 | To start backend and frontend server. Run 25 | 26 | ```sh 27 | npm run dev 28 | ``` 29 | 30 | ## Tech stack used 31 | 32 | - [React](https://reactjs.org/) for frontend 33 | 34 | - [Node.js](https://nodejs.org/) for backend 35 | 36 | - [Flask](https://flask.palletsprojects.com/en/2.0.x/) for AI backend 37 | 38 | - [Ambeedata API](https://docs.ambeedata.com/#soil-latest-geospatial) for 39 | realtime information about soil, pollen, fire alert, air quality, water 40 | vapour and weather information. 41 | 42 | - [Open Weather API](https://openweathermap.org/api) for weather forecast 43 | 44 | - [Twilio](https://www.twilio.com/) for sending SMS 45 | 46 | - [Node Mailer](https://nodemailer.com/about/) for sending email 47 | 48 | - [Cloudinary](https://cloudinary.com/) for storing media files like photos 49 | and videos 50 | 51 | - [MongoDB](https://www.mongodb.com/) for database 52 | 53 | - [JWT](https://jwt.io/) for secure authentication 54 | 55 | - [Zulip API](https://zulip.com/api/running-bots) for Zulip Chat bot 56 | 57 | -------------------------------------------------------------------------------- /ReactWebsite/.eslintignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /config 3 | .DS_Store 4 | /*.env 5 | keys.js 6 | /public 7 | .min.js 8 | .min.css 9 | /coverage 10 | npm-debug.log 11 | tmp/* -------------------------------------------------------------------------------- /ReactWebsite/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | extends: 2 | - react-app 3 | - react-app/jest 4 | - standard 5 | - plugin:prettier/recommended 6 | env: 7 | es6: true 8 | root: true 9 | plugins: 10 | - react 11 | rules: 12 | arrow-spacing: 'error' 13 | no-const-assign: 'error' 14 | no-var: 'error' 15 | prefer-const: 'error' 16 | prefer-template: 'error' 17 | prefer-destructuring: ['error', { 'object': true, 'array': false }] 18 | object-curly-spacing: [2, 'always'] 19 | no-console: 'off' 20 | -------------------------------------------------------------------------------- /ReactWebsite/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | 28 | - OS: [e.g. iOS] 29 | - Browser [e.g. chrome, safari] 30 | - Version [e.g. 22] 31 | 32 | **Smartphone (please complete the following information):** 33 | 34 | - Device: [e.g. iPhone6] 35 | - OS: [e.g. iOS8.1] 36 | - Browser [e.g. stock browser, safari] 37 | - Version [e.g. 22] 38 | 39 | **Additional context** 40 | Add any other context about the problem here. 41 | -------------------------------------------------------------------------------- /ReactWebsite/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /ReactWebsite/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Issue that this pull request solves 2 | 3 | Closes: # (issue number) 4 | 5 | ## Proposed changes 6 | 7 | Brief description of what is fixed or changed 8 | 9 | ## Types of changes 10 | 11 | _Put an `x` in the boxes that apply_ 12 | 13 | - [ ] Bugfix (non-breaking change which fixes an issue) 14 | - [ ] New feature (non-breaking change which adds functionality) 15 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | - [ ] Documentation update (Documentation content changed) 17 | - [ ] Other (please describe): 18 | 19 | ## Checklist 20 | 21 | _Put an `x` in the boxes that apply_ 22 | 23 | - [ ] My code follows the style guidelines of this project 24 | - [ ] I have performed a self-review of my own code 25 | - [ ] I have commented my code, particularly in hard-to-understand areas 26 | - [ ] I have made corresponding changes to the documentation 27 | - [ ] My changes generate no new warnings 28 | 29 | ## Screenshots 30 | 31 | Please attach the screenshots of the changes made in case of change in user interface 32 | 33 | ## Other information 34 | 35 | Any other information that is important to this pull request 36 | -------------------------------------------------------------------------------- /ReactWebsite/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /ReactWebsite/.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/.npmignore -------------------------------------------------------------------------------- /ReactWebsite/.prettierignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /config 3 | .DS_Store 4 | /*.env 5 | keys.js 6 | /public 7 | .min.js 8 | .min.css 9 | /coverage 10 | npm-debug.log 11 | tmp/* -------------------------------------------------------------------------------- /ReactWebsite/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /ReactWebsite/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Aman Dwivedi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ReactWebsite/README.md: -------------------------------------------------------------------------------- 1 | # Annadata Website 2 | 3 | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) 4 | ![MIT](https://img.shields.io/github/license/AnnadataHackfest/ReactWebsite?color=blue) 5 | 6 | ## Getting Started 7 | 8 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. 9 | 10 | ### Prerequisites 11 | 12 | Your machine should have Npm (or Yarn) installed to use it locally. 13 | 14 | ## Setup and Installation 15 | 16 | ### Setting up the repository locally 17 | 18 | 1. First fork the repo :fork_and_knife: to your account. 19 | Go to the forked repo and clone it :busts_in_silhouette: to your local machine: 20 | 21 | ```sh 22 | git clone https://github.com/Your_Username/ReactWebsite.git 23 | ``` 24 | 25 | This will make a copy of the code to your local machine. 26 | 27 | 2. Now move to the `ReactWebsite` directory. 28 | 29 | ```sh 30 | cd ReactWebsite 31 | ``` 32 | 33 | 3. Now check the remote of your local code by: 34 | 35 | ```sh 36 | git remote -v 37 | ``` 38 | 39 | The response should look like: 40 | 41 | ```sh 42 | origin https://github.com/Your_Username/ReactWebsite.git (fetch) 43 | origin https://github.com/Your_Username/ReactWebsite.git (push) 44 | ``` 45 | 46 | To add upstream to remote, run: 47 | 48 | ```sh 49 | git remote add upstream https://github.com/AnnadataHackfest/ReactWebsite.git 50 | ``` 51 | 52 | Again run `git remote -v`, the response should look like: 53 | 54 | ```sh 55 | origin https://github.com/Your_Username/ReactWebsite.git (fetch) 56 | origin https://github.com/Your_Username/ReactWebsite.git (push) 57 | upstream https://github.com/AnnadataHackfest/ReactWebsite (fetch) 58 | upstream https://github.com/AnnadataHackfest/ReactWebsite (push) 59 | ``` 60 | 61 | 4. Once the remote is set, install all the necessary dependencies by the following command: 62 | 63 | ```sh 64 | npm install 65 | ``` 66 | 67 | ### Run locally 68 | 69 | Run the below command to start the server: 70 | 71 | ```sh 72 | npm start 73 | ``` 74 | 75 | Go to: [http://localhost:3000](http://localhost:3000) 76 | 77 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 78 | 79 | ## Available Scripts 80 | 81 | In the project directory, you can run: 82 | 83 | ### `npm start` 84 | 85 | Runs the app in the development mode.\ 86 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 87 | 88 | The page will reload if you make edits.\ 89 | You will also see any lint errors in the console. 90 | 91 | ### `npm test` 92 | 93 | Launches the test runner in the interactive watch mode.\ 94 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 95 | 96 | ### `npm build` 97 | 98 | Builds the app for production to the `build` folder.\ 99 | It correctly bundles React in production mode and optimizes the build for the best performance. 100 | 101 | The build is minified and the filenames include the hashes.\ 102 | Your app is ready to be deployed! 103 | 104 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 105 | 106 | ### `npm eject` 107 | 108 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 109 | 110 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 111 | 112 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 113 | 114 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 115 | 116 | ## Learn More 117 | 118 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 119 | 120 | To learn React, check out the [React documentation](https://reactjs.org/). 121 | 122 | ### Code Splitting 123 | 124 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 125 | 126 | ### Analyzing the Bundle Size 127 | 128 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 129 | 130 | ### Making a Progressive Web App 131 | 132 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 133 | 134 | ### Advanced Configuration 135 | 136 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 137 | 138 | ### Deployment 139 | 140 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 141 | 142 | ### `npm build` fails to minify 143 | 144 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 145 | -------------------------------------------------------------------------------- /ReactWebsite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "annadata_website", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.11.4", 7 | "@testing-library/react": "^11.1.0", 8 | "@testing-library/user-event": "^12.1.10", 9 | "axios": "^0.21.0", 10 | "bootstrap": "^4.6.0", 11 | "font-awesome": "^4.7.0", 12 | "mdbreact": "^5.0.2", 13 | "react": "^17.0.1", 14 | "react-bootstrap": "^1.5.2", 15 | "react-dom": "^17.0.1", 16 | "react-redux": "^7.2.1", 17 | "react-responsive-carousel": "^3.2.18", 18 | "react-router-dom": "^5.2.0", 19 | "react-scripts": "4.0.0", 20 | "react-transition-group": "^4.4.1", 21 | "reactstrap": "^8.6.0", 22 | "redux": "^4.0.5", 23 | "redux-thunk": "^2.3.0", 24 | "styled": "^1.0.0", 25 | "styled-components": "^5.2.3", 26 | "uuid": "^8.3.1", 27 | "web-vitals": "^0.2.4" 28 | }, 29 | "scripts": { 30 | "start": "react-scripts start", 31 | "build": "react-scripts build", 32 | "test": "react-scripts test", 33 | "format": "prettier --write .", 34 | "js:fix": "eslint src/ --fix", 35 | "test:js": "eslint src/", 36 | "fix": "npm run format && npm run js:fix && npm run test:js", 37 | "eject": "react-scripts eject" 38 | }, 39 | "proxy": "http://localhost:5000", 40 | "browserslist": { 41 | "production": [ 42 | ">0.2%", 43 | "not dead", 44 | "not op_mini all" 45 | ], 46 | "development": [ 47 | "last 1 chrome version", 48 | "last 1 firefox version", 49 | "last 1 safari version" 50 | ] 51 | }, 52 | "devDependencies": { 53 | "eslint": "^7.25.0", 54 | "eslint-config-prettier": "^6.12.0", 55 | "eslint-config-standard": "^14.1.1", 56 | "eslint-plugin-import": "^2.22.1", 57 | "eslint-plugin-node": "^11.1.0", 58 | "eslint-plugin-prettier": "^3.1.4", 59 | "eslint-plugin-promise": "^4.2.1", 60 | "eslint-plugin-react": "^7.21.2", 61 | "eslint-plugin-standard": "^4.0.1", 62 | "husky": "^4.3.0", 63 | "prettier": "2.2.1" 64 | }, 65 | "husky": { 66 | "hooks": { 67 | "pre-commit": "npm run format && npm run js:fix && npm run test:js" 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ReactWebsite/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/favicon.ico -------------------------------------------------------------------------------- /ReactWebsite/public/img/bee-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/bee-2.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/bee-3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/bee-3.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/bee.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/bee.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/horticulture-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/horticulture-2.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/horticulture-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/horticulture-3.gif -------------------------------------------------------------------------------- /ReactWebsite/public/img/horticulture.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/horticulture.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/husbandry-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/husbandry-2.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/husbandry-3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/husbandry-3.webp -------------------------------------------------------------------------------- /ReactWebsite/public/img/husbandry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/husbandry.png -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-10.png -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-11.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-11.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-12.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-12.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-13.png -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-14.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-14.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-15.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-15.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-16.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-16.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/product-9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/product-9.jpeg -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /ReactWebsite/public/img/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnnadataHackfest/Annadata/fbe7cb3e38bb9e56d1a2efd3202b864e1f77a9e7/ReactWebsite/public/img/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /ReactWebsite/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 15 | 16 | 17 | 26 | 27 | Annadata 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ReactWebsite/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /ReactWebsite/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /ReactWebsite/src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import AppNavbar from './components/AppNavbar'; 3 | import CarouselPage from './components/Carousel'; 4 | import Features from './components/Features'; 5 | import Testimonial from './components/Testimonial'; 6 | import Footer from './components/Footer'; 7 | import About from './components/About'; 8 | import FarmersAskFarmers from './components/FarmersAskFarmers'; 9 | import Infos from './components/Infos'; 10 | import QuestionModal from './components/QuestionModal'; 11 | import Navbar from './components/Navbar'; 12 | import Details from './components/Details'; 13 | import Default from './components/Default'; 14 | import 'bootstrap/dist/css/bootstrap.min.css'; 15 | import Cart from './components/Cart'; 16 | import ProductList from './components/ProductList'; 17 | // import ShoppingList from './components/ShoppingList'; 18 | import { Provider } from 'react-redux'; 19 | import store from './store'; 20 | import { loadUser } from './actions/authActions'; 21 | // import ItemModal from './components/ItemModal'; 22 | import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; 23 | // import Community from './components/Community'; 24 | import Modal from './components/Modal'; 25 | import Soil from './components/Soil'; 26 | import Crop from './components/Crop'; 27 | import Location from './components/Location'; 28 | import Schemes from './components/Schemes'; 29 | import CropSuggest from './components/CropSuggest'; 30 | import ModernFarming from './components/ModernFarming'; 31 | 32 | import SideIncome from './components/SideIncome'; 33 | import Scroll from './components/Scroll'; 34 | import 'font-awesome/css/font-awesome.min.css'; 35 | import './App.css'; 36 | 37 | class App extends React.Component { 38 | componentDidMount() { 39 | store.dispatch(loadUser()); 40 | } 41 | 42 | render() { 43 | return ( 44 | 45 | {/*
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
*/} 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |