Rymapt / ethoscope

a platform from monitoring animal behaviour in real time from a raspberry pi
http://gilestrolab.github.io/ethoscope/
GNU General Public License v3.0
0 stars 2 forks source link

Add SQLite download #46

Closed mark-grimes closed 7 years ago

mark-grimes commented 7 years ago

Currently the option to download results as tab separated data doesn't include any conditions data. This pull request adds a radio button selection to the download modal to select either tab separated data or an SQLite file.

I didn't use the existing classes for converting from MySQL to SQLite (as used in the database backup service that runs on the stand alone node) because that selectively copies data, and hence doesn't include the conditions either. I used the SQLAlchemy library to do all of the heavy lifting and copy whatever is in the database. This means any extra tables added by further development will also be included. It does have the downside of creating much larger files though, because even the image snapshots are currently saved. If that gets to be a problem we could include an option to skip certain tables.

There is a script with tests but it's currently awful. I need to create some dummy data files so that we can write some proper tests.

If you apply this pull request to a running device, only the ethoscope_node service needs to be restarted.

mark-grimes commented 7 years ago

Added option to leave out the image snapshots to save on disk space. As an example, after running for ~27 hours

Condition File size
with image snapshots 12 Mb
without image snapshots 259 Kb

N.B. There was almost no movement in this period so realistic results will be much larger.

mark-grimes commented 7 years ago

There have been no negative comments and I've had it running for awhile, so I'll merge.