This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This change adds a new view to the database
environmental_data_point
calledall_vars
.It also changes the behaviour of the csv exporter (csv list func) to stop exporting desired variable datapoints. I consider this a bug fix but maybe someone thought that was a feature when they implemented it.
Motivation/Details
For the fermentabot we want to have CSV exports to get the fermentation data out from the bot.
The openag_ui has a feature for this, enabled through the couchdb list functions. However, the current implementation is only able to export CSV files for individual environmental_variables from a subset of all environmental_variables declared in openag_ui/openag-config.json. The list function will run over
start_key
~end_key
documents in theby_variable
view. This isn't ideal if you want multiple variables.We want a way to export multiple variables, so I've added a new view which will filter out only variables that we want. These are hardcoded into the view map function. This view wouldn't be necessary if all environmental variables were useful pieces of information but that's not the case so we have to make this view.
Alternatives
Drawbacks
This hardcodes the variable names of what we think is "relevant" in the view function, which is kind of nasty. It requires the least changes and shouldn't break anything else though, so it is the most elegant option given time constraints for me right now.