powerplant:development_log

This is an old revision of the document!


Companion Planting Development Log

Garden Planner A non-open source, paid desktop/iOS app for hand-designing a garden and planning your crops. Has a very nice looking calendar.

List of companion plants Wikipedia's list of companion plants. Quite comprehensive, covers some things not in the database yet. Even if you don't want to trust a wikipedia article, it still has links to 50+ useful sources.

Companion Plant Spacing Research done by Kentucky State University on the spacing of intermixed companion plants in a hexagonal formation. The gist is that the spacing is a weighted average of the recommended spacing of the two crops based on the proportions of the crops.

Paper by M.K. Bomford Further development on the KYSU research above. Has a few key conclusions, including:

  • Results suggest that mixed planting can increase land-use efficiency of BIA systems under resource-limiting conditions.
  • Cool-season crops should not be mixed with warm-season crops for synchronous growth in mixed plantings.

Crop Planning Open-source Java program to plan crops. Not too well-designed or easily usable. Does not appear to have any data on time until harvest, or take conditions into account, or include any companion crop information. However, it's open-source, so it could theoretically be expanded. At first glance it does not seem like a great base upon which to expand.

Another Crop Planner Also open-source, this time a single page application. Angular front, Spring framework Java back end. Claims to offer advice on companion planting, harvesting dates! No longer hosted online, and I haven't yet tried hosting locally, but it is definitely worth checking out if it does indeed do what it claims to. A single page application could be a good format for the companion planner due to its cross-platform compatibility. Also has 970 commits by a single person so a lot of work has gone into it. Also means it's very complex, so more time spent learning someone else's code/system.

Yet Another Crop Planner Open-source planting calendar, this time using Meteor.js. Much more simple, but maybe this means easier to build upon. No companion features but they could be created. Have not tested yet either.

The ticket #959 is the information base for the specification. Its written in a markup language not compatible with this wiki. Redmine is used to track the tasks around the development so it makes more sense to make this location the primary datasource. To make your contributions usable, write in the ticket or use redmine markup in the CODE text. Copy it over from the redmine everytime its updated there:

Work together on this Spec on: https://pad.riseup.net/p/emnTrqLdXzqy
When finished change Ticket: https://work.ecohackerfarm.org/issues/959 and wiki: 

[[wiki|Back To Overview]]

{{>toc}}

h1. Software Requirement Specification

for "powerplant"/ pp_ / ...
Version <0.13>

h1. Introduction

powerplant is a software that allows anyone planning a garden to utilize companion planting and other permaculture practices. It provides intelligent suggestions to help the gardener by advising the best planting schedules and combinations of crops to maximize the garden's yield.

h1. Users

* Gardeners, including anyone who wants to plan a garden and is happy to use open source software.
** Hobbyist - small home garden. 20 m2
** Countryside garden - 250 - 1000 m2
** Organic farmer - 1000 m2 +
** Consultant - all of the above
** Anyone who wants to plan a garden by using companion planting.
** People who want to use open source/ open data software.

More detail below.

h1. Goal

The goal of powerplant is to help users effectively plan their garden by providing planning and maintenance suggestions which utilize permaculture principles with a focus on companion planting.
 
h2. Product Scope

> Provide a short description of the software being specified and its purpose, including relevant benefits, objectives and goals. 

h3. Software description

* Offer fast and easy solution for knowing which crops (bene)fit together
* Provide an easy to follow schedule for planting, transplanting, and harvesting
* Provide information about the crops themselves
* Push and pull crop information to/from several open data platforms
* User can submit changes to improve data
* Open-source/open-data

> TODO: write more and better text

h3. Objectives

* Improve planning process for anyone who wants to use permaculture principles in their gardening.
* Save time during the planning process for anyone who wants to use permaculture principles in their gardening.
* Education of users
* Improve and collect data in open databases
* Increase harvest yield
* Connect with other open source projects for mutual benefit

h1. Overall Description

<pre>
                            +-----------------------+
                            |  OpenFarm.cc API      |
                            +-----------+-----------+
                                        ^
                                        |
                                        |
                                        |
                                        v
+-------------+                    +----+-----------------+             +----------------+
| Front End   +<------------------>+    Back End          +<----------->+ powerplant DB  |
+-------------+                    +----+-----------------+             +----------------+
                                        ^  
                                        |   
                                        |   
                                        |   
                                        |   
                                        v   
                            +--------------+--------+
                            |  FarmOS API           |
                            +-----------------------+
</pre>


h2. Product Perspective

Our vision is that people are able to plan their own gardens using companion planting and other permacultures practices using our app as a central resource for information. The resources we can provide to the user will grow as the app is used more.

h2. Context

The information that we provide is all out there, we want to provide a central source for all of it. Aid those gardening without experience and help make quick and precise descision for the more experienced gardener.

h2. Origin

Permaculture guidelines, gardening best practices.

The permaculture ideals are:

* Care for the earth
* Care for the people
* Fair share

Open Source/ Open Data.

h3. Outcome

A year of use of this software will result in:

* Users adding to data from all over the world (different climates, soil types)
* Maybe make some money for affiliate links (seeds, supplies) or donations
* Users plan garden and fields with our software
* Users are better educated about gardening and permaculture
* Enhance other open source projects with valuable information
* More development on powerplant resulting in better software
** especially including more OS/OD enthusiasts
** building up networks with different OS/OD projects
 
h2. Product Functionality 

> 1 TODO: Add major functions that the product must perform or must let the user perform.

h3. Must Have

* Select different guides
* Offline and online user experience
* Suggestions for existing beds
* Mark a bed as full or not
* Notifications from schedule
* Tasks and actions
* Schedule

* user can signup/ login or decide to use with local storage only
* user can create an account from garden data they've already entered
* user can create beds
* user can create gardens

* Need a list of available plants (internal)
* Need to be able to see compatible/incompatible plants (internal)
* Need to be able to filter by compatibility with multiple plants (internal)
* Find optimal planting schedule for a target bed (with at least one user picked crop)


h3. Should Have

* When offline:
** Get suggestions for where to plant crops
*** TODO: Figure out if this is possible offline.
*** Only for plants currently in local memory (eg that are already in beds). More plants is then just disabled.
* If we get the data, notify the user of maintenance tasks include watering, weeding, pruning, etc.
* Suggest plants based on distance between plants
* List suggestions for following plants for harvested beds
* Sharing/collaboration between users about a specific garden using shareable link
* Add a crop entry
** fill out form
** should be validated
* validation of other users data for a specific climate (proofread, rate, comment, improve)
** flag trolls/...
* Keep track of nitrogen fixers/consumers in each bed over time
* Save edit history for OpenFarm data
* permaculture zones:
** a garden can have zones
** suggestions based on zones
*** plant zone is dependent on how much attention they need/how often you harvest
**** TODO: think about this, how to figure that out

h3. Cool to Have

* Include types of beds required for a crop
* Get revenue from links for more information.
* Plant pictures
* Print Shopping List
* modify the same garden by multiple users at the same time
* Have some visualization of garden beds with plants
* Draw in current crops
* Gamification
** Levels/badges for users
*** Contributor
*** Expert farmer
*** etc.

> TODO: Figure out where these attributes belong: Soil conditions, grow time, climate, sun direction relative to each bed, labor required for each plant, sun+water required, best season/time to plant, care frequency, nitrogen/ consumption

h3. Minimal Viable Project

* The User should be able to select a minimum of two plants and the app will produce a result to list of plants in groups that are compatible with each other.
* It should only list small groups that are not contained in a bigger group
** Example: {Nasturium, Potato, Onion} = {Nasturium, Potato}, {Onion} != {Nasturium, Potato}, {Onion}, {Potato}, {Nasturium}
* Search by Common english name or binoial name in the same field
** If crop not found it should tell: "Plant not yet in the database or you wrote the name wrong :) - or you can try again using the binomial name"
* This should represent the function of creating multiple beds from a list of seeds/plants you want to plant
* TODO
** Backend: Import plant data from PFAF database, import basic plant relationship data (firebase), create HTTP API call to get compatible groups from a big group of plants.

h3. Detailed function description.

h4. Select different Guides

User should choose between different guides (from openfarm.cc) for a crop that fits their needs
* When adding a crop to a bed, users have the option of selecting a guide available from openfarm
* Users can view the guide for a crop at any time from the crop details page
* Guides can be removed, added or changed to a crop in crop view (only one guide per crop)

h4. Offline and Online user experience

NEARLY the same UX (user experience) both offline and online! This is really important because people will need to use on mobile in their garden
* Things a user will most likely want to do while offline. Use command pattern for the actions and queue them up. They sync when the phone/browser has network connection again. This also allows undo's.
** Add a new bed
** Add existing crops to that bed
** Change the status of a crop
** Change status of a task
** Switch to any other bed in their garden
** View a guide/information for a crop

h4. Suggestions

* Provide suggestions for adding specific crops to existing beds
** User can ask for crop suggestions when adding crops to a garden or bed
* Provide suggestions for adding specific crops to a specific bed
** User can also ask for suggestions for crops to add to a specific bed
* Must have at least one user-selected crop to provide suggestions


h4. Notifications

Notify users of tasks that should be done for each garden/bed/crop on a given day
* Email notifications
** should be opt out by default
** include weekly summary of upcoming tasks

* Push notifications
** Need to be enabled in browser (would only work on desktop)
** include events happening on the current day

h4. Tasks and Actions

* Right now, this would include planting, transplanting, and harvesting - only the major events
* Users can add custom tasks from a predefined set of actions (or "other")
** Tasks are associated with a location, bed, or crop
** Repeatable tasks
* Mark tasks as complete, or postpone or ignore them

h4. Schedule

Find optimal planting schedule for a target bed (with at least one user picked crop)
* When adding a crop, users can get suggestions for when to plant it based on the duration of growth
* Goal is to maximize the overall yield and allow for consistent harvest throughout the year

Information accessible on timeline of different stages and locations of growth (i.e. when to grow in greenhouse and transplant them outside)

* Users can view the schedule for a location or bed as a chart
* Growth periods are shaded in bars, single events are represented as lines
* Should allow the user to see, at a quick glance, what is growing and when things can be harvested
** Also be able to identify gaps in the schedule which could be filled
* Should also show information about compatibility interactions
** Needs to be intuitive and simple to understand, obvious from one look at the schedule

h4. User Contributions

Users can contribute in the form of editing existing cropinformation, croprelationship, and guides.

Creating Guides should link into OpenFarm directly - Create Guide.
* pro: less work for developer
* contra: might be confusing for the user
Editing Guides should be put into powerplant "centralized improved guide" (except it is your own guide?). This avoids parallel versions of the same guide edited by different users, and instead puts all the edits in one place.
Editing Cropinformation should be edited in OpenFarm directly.
Croprelation should be changed in the app and put into OpenFarm.

h3. Terminology


Location: Group of gardens whose permaculture zones are defined relative to a common zone 0
Garden: combination of beds in the same vicinity and permaculture zone
Bed: Section in a garden (can be a greenhouse, a pot or a patch of soil)
Crop: Specific instance of a crop that will be planted in a bed
Transplant: action of moving a crop from a pot (non-bed) to a bed
Zone/Permaculture Zone: Ordered area from 0 to 5 by frequency of visits/maintance requirement (/often also related to proximity)

h3. 2. Provide a Data Flow Diagram of the system to show how these functions relate to each other.

Data flow diagram for cropinformation/croprelationship data (from openfarm)

<pre>
                                                                                                    
            ```````````                           `...`                                             
          `.           .`                       `.`   `.`                                           
         ``             ``                    ```       `.`                                         
         .               .                  ```-Openfarm-..`                                       
    -````. User Interface .``````Send.```>`./.` registered?- `.```````no`````````````-              
    .    .               .                   `....-........`                         .              
    .     .`            .                      `.`     `.`                           .              
    .      +.`       ```                         `.` `.`                             .              
    .      ^  ``/|\``                              `-`                               .              
    .      .     :                                  .                                .              
    .      .     .                                  .                                .              
    .      .     .                                  .                                .              
    .      .     .                                  .                                .              
Request    .     .                                  .                                .              
    .      .     .                                 yes                               .              
    .      .     .                                  .                       `````````+.`````````    
    .      .     .````````````````````````````````  .``                    .```````````````````.    
    .    .``        Response to request          .    `.                   .                   .    
    . `Response                                  .    `.                   . no action allowed .    
    . .to Request                                .    `.                   .  `` ````` ``````` .    
    . .-`------                                  .    `.                   .                   -    
    .    ^                                       .    `.                   `````````````````````    
    .    .                                       .    `.                                            
    .    .                                       .    `.                                            
    .    .                                       -    \/                                            
    .    .                                   `````````.-                                            
    .    -`````````                       ```        `-:                                            
    .   ..        `.                     .`             .                                           
    .  .``Openfarm` .                   `. Power plant   .                                          
    .>/- `Database` .:<`````Send ```````-  Backend    `  .                                          
       .` ---:::--` .                   `.   .------:    .                                          
        .`        `.                     .`             .                                           
          `````````                       `.`         .`                                            
                                            ``````````                                              
                                                                                                    
                                                                                                   
</pre>

h2. Users and Characteristics

h3.  Identify the various users that you anticipate will use this product.

* Hobbyist - small home garden. 20 m2
* Countryside garden - 250 - 1000 m2
* Organic farmer - 1000 m2 +
* Consultant - all of the above
* Anyone who wants to plan a garden by using companion planting.
* People who want to use open source/ open data software.

h3. Describe the relevant and important characteristics of each user.

* All users: consistent harvest throughout the year
* Hobbyist - Not too much labor is better; organic/natural garden
* Countryside garden - Same as Hobbyist, also wants to be self-sufficient
* Organic farmer - Same as Hobbyist, also prioritizing lower labor. Intermixed plants means more labor. Technologically literate, want to use software to improve their yields
* Consultant - Provide advice to other hobbyists/gardeners/farmers
 
h2. Operating Environment

> Describe the environment in which the software will operate, including the hardware platform, operating system and versions, and any other software components or applications with which it must peacefully coexist. In this part, make sure to include a simple diagram that shows the major components of the overall system, subsystem interconnections, and external interface

* Lower range laptop
* Windows 10, Chrome, use in office or garden
* Android x.x.x, Chrome, use in office or garden, but mainly garden
* With temporary internet connection

h2. Design and Implementation Constraints

> Describe any items or issues that will limit the options available to the developers. These might include:
> * hardware limitations (timing requirements, memory requirements)
> * interfaces to other applications
> * specific technologies
> * tools
> * databases to be used
> * language requirements
> * User Documentation

* React for front end with JSX to generate HTML
* SASS for css
* Need to eventually be compatible with FarmOS.
* Need to eventually be compatible with Openfarm.cc.
* Want to be similar to Openfarm crop database structure.
* Want tasks to be similar to FarmOS Log data structure
* Text + photo editors.
* NodeJS as backend engine running ES6
** MongoDB for database with Mongoose as ODM
** Express for route handling
** Passport for user authentication
** Mocha + Chai + supertest for unit testing and integration testing
* Mobile-first, offline-first design (ok, maybe mobile-first, offline-second. they can't both be first)

h2. User Documentation

> TO DO: Describe what kind of manuals and what kind of help is needed for the software you will be developing.
List the user documentation components (such as user manuals, on-line help, and tutorials) that will be delivered along with the software.//

Need to have user documentation. Usability will be severly limited without. Need to have in depth descriptions of how to input data, what screens should look like, how to interpret output. Need to document things before creating them.

* User manual
* FAQ
* First time user prompts
* Community talking points
* Chat rooms (like FarmOS)
* Tutorials for most exemplary tasks (Videos, ...)

h1. Specific Requirements

h2. External Interface Requirements

> TO DO: Describe user interfaces, different screen images, any GUI standards, standard buttons and functions (e.g., Cancel) that will be available to the user. Define error message display standards.

h3. GUI standards

https://material.io/guidelines/
https://medium.com/@marcintreder/the-minimum-viable-design-system-75ca1806848a

* Lots of rounded rectangles to contain components
* Font size standards based on Marvel prototype (maybe change to be based on screen size in the future)
** Main page title: 26pt
** Subtitle: 18pt
** Body text: 14pt
* Sidebar menu accessible from any screen which shows the current location and allows jumping to any screen above it in the hierarchy (All Gardens -> Garden Dashboard -> Bed Dashboard -> Crop)
* Gardens and Beds contain 3 subscreens (fragments?)
** Dashboard, Beds/Crops, Schedule
** Dashboard shows relevant tasks
** Beds/Crops shows all Beds/Crops contained within the Garden/Bed
** Schedule shows history of all past, present, and future crops for the Garden/Bed
* Any time there is a title/heading of an element containing a Garden, Bed, or Crop, it will have a small drop down menu next to it
** Menu items: Edit, delete
** This is the main mechanism by which user can change settings/status of a specific Garden, Bed, or Crop

h3. View Description

"View the prototype! (INCOMPLETE)":https://marvelapp.com/94c4bh4
If you want to improve it contact franz@ecohackerfarm.org to get an invite.

> TODO: add many many more more more more views

h3. Hardware Interfaces

> Describe the logical and physical characteristics of each interface between the software product and the hardware components of the system. This may include, the supported device types, the nature of the data and control interactions between the software and the hardware.

  * 800x400 display
  * 100kB/s
  * 200mb memory on mobile
  * 512mb memory on non-mobile
  * 5mb local storage

h3. Software Interfaces

> TO DO:  Describe: the connections between the product and other specific software components (name and version),  databases,  operating systems (Windows? Linux? Etc…), tools, libraries and integrated commercial components. 

* FarmOS
** FarmOS users can provide the url of their server and save/load all of their data BESIDES crop guides and crop information from there
** There will have to be a moderate amount of translation between powerplant data format and FarmOS data format
** Rather than building a seperate FarmOS module, we will make our web app compatible with FarmOS
** A FarmOS module could be possible, but requires much more time and expertise than it is worth at the moment
* Openfarm.cc
** Openfarm stores CropRelationships, Crop Guides, and Crop Information
** Powerplant users can choose to register their accounts with Openfarm as well
** Users who do this will be able to save/modify this data
** All users (registered or not), while load this data from Openfarm

> TO DO: Identify data items or messages coming into the system and going out and describe the purpose of each. 

* FarmOS specs go here
* openfarm.cc specs go here

> TO DO: Describe the services needed. 

> TO DO: Identify data that will be shared across software components.

* need to look at what FarmOS stores and what we store
 figure out what we can store in FarmOS


h3. Communications Interfaces

TO DO:

1. Describe the requirements associated with any communication functions required by this product, including e-mail, web browser, network server communications protocols, electronic forms. 
2. Define any pertinent message formatting. 

h2. communication standards that will be used, such as FTP or HTTP. 

REST

"Auto-generated API specs":https://github.com/Ecohackerfarm/powerplant/blob/master/docs/spec.md

API error messages have the following format:
    <pre>
    {
        status: Number,
        message: (optional) String,
        errors: (optional) {
            fieldName1: String,
            ...
        }
    }
    </pre>

@status@: HTTP status code
@errors@: Object containing error messages pertinent to specific UI elements, e.g. a login request with an incorrect password would result in @{password: "Incorrect password"}@
@message@: A general description of the error, which can be displayed to the user

h4. communication security or encryption issues, data transfer rates, and synchronization mechanisms.

  * Profile could have sensitive info
  * Even in case of (locally) illegal crops being grown, info cannot be accessible by anyone
  * Yield is sensitive
  * Complete transparency within network of gardeners, zero transparency outside
  * low bandwidth because garden usually has bad reception (GPRS traffic)
  * Sync profile data between local and server


h2. Behavior Requirements

h3. Use Case View

> TO DO: Provide a use case diagram which will encapsulate the entire system and all possible actors.

"Workflow Diagram":https://github.com/Ecohackerfarm/powerplant/blob/master/docs/Powerplant%20Workflow.svg

h3. List of Use case
 * a user has an empty garden, and they want to know what they should plant
 * a user has a non-empty garden, and they want to know what they should add to it
 * user wants to track their garden's progress/crops planted
 * user has some data they want to contribute
 * cool to have
 ** user wants to manage a garden with multiple people working on it
> TODO: Add more use cases

h3. Diagram
> TODO: Create use case diagrams involving each of the possible types of users


General TODO:
    Convince openfarm to enhance companionship model or find a suitable ruby on rails developer
    
Diagrams: https://drive.google.com/file/d/0BwEWI1CO-iYrWnhPV2xJRjZtUkU/view?usp=sharing
  • powerplant/development_log.1508186197.txt.gz
  • Last modified: 2017/10/16 22:36
  • by ecohack