Agri-Guide-API

April 22, 2021 ยท View on GitHub

forthebadge made-with-python

GitHub contributors Website shields.io Maintenance

Agri-Guide-API

This is the API used for the project Agri Guide. The driver code is present inside app.py and the routes are present inside the folder routes/. The endpoints are listed below:

API Endpoints -

General Endpoints

1. Get States

https://agri-guide-api.herokuapp.com/get_states

JSON Output containing all the states available in the repository with its unique ID

2. Get districts for a state

https://agri-guide-api.herokuapp.com/get_dists

Params:

ParameterDescriptionFormat
state_idstate ID whose districts are requiredstate_id

JSON Output containing all the districts available in the repository with a unique state ID.

3. Get state name for state ID

https://agri-guide-api.herokuapp.com/get_state_value

Params:

ParameterDescriptionFormat
state_idList of state IDs separated by a commastate_id1, state_id2

This API endpoint would take list of state IDs to be processed and returns a list of state names.

4. Get district name for district ID

https://agri-guide-api.herokuapp.com/get_dist_value

Params:

ParameterDescriptionFormat
dist_idList of district IDs separated by a commadist_id1, dist_id2

This API endpoint would take list of district IDs to be processed and returns a list of district names.

5. Get Crops

https://agri-guide-api.herokuapp.com/get_crops

Params:

ParameterDescriptionFormat
stateThe state name in lower case is passedstate
distThe district name in lower case is passeddist

Get list of crops that grow in a district in JSON format. It would return an ID and a name for every crop.

6. Get seasons

https://agri-guide-api.herokuapp.com/get_seasons

Params:

ParameterDescriptionFormat
stateThe state name in lower case is passedstate
distThe district name in lower case is passeddist
cropCrop ID which grows in the regioncrop_id

Get list of seasons that a crop is grown in a district in JSON format.

Prediction Endpoints

1. Weather Prediction

https://agri-guide-api.herokuapp.com/weather

Params:

ParameterDescriptionFormat
stateThe state name in lower case is passedstate
distThe district name in lower case is passeddist

Predict the weather for the particular district and return the next year's monthly rainfall, temperature and humidity as a JSON output.

2. Yield Prediction

https://agri-guide-api.herokuapp.com/yield

Params:

ParameterDescriptionFormat
stateThe state name in lower case is passedstate
distThe district name in lower case is passeddist
cropCrop ID which grows in the regioncrop_id
seasonThe season in which the crop is to be grownseason

Predict the crop yield for a particular crop grown in the required season in the district and return the output as a JSON.

Data Download Endpoints

1. Weather files downloads

https://agri-guide-api.herokuapp.com/weather/downloads

Params:

ParameterDescriptionFormat
statesList of states separated by a commastate1, state2
distsList of districts separated by a commadist1, dist2
yearsStart year and end year separated by a commastart, end
paramsParameters required in downloads separated by a commatemp, rainfall, humidity

Give proper filters to get the downloads in a zip file containing the CSV files for given parameters.

2. All files downloads

https://agri-guide-api.herokuapp.com/agri_guide/downloads

Params:

ParameterDescriptionFormat
statesList of states separated by a commastate1, state2
distsList of districts separated by a commadist1, dist2
yearsStart year and end year separated by a commastart, end
paramsParameters required in downloads separated by a commatemp, rainfall, humidity, yield

Give proper filters to get the downloads in a zip file containing the CSV files for given parameters.

Statistics

1. Weather statistics

https://agri-guide-api.herokuapp.com/statistics_data

Params:

ParameterDescriptionFormat
stateThe state name in lower case is passedstate
distThe district name in lower case is passeddist

Return statistics of yearly data for the district in a JSON format.

2. Yield Statistics

https://agri-guide-api.herokuapp.com/yield-statistics

Params:

ParameterDescriptionFormat
stateThe state name in lower case is passedstate
distThe district name in lower case is passeddist
cropCrop ID which grows in the regioncrop_id
seasonThe season in which the crop is to be grownseason

Return yield statistics of yearly data for the district in a JSON format.