Exporting Cambridge Brain Sciences data

Cambridge Brain Sciences is a nice way to measure brain health. After quick (~10 minutes) tests, it gives you your score in three main areas (Verbal, Reasoning and Memory) and your C-Score, which is “the summary of your cognitive function”. It’s meant not as a semi-static measure (~IQ), but as a “how are you feeling today” kind of thing.

I use it both as a way to track/manage some depression symptoms, and as an objective way to measure how various things influence your mental performance (think exercise/nootropics/sleep/…). I wrote a bit about it and how I use it here.

It’s pretty awesome, but lacks a CSV export, or even just a way to get the data in a readable format, without having to hover on their charts. I wrote them (they are pretty responsive and open to suggestions, by the way) and they said that they will add that as a planned feature. I didn’t want to wait (patience is not one of my virtues) and wanted to start running some analyses on the data I have, but didn’t want to it down manually. Hovering over the data points in their chart to get the individual data points would have been very very tedious.

Looking at the source code (and hoping to find some “data.json” or something similar), I saw that for their charts they use Highchart. After skimming the documentation, I wrote small and extremely basic javascript snippet that would output the dates and datapoints of the currently open chart:

Then, if you need the verbal/memory/reasoning data, just switch to that tab and repeat the process.

For individual tests the process is very similar.

The snippet is the same, but you need to change the “chart” parameter. Switch to the “Tests” page, then right-click on the needed graph, “Inspect element”. You are looking for the data-highcharts-chart parameter:

This is the number you need. Set it in the first line of the snippet (chart=” “) and run.

To work with the data, I pasted it into LibreOffice calc with the following settings.

You need the “Separated by space” and “Merge delimiters”.

That way, it gets outputted to different cells, and you can copy the ones you need. I’m sure Excel can do something similar.

To merge the AM/PM on the other cell, I used the following formula to convert the time:

1

=TIMEVALUE(TEXT(B37,"HH:MM:SS")&C37)

with B37 as cell with the time, and C37 as cell with AM/PM.

I hope I’m not infringing any terms of service, it’s not even scraping — just accessing the data already in the graphs. And I am not doing a tool or Greasemonkey script out of this, because I think that I won’t need to do this often (I add the data manually at the end of each tests if I do them), but if there’s interest, I could do something more “beautiful” and portable — let me know!