The Quantified Self community is a group of people who track and analyze their lives to gain insight, most often to aid in decision making towards achieving goals -- think counting calories to lose weight. Data from multiple sources can lead to even greater insight.
While platforms for aggregating personal data exist, two limiting factors arise: 1.) The platform takes charge of the analytics and, due to human resource limitations, can only offer a narrow scope of "one-size-fits-all" analyses; or 2.) the platform outsources the analytics to a community of developers, BUT gives them the personal data, reducing privacy and increasing risk for the user.
The entire process of developing, testing, and publishing a "Hello, world" Connectrix app is detailed in the Developer Guide. But in general, a developer creates a new app by simply specifying a name and description, selecting the connections required for the app, and pointing Connectrix to a public Github repository where the application is to be stored.
You may be wondering how a developer can test such a program with only a guess of what the user's data will look like. Essentially, they use their own data and test locally on their machine. Having specified the required data connections, they can click a "View JSON" button to see their own actual data received from the APIs in the format that will be fed to their app. Further, Connectrix provides a test engine to test their app locally. After downloading the test engine (a Node.js app), they copy and paste their example JSON into a view.json file and the engine will run their program with their data in the same way that Connectrix would run their program in the online environment. Output is written to an HTML file that the developer can open in a browser to see exactly what the app will look like. When they're done testing, they publish the app by simply pushing the files to their Github repository.
However, it is a bit more complex than that; the logic can be thought of as being two levels deep. The top level compiles Data Getters by third party API provider (Fitbit, Moves, YouTube), and the lower level compiles Data Getters by third party API endpoint (Fitbit - Body Weight Time Series, Fitbit - Calories Burned, etc.). This is to account for error handling at the lower level. For instance, if a request is made to the Fitbit API but the access token used had been expired, the error is caught and handled at the Fitbit level (reading the error in the Fitbit response, refreshing the access token according to Fitbit standards, storing it to the database). Then the API call for data is made again recursively (within limits) in the error handler. This way, each provider may use and reuse their own error handling code, calls for data are not redundant, and everything runs asynchronously.
See the the
runApp function in the source code to begin the journey down the rabbit hole.
Since app source code is stored in a public Github repository, retrieving them is done simply with the nodegit Node module. The files are clones to the Connectrix server's filesystem. However, in order to run apps for multiple users simultaneously, these clones are indexed according to the number of clones currently on the system. (Storing the first directory as "clone-0," a second app run initiated by another user while clone-0 is still present would render a "clone-1," and so on.) The directories are deleting when done processing the data and a response is returned. See the "Security" section below for information about running untrusted code on the server.
Currently, apps may only be written in Python and use predetermined libraries that have been pre-installed on the server.
app.pymain file) with the python-shell Node module. This makes it easy to run and listen for data or errors from the Python program. Data is passed to the Python program's stdin stream and received stdout or stderr (most easily a
Currently, the injected HTML is able to access and utilize all the resources already in the page such as Bootstrap and JQuery (and AngularJS app), but this should obviously be changed in the future. See the "Security" section below for details.