tickmate icon indicating copy to clipboard operation
tickmate copied to clipboard

[feature] Graphs And Charts

Open killubear opened this issue 10 years ago • 16 comments

I just grabbed this app while browsing Reddit and i find it awesome for daily use but I was hoping to do so much more with the data. I understand i can export it but it is a hassle to simply view trends. I would love to see Pie charts, scatter plots, timeline graphs and frequency tables all with many variables like frequency based on day of the week, based on month, based on when other ticks are selected or not selected and more.

killubear avatar May 14 '14 20:05 killubear

Yea, this is what is part of the initial idea, too.

I'm not quite sure how to approach it, though, there are two possibilites:

  1. Display all the charts inside the App.
  2. Send the data to a server (if requested by the user), which will then generate a fancy webpage with all the statistics you can dream of. This page will have a link that you can share but is private if you don't.

I'm in favor of 2) but I would like to find a way to send the data to the server without needing total android internet permission. So far I haven't found a slick way.

What do you think?

lordi avatar May 16 '14 07:05 lordi

This is related to #17

lordi avatar May 16 '14 07:05 lordi

I myself am actually siding with the first option. What i imagine is an interface that allows (with the use of drop down menus) for the user to select what belongs in the Y axis and what belongs in the X axis (for charts obviously) and then select chart type.

An example would be like in the Y axis option I could choose any one of my tick categories or multiple tick categories. In the X axis i would be given options such as Months, days of the week, or daily timeline. It would then generate a scatter plot for a timeline Y axis and a bar graph for the month/day of week Y Axis. Another tab may contain pie chart visualization. I would select what ticks to include and then set the time span to graph and that would result in the pie chart. For future development adding options such as allowing the user to designate colors or the choice to connect the scatter plots with lines or not could be nice.

I hope this helps. I work in usability so if you would like any help in this area please don't hesitate to ask.

killubear avatar May 16 '14 17:05 killubear

I am also a daily tickmate user, and find it great. I have been thinking a bit about what I would actually like to know from my tickmate tracks and the statistics which I think would be most useful for me would be centred around probability and the influence of one or multiple tracks on one other.

A simple probability calculated for each track, based on the previous records would be quite nice. What is the probability of me smoking today based on the tracks for my previous days. I think that could serve as a good motivator combined with the current year, month, week overview. The probability estimate could then be build up via a click interface to include more or less tracks. What is the probability for me to smoke and drink today.. I think that could be interesting to know :-)

Alternatively and more powerful a logistic model could be build where the importance of other tracks (meditation, exercise) are tested towards an outcome (drinking alcohol). If this could be made in a way were tracks could be include/exclude into the model and an instant summary outputted which states the effect of the current included tracks on the dependent variable, then I think that would be quite a powerful little tool to understand the relation between your habits better. I think keeping it all in the pocket within the app would be the coolest, if that is possible.

I know how to build and test simple models like that using the R statistical language and was thinking to make a small script for something like that for my own tracks via exported data but have not had time to sit and work with it yet. But if such mechanisms could be implemented directly in tickmate that would off course be much better and very cool.

I am happy to help how I can.

hilge avatar May 21 '14 12:05 hilge

Could you prototype some R scripts for the kind of data-input that is provided by Tickmate? I can then see if I can implement something along the lines in Java, or in a web interface. I like your thoughts and must say that I had similar things in mind when I created Tickmate. I would be happy if a more advanced analysis of ticks is be part of the app. However, I'm traveling and will only have time in a few weeks to work on Tickmate. Maybe you can hack together some R scripts in that time :-)

lordi avatar May 25 '14 20:05 lordi

I will be happy to try and prototype some R scripts. But I am currently finishing up my Ph.D which I have to hand in, in two months from now. It takes up all of my awaking hours, so I am a bit preoccupied until after that. I will follow your project and if it is still relevant when my thesis is out of the way I am more than happy to jump on it.

hilge avatar May 26 '14 13:05 hilge

I like the idea of a tickmate server

Unfortunately I do not know how to start an open source Project

With the help of a friend I made a hack to upload and display the data with a php server

I upload the database, I generated out of the backup by importing and exporting it with aSQLiteManager ( https://f-droid.org/wiki/page/dk.andsen.asqlitemanager ) Upload acript: https://gist.github.com/aberlin/3415fa4daff70a9b6344 Display script: https://gist.github.com/aberlin/5378550157fbaaaae131 I think with easy frontend frameworks( http://www.chartjs.org/) the idea should be quick work with high impact I hope this helps

aberlin avatar Aug 16 '15 16:08 aberlin

Nice! On github, starting an open source project is just one click away :)

I plan to do a server component in Python, as powerful analysis libraries exist there.

In fact, I was fooling around with some visualization using Python/Pandas this evening: https://github.com/lordi/tickmate/tree/master/analysis

One problem remains tho: I don't wanna give Tickmate the "INTERNET" permission required for uploading/sharing data. At least not until Android M, when runtime permissions are introduced.

lordi avatar Aug 16 '15 21:08 lordi

  • Thanks for the fast answer. Regarding the problem with the permissions I could think of some possible solutions : 1 ) giving the permissions anyway ( there seem to be security reasons, which I don't understand) 2 ) share the data with a separate app. 3 )as a fix share with the server by using some kind of upload page
  • More Ideas in this Topic: 1 ) PHP could be easier to set-up for hosting 2 ) I could help with the web stuff. I have no experience with apps, but i like the Idea of s fancy webpage :+1:

aberlin avatar Aug 17 '15 02:08 aberlin

  1. With INTERNET permission, the app could in principle send user data without their knowledge. As some of my friends also use Tickmate, they are moderately concerned that I don't see their possibly private ticks :-)
  2. Yep, I thought about it, but then again its not straight-forward to access data from other apps on Android.
  3. The upload page sounds like a good idea. It could work as a workaround until the runtime permissions appear. After that, the same upload mechanism can be used within the app.

However, I don't really like PHP and I'm fairly comfortable with Python and Web stuff myself, so I think I'll stick with that. Also I got a server, so hosting restrictions aren't a problem. But yea, thanks for offering your help. If you want, you can write me an email with the ideas that you have for the web interface and we can see what can be realized and how.

lordi avatar Aug 17 '15 12:08 lordi

Hi! Brand new user, and I love your app! It literally features all my 'want' list with almost no other bloat! Outstanding! The only thing that is missing is an easy "export csv" function, which is perhaps slightly different than "backup database"...

As soon as you export CSV, some aps let you share that with other apps... not sure if that requires internet or other permissions?

Anyway, I'm also an R guy and I do want to aggregate this with other information for hypothesis testing... my personal opinion is that you provide enough stats as is, no need to go further... but for users that want to go crazy, they are able to using the csv export. Ideally a scheduled csv dump in a predefined location (for example a dropbox folder). What do you think?

DataStrategist avatar Aug 17 '17 11:08 DataStrategist

I think scheduled exports (or backups) are a great idea.

On CSV: I probably won't find time to program that feature myself, but I certainly would accept a PR about that. Having said that, I'm pretty sure you can open the backup database with R, it is just an sqlite DB.

Apps on Android without special permissions can not access other places on the phone, nor the Internet. But I've planned a export option that would only require a "runtime internet permission". So far unfortunately my time is limited.

lordi avatar Aug 17 '17 19:08 lordi

Here is an example of how to read data in to R from the sqlite DB.

## Read database file - load ticks and tracks tables
filename <- "~/documents/data/Tickmate/tickmate-backup-20170115.db"
library('RSQLite') # FIX autoinstall
library('reshape2') # FIX autoinstall

sqlite.driver <- dbDriver("SQLite")
connection <- dbConnect(sqlite.driver, dbname = filename)

## Test that tables exists and load
if(!all(c("ticks","tracks") %in% dbListTables(connection))){
    warning("Could not find ticks and tracks tables
                 - check database file!")
}else{
    message("Loading ticks and tracks tables")
    ticks <- dbReadTable(connection, "ticks", row.names = NULL)
    tracks <- dbReadTable(connection, "tracks", row.names = NULL)
}

## Update date - Add 1 to all month since counting starts at 0
ticks[,"date"] <- as.Date(paste(ticks$day, ticks$month+1, ticks$year), format = "%d %m %Y")

## Converte table to single row pr. date with counts of ticks
## The dcast function from the reshape package list pr date the length of all track_ids
wide.data <- dcast(ticks, formula=date ~ X_track_id, length, value.var = "date")

hilge avatar Aug 18 '17 09:08 hilge

Thanks hilge that's useful. But how do you get the db to an R session? yes you could connect your phone via USB and extract the db manually but I think the ad hoc internet access would be much better... also safer for backup purposes in case of loss or theft of phone.

DataStrategist avatar Aug 18 '17 10:08 DataStrategist

Sure scheduled export to somewhere accessble would be super usefull, I agree, but for now the old school transfere is how I do it.

hilge avatar Aug 18 '17 10:08 hilge

if you don't mind me asking , what analysis are you doing with your tracks? I thought about using xenobase, but much better to just do it myself.

DataStrategist avatar Aug 18 '17 11:08 DataStrategist