Export Raw Data From Graph

CM's Avatar


28 Feb, 2013 04:31 PM

I would like to export the data that is used to generate the graphs. How would i do that? I am interested in logging my card/day and %correct etc. I prefer to have the raw data if possible.

  1. 1 Posted by Soren Bjornstad on 28 Feb, 2013 09:01 PM

    Soren Bjornstad's Avatar

    The collection.anki2 file is a standard SQLite database, so you can extract the necessary information from there using a script. (You can have a look at anki/stats.py in a copy of the source or here if you need to see how a stat is calculated.)

  2. 2 Posted by CM on 01 Mar, 2013 02:11 AM

    CM's Avatar


    Okay - Show how to do convert the cids to actual dates? Or better yet where i can go read up on that would be great. I can read/write the SQL just fine but the other code i am not familiar with.

  3. 3 Posted by Soren Bjornstad on 01 Mar, 2013 02:28 AM

    Soren Bjornstad's Avatar

    The dates are in Unix epoch time, only in milliseconds. I don't believe there is any definitive guide at the moment, but it would be a good idea to create one in the future.

  4. 4 Posted by CM on 01 Mar, 2013 04:34 AM

    CM's Avatar

    Thanks Soren!

    Just for anyone that stumbles upon this. Here is what i was after:

    SELECT date(id/1000, 'unixepoch', 'localtime') , count(*), sum(time)/1000/60, (sum(time)/1000.00/60.00)/count(*)
    FROM revlog
    group by date(id/1000, 'unixepoch', 'localtime')

  5. Support Staff 5 Posted by Damien Elmes on 01 Mar, 2013 06:18 AM

    Damien Elmes's Avatar

    Glad to hear you were able to figure it out!

  6. Damien Elmes closed this discussion on 01 Mar, 2013 06:18 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac