Skip to content

Commit

Permalink
Several changes to prep for release; uid in pubsub, ui tweaks, privac…
Browse files Browse the repository at this point in the history
…y policy

'
  • Loading branch information
jdpigeon committed Nov 29, 2017
1 parent 0da9f73 commit dc42c92
Show file tree
Hide file tree
Showing 13 changed files with 1,522 additions and 65 deletions.
15 changes: 15 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Privacy Policy of Neurodoro

## Permissions
EEG 101 asks for the following permissions:
- Internet
- Bluetooth
- Bluetooth_admin
- Access Coarse Location
- Write External Storage


These permissions are required in order to the operate bluetooth and connect to the Muse headband. We do not track user data, nor do we mess with our user's phones.

## Collecting Data
If you follow through the test in the Collect Data screens, data collected from your Muse, along with performance scores from the test, will be uploaded to our database. There is a unique key created initially upon installation of the app that we use to differentiate data between users. However, we do not collect or attempt to analyze data for further identifying information. We are hoping to introduce encryption and personal ownership to EEG data in the future and appreciate your patience as we get there.
27 changes: 16 additions & 11 deletions android/app/src/main/java/com/neurodoro/cloud/CORVOSession.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
package com.neurodoro.cloud;

import android.util.Log;
import android.content.Context;

import com.google.android.gms.iid.InstanceID;
import com.google.gson.Gson;
import com.neurodoro.MainApplication;

import org.apache.commons.lang3.ArrayUtils;

import java.util.Date;
import java.util.LinkedList;
import java.util.stream.Stream;

/**
* A Java Object that can be converted to an LSL-ish data format for our DB
*/
public class CORVOSession {
public StreamInfo info;
public LinkedList<StreamDataChunk> samples;
private String uid;
private String sessionID;

public CORVOSession(String testType, String dataType) {
String uniqueID = InstanceID.getInstance(MainApplication.getInstance()).getId();
this.uid = InstanceID.getInstance(MainApplication.getInstance()).getId();
String version = "1.0";
Date createdAt = new Date(System.currentTimeMillis());
String sessionID =
uniqueID.substring(7) + Long.toString(System.currentTimeMillis()).substring(6, 11);
this.sessionID =
uid.substring(7) + Long.toString(System.currentTimeMillis()).substring(6, 11);

samples = new LinkedList<StreamDataChunk>();
info = new StreamInfo(testType, dataType, version, createdAt, uniqueID, sessionID);
info = new StreamInfo(testType, dataType, version, createdAt, uid, sessionID);
}

// -------------------------------------------------------
// Methods

public void addSample(double[] data, int[] scores, long timestamp) {
StreamDataChunk newChunk = new StreamDataChunk(data.clone(), scores.clone(), timestamp);
StreamDataChunk newChunk = new StreamDataChunk(data.clone(), scores.clone(), timestamp, uid, sessionID);
samples.add(newChunk);
}

Expand All @@ -45,8 +46,8 @@ protected class StreamInfo {
private final String type; // DataTyoe (i.e. raw EEG)
private final String version; // Which release of the app
private final Date created_at; // Start time in nice date format
private final String uid;
private final String session_id;
public String uid; // Instance ID
public String session_id;
private final int channel_count;
private final int nominal_srate;
private final String source_id;
Expand Down Expand Up @@ -76,11 +77,15 @@ protected class StreamDataChunk {
double[] data;
int[] scores;
long timestamp;
public String uid; // Instance ID
public String session_id;

public StreamDataChunk(double[] data, int[] scores, long timestamp) {
public StreamDataChunk(double[] data, int[] scores, long timestamp, String uid, String session_id) {
this.data = data;
this.scores = scores;
this.timestamp = timestamp;
this.uid = uid;
this.session_id = session_id;
}
}

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"test": "jest"
},
"dependencies": {
"@google-cloud/bigquery": "^0.11.1",
"eslint-plugin-react-native": "^3.1.0",
"google-cloud": "^0.57.0",
"lodash": "^4.17.4",
"lottie-react-native": "^1.1.1",
"react": "~15.4.0",
Expand Down
6 changes: 4 additions & 2 deletions src/components/BigButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const styles = MediaQueryStyleSheet.create(
alignItems: "center",
padding: 22,
paddingLeft: 50,
paddingRight: 50
paddingRight: 50,
elevation: 2,
},

disabled: {
Expand All @@ -53,7 +54,8 @@ const styles = MediaQueryStyleSheet.create(
alignItems: "center",
padding: 25,
paddingLeft: 60,
paddingRight: 60
paddingRight: 60,
elevation: 2,
},

text: {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const styles = MediaQueryStyleSheet.create(
alignItems: "center",
padding: 15,
paddingLeft: 30,
paddingRight: 30
paddingRight: 30,
elevation: 2,
},

disabled: {
Expand All @@ -53,7 +54,8 @@ const styles = MediaQueryStyleSheet.create(
alignItems: "center",
padding: 15,
paddingLeft: 25,
paddingRight: 25
paddingRight: 25,
elevation: 2,
},

text: {
Expand Down
5 changes: 2 additions & 3 deletions src/components/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ const styles = StyleSheet.create({
clock: {
textAlign: 'center',
margin: 15,
lineHeight: 50,
color: colors.tomato,
fontFamily: 'YanoneKaffeesatz-Regular',
fontSize: 50,
fontSize: 60,
},
});
});
8 changes: 4 additions & 4 deletions src/components/WhiteButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const styles = StyleSheet.create({
height: 50,
margin: 5,
padding: 5,
padding: 5,
borderRadius: 10,
alignItems: "center",
borderWidth: 1,
borderColor: colors.black
borderColor: colors.black,
elevation: 2,
},

disabled: {
Expand All @@ -48,11 +48,11 @@ const styles = StyleSheet.create({
height: 50,
margin: 5,
padding: 5,
padding: 5,
borderRadius: 10,
alignItems: "center",
borderWidth: 1,
borderColor: colors.black
borderColor: colors.black,
elevation: 2,
},

text: {
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/begin-landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const styles = MediaQueryStyleSheet.create(

buttonContainer: {
justifyContent: "space-between",
flex: 1.5
flex: 1
},

logo: {
Expand Down
1 change: 0 additions & 1 deletion src/scenes/corvo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class CORVOTest extends Component {
}

onMessage = event => {
console.log(event.nativeEvent.data);
let difficulty = Number(event.nativeEvent.data.split("&")[0].substring(2));
let performance = Number(event.nativeEvent.data.split("&")[1].substring(2));
if (_.isNaN(difficulty)) {
Expand Down
4 changes: 2 additions & 2 deletions src/scenes/data-landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const styles = MediaQueryStyleSheet.create(
// Base styles
body: {
fontFamily: "OpenSans-Regular",
fontSize: 14,
fontSize: 12,
marginLeft: 15,
margin: 5,
marginRight: 15,
Expand Down Expand Up @@ -131,7 +131,7 @@ const styles = MediaQueryStyleSheet.create(

textContainer: {
justifyContent: "center",
flex: 4
flex: 5
}
},
// Responsive styles
Expand Down
21 changes: 7 additions & 14 deletions src/scenes/data-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ import {
View,
Image,
TouchableOpacity,
ViewPagerAndroid,
Linking
} from "react-native";
import { connect } from "react-redux";
import { Actions } from "react-native-router-flux";
import _ from "lodash";
import { MediaQueryStyleSheet } from "react-native-responsive";
import Button from "../components/Button";
import MuseRecorder from "../modules/MuseRecorder";
import PubSubClient from "../pub_sub_clients/GCPClient";
import config from "../redux/config";
import { publishCORVOSession } from "../redux/actions";
import * as colors from "../styles/colors";

// Modules for bridged Java methods
Expand Down Expand Up @@ -44,10 +39,8 @@ class DataSummary extends Component {
MuseRecorder.stopRecording();
MuseRecorder.getCORVOSession(
errorCallback => {
console.log('error: ', errorCallback);
},
successCallback => {
console.log('good JSON: ', successCallback);
this.props.pubSubClient.publish(successCallback);
}
);
Expand All @@ -65,20 +58,20 @@ class DataSummary extends Component {
Thanks for Contributing to Neurodoro!
</Text>
<Text style={styles.body}>
With your data we'll hopefully be able to create the best free,
With your data we'll hopefully be able to create the best open-source
brain-sensing productivity tool the world has ever seen!
</Text>
<Text style={styles.body}>
You can follow our progress or get involved yourself on GitHub and
the NeuroTechX Slack. We're currently looking for JS developers,
data/AI scientists, and UX designers interested in joining this fun
ML/data scientists, and UX designers interested in joining this fun
little side project.
</Text>
</View>
<View style={styles.logoBox}>
<TouchableOpacity
onPress={() => {
Linking.openURL("https://github.com/NeuroTechX/eeg-101");
Linking.openURL("https://github.com/NeuroTechX/neurodoro");
}}
>
<Image
Expand Down Expand Up @@ -153,13 +146,13 @@ const styles = MediaQueryStyleSheet.create(
alignSelf: "center",
opacity: 1,
width: 200,
marginBottom: 100,
marginTop: 0,
flex: 0.5,
flex: .5,
margin: 20,
backgroundColor: colors.tomato,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-around"
justifyContent: "space-around",
elevation: 2,
},

logo: {
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Timer extends Component {
// HACK: set expected to 0 to cancel timer
if(expected != 0){
expected = expected + SECOND;
setTimeout(this.timerTick, Math.max(0, SECOND - drift));
this.TIMER_ID = BackgroundTimer.setTimeout(this.timerTick, Math.max(0, SECOND - drift));
}
}
}
Expand Down
Loading

0 comments on commit dc42c92

Please sign in to comment.