Skip to content

precision-sustainable-ag/dst-selector

Repository files navigation

Cover Crop Species Selector Decision Support Tool

Date Created: 8/18/22

Date Last Modified: 05/31/2024

The species selector DST is used to help farmers select a cover crop that fits their goals and constraints. The user can either input specifics about their field location and cover cropping goals or explore cover crops without entering those details. The tool is mainly used to explore expert reccomendations and ratings for cover crops in the farmer's USDA Plant Hardiness Zone. This allows farmers to make educated decisions that are best suited for their specific goals and can save time as opposed to calling the extension office.

Support for this project is brought to us by Agricultural Informatics Lab, NE SARE, USDA NRCS, NECCC, and the Precision Sustainable Agriculture.

To access the live tool, visit covercrop.tools To see development progress, visit http://covercrop.tools

Table of Contents:

Tech stack

  • Single page application made in React.js
  • Ratings and zone info verified via Airtable and then ingested into a PostgreSQL database and served up using a Node.js API

Local Installation Steps

Prerequisites:

  1. Node and NPM Download Here
  2. Git Download Here
  3. A code editor (we recommend vs code) Download Here

Steps:

  1. Open a new Terminal for Mac/Linux or Command Prompt for Windows
  2. Move to the desired folder cd /path/to/folder
  3. Clone this repository into that folder git clone https://github.com/precision-sustainable-ag/dst-selector
  4. From the Terminal/Command Prompt, move into the cloned directory cd dst-selector
  5. Run npm config set '@psa:registry' https://node.bit.cloud
  6. From the same command window, run npm install to install project dependencies. A full list of the dependencies can be found in package.json. If you are running on a windows machine delete package-lock.json prior to running the below command.
  7. Create a file called .env in root directory (dst-selector). The file will contain the below keys. This document is in the git ignore, so it (and your API keys) won't be pushed to the repository. Ask @mikahpinegar for the values of the keys
REACT_APP_GOOGLE_API_KEY="<google key>"
REACT_APP_OPEN_WEATHER_API_KEY="<open weather key>"
REACT_APP_MAPBOX_API_KEY="<mapbox token key>"
REACT_APP_AUTH0_DOMAIN="<auth0 domain>"
REACT_APP_AUTH0_CLIENT_ID="<auth0 client id>"
REACT_APP_AUTH0_AUDIENCE="<auth0 audience>"
REACT_APP_USER_HISTORY_API_URL="<user history url>"
REACT_APP_USER_HISTORY_SCHEMA="<schema>"
  1. After the dependencies have been installed and the .env file has been created, run npm start to run the code locally. If you run into any issues take a look in the Runbook for previous issues and solutions. This will compile the JSX code into Javascript and open up a new browser window with the current version of the covercrops project!

Running in docker:

Run ./start_script.sh Run open http://localhost:3000

Documentation

For in depth documentation see the wiki pages

Runbook

Symptom: Node sass not supported on Mac OS Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (88)

Solution: npm rebuild node-sass

Symptom: After running npm install you might run into an Error E404 - Not Found - GET https://registry.npmjs.org/@psa%2fdst.ui.map - Not found

Solution: Follow these steps:

  1. Install the react-scripts package using npm install react-scripts --save
  2. Run npm start

Line Spacing Set Line spacing (CRLF -> LF) git config core.autocrlf false git rm --cached -r . git reset --hard