Commit fd0a8c64 authored by Anuththara18's avatar Anuththara18

Analysing factors addded- Divided Attention

parent 03bca415
...@@ -156,12 +156,14 @@ public class DACompleteScreen extends AppCompatActivity { ...@@ -156,12 +156,14 @@ public class DACompleteScreen extends AppCompatActivity {
dataList.add(new Divided( dataList.add(new Divided(
cursorEmployees.getInt(0), cursorEmployees.getInt(0),
cursorEmployees.getInt(1), cursorEmployees.getInt(1),
cursorEmployees.getInt(2), cursorEmployees.getString(2),
cursorEmployees.getInt(3), cursorEmployees.getInt(3),
cursorEmployees.getInt(4), cursorEmployees.getInt(4),
cursorEmployees.getInt(5), cursorEmployees.getInt(5),
cursorEmployees.getInt(6), cursorEmployees.getInt(6),
cursorEmployees.getInt(7) cursorEmployees.getInt(7),
cursorEmployees.getInt(8),
cursorEmployees.getString(9)
)); ));
} while (cursorEmployees.moveToNext()); } while (cursorEmployees.moveToNext());
} }
...@@ -191,14 +193,14 @@ public class DACompleteScreen extends AppCompatActivity { ...@@ -191,14 +193,14 @@ public class DACompleteScreen extends AppCompatActivity {
data.add(new String[]{ String.valueOf(gameData.getId()), data.add(new String[]{ String.valueOf(gameData.getId()),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(0)), String.valueOf(String.valueOf(gameData.getChildID()).charAt(0)),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(1)), String.valueOf(String.valueOf(gameData.getChildID()).charAt(1)),
String.valueOf("null"), String.valueOf(gameData.getSequence_of_responses()),
String.valueOf(gameData.getTotalCorrectResponses()), String.valueOf(gameData.getTotalCorrectResponses()),
String.valueOf(gameData.getNoOfCorrectResponses()), String.valueOf(gameData.getNoOfCorrectResponses()),
String.valueOf(gameData.getNoOfCommissionErrors()), String.valueOf(gameData.getNoOfCommissionErrors()),
String.valueOf(gameData.getNoOfOmmissionErrors()), String.valueOf(gameData.getNoOfOmmissionErrors()),
String.valueOf(gameData.getMeanReactionTime()), String.valueOf(gameData.getMeanReactionTime()),
String.valueOf(gameData.getTotalDuration()), String.valueOf(gameData.getTotalDuration()),
String.valueOf(ParentDetailsActivity.diagnosis) String.valueOf(gameData.getDiagnosis())
}); });
} }
......
...@@ -4,56 +4,108 @@ public class Divided { ...@@ -4,56 +4,108 @@ public class Divided {
private int id; private int id;
private int childID; private int childID;
private String sequence_of_responses;
private int totalCorrectResponses; private int totalCorrectResponses;
private int noOfCorrectResponses; private int noOfCorrectResponses;
private int noOfCommissionErrors; private int noOfCommissionErrors;
private int noOfOmmissionErrors; private int noOfOmmissionErrors;
private int meanReactionTime; private int meanReactionTime;
private int totalDuration; private int totalDuration;
private String diagnosis;
public Divided(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) { public Divided(int id, int childID, String sequence_of_responses, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration, String diagnosis) {
this.id = id; this.id = id;
this.childID = childID; this.childID = childID;
this.sequence_of_responses = sequence_of_responses;
this.totalCorrectResponses = totalCorrectResponses; this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses; this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors; this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors; this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime; this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration; this.totalDuration = totalDuration;
this.diagnosis = diagnosis;
} }
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) {
this.id = id;
}
public int getChildID() { public int getChildID() {
return childID; return childID;
} }
public void setChildID(int childID) {
this.childID = childID;
}
public String getSequence_of_responses() {
return sequence_of_responses;
}
public void setSequence_of_responses(String sequence_of_responses) {
this.sequence_of_responses = sequence_of_responses;
}
public int getTotalCorrectResponses() { public int getTotalCorrectResponses() {
return totalCorrectResponses; return totalCorrectResponses;
} }
public void setTotalCorrectResponses(int totalCorrectResponses) {
this.totalCorrectResponses = totalCorrectResponses;
}
public int getNoOfCorrectResponses() { public int getNoOfCorrectResponses() {
return noOfCorrectResponses; return noOfCorrectResponses;
} }
public void setNoOfCorrectResponses(int noOfCorrectResponses) {
this.noOfCorrectResponses = noOfCorrectResponses;
}
public int getNoOfCommissionErrors() { public int getNoOfCommissionErrors() {
return noOfCommissionErrors; return noOfCommissionErrors;
} }
public void setNoOfCommissionErrors(int noOfCommissionErrors) {
this.noOfCommissionErrors = noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() { public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors; return noOfOmmissionErrors;
} }
public void setNoOfOmmissionErrors(int noOfOmmissionErrors) {
this.noOfOmmissionErrors = noOfOmmissionErrors;
}
public int getMeanReactionTime() { public int getMeanReactionTime() {
return meanReactionTime; return meanReactionTime;
} }
public void setMeanReactionTime(int meanReactionTime) {
this.meanReactionTime = meanReactionTime;
}
public int getTotalDuration() { public int getTotalDuration() {
return totalDuration; return totalDuration;
} }
public void setTotalDuration(int totalDuration) {
this.totalDuration = totalDuration;
}
public String getDiagnosis() {
return diagnosis;
}
public void setDiagnosis(String diagnosis) {
this.diagnosis = diagnosis;
}
/* /*
CREATE TABLE sustainedAttention ( CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT, id int NOT NULL AUTO_INCREMENT,
......
...@@ -30,6 +30,7 @@ import com.anuththara18.attentionassessment.R; ...@@ -30,6 +30,7 @@ import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity; import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.db.Api; import com.anuththara18.attentionassessment.db.Api;
import com.anuththara18.attentionassessment.db.RequestHandler; import com.anuththara18.attentionassessment.db.RequestHandler;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.focused.FocusedAttentionGame1; import com.anuththara18.attentionassessment.focused.FocusedAttentionGame1;
import com.anuththara18.attentionassessment.gender.GenderActivity; import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity; import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
...@@ -38,6 +39,7 @@ import com.anuththara18.attentionassessment.language.LanguageSetter; ...@@ -38,6 +39,7 @@ import com.anuththara18.attentionassessment.language.LanguageSetter;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
public class DividedAttentionGame1 extends AppCompatActivity { public class DividedAttentionGame1 extends AppCompatActivity {
...@@ -62,6 +64,8 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -62,6 +64,8 @@ public class DividedAttentionGame1 extends AppCompatActivity {
long meanReactionTime = 0; // total reaction time long meanReactionTime = 0; // total reaction time
long totalReactionTime = 0; long totalReactionTime = 0;
int duration = 0; int duration = 0;
int missed = 0;
int correctresponse = 0;
public static final String DATABASE_NAME = "dividedAttention"; public static final String DATABASE_NAME = "dividedAttention";
SQLiteDatabase mDatabase; SQLiteDatabase mDatabase;
...@@ -78,6 +82,8 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -78,6 +82,8 @@ public class DividedAttentionGame1 extends AppCompatActivity {
MediaPlayer mp, mp2; MediaPlayer mp, mp2;
public static ArrayList<String> sequence_of_responses;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -100,6 +106,8 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -100,6 +106,8 @@ public class DividedAttentionGame1 extends AppCompatActivity {
mp = MediaPlayer.create(getApplicationContext(), R.raw.divided); mp = MediaPlayer.create(getApplicationContext(), R.raw.divided);
mp.start(); mp.start();
sequence_of_responses = new ArrayList<>();
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override @Override
...@@ -123,78 +131,43 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -123,78 +131,43 @@ public class DividedAttentionGame1 extends AppCompatActivity {
public void run() { public void run() {
if ( i < 40 ) { // 40 times if ( i < 40 ) { // 40 times
/* if ( i == 4 ) {
if (AgeActivity.age == 4) { checkIfMissed();
missed = 0;
if (i >= 0 && i < 5) { correctresponse = 0;
sq1.setImageResource(R.color.pink); }else if ( i == 9 ) {
correctImage = R.color.pink; checkIfMissed();
} else if (i >= 5 && i < 10) { missed = 0;
sq1.setImageResource(R.color.blue); correctresponse = 0;
correctImage = R.color.blue; }else if ( i == 14 ) {
} else if (i >= 10 && i < 15) { checkIfMissed();
sq1.setImageResource(R.color.yellow); missed = 0;
correctImage = R.color.yellow; correctresponse = 0;
} else if (i >= 15 && i < 20) { }else if ( i == 19 ) {
sq1.setImageResource(R.color.green); checkIfMissed();
correctImage = R.color.green; missed = 0;
} else if (i >= 20 && i < 25) { correctresponse = 0;
sq1.setImageResource(R.color.red); }else if ( i == 24 ) {
correctImage = R.color.red; checkIfMissed();
} else if (i >= 25 && i < 30) { missed = 0;
sq1.setImageResource(R.color.purple); correctresponse = 0;
correctImage = R.color.purple; }else if ( i == 29 ) {
} else if (i >= 30 && i < 35) { checkIfMissed();
sq1.setImageResource(R.color.orange); missed = 0;
correctImage = R.color.orange; correctresponse = 0;
} else if (i >= 35 && i < 40) { }else if ( i == 34 ) {
sq1.setImageResource(R.color.teal); checkIfMissed();
correctImage = R.color.teal; missed = 0;
} correctresponse = 0;
}else if ( i == 39 ) {
String j = String.valueOf(i); checkIfMissed();
missed = 0;
if (j.equals("0") || j.equals("8") || j.equals("16") || j.equals("24") || j.equals("34") || j.equals("40")) { correctresponse = 0;
sq2.setImageResource(image[0]); }else if ( i == 44 ) {
sq2.setEnabled(true); checkIfMissed();
sq2.setTag(image[0]); missed = 0;
} else if (j.equals("1") || j.equals("6") || j.equals("17") || j.equals("25") || j.equals("33") || j.equals("41")) { correctresponse = 0;
sq2.setImageResource(image[1]);
sq2.setEnabled(true);
sq2.setTag(image[1]);
} else if (j.equals("2") || j.equals("14") || j.equals("19") || j.equals("26") || j.equals("30") || j.equals("42")) {
sq2.setImageResource(image[2]);
sq2.setEnabled(true);
sq2.setTag(image[2]);
} else if (j.equals("4") || j.equals("11") || j.equals("18") || j.equals("27") || j.equals("35") || j.equals("43")) {
sq2.setImageResource(image[3]);
sq2.setEnabled(true);
sq2.setTag(image[3]);
} else if (j.equals("3") || j.equals("12") || j.equals("20") || j.equals("29") || j.equals("36") || j.equals("44")) {
sq2.setImageResource(image[4]);
sq2.setEnabled(true);
sq2.setTag(image[4]);
} else if (j.equals("5") || j.equals("13") || j.equals("21") || j.equals("28") || j.equals("37") || j.equals("45")) {
sq2.setImageResource(image[5]);
sq2.setEnabled(true);
sq2.setTag(image[5]);
} else if (j.equals("9") || j.equals("15") || j.equals("22") || j.equals("32") || j.equals("39") || j.equals("46")) {
sq2.setImageResource(image[6]);
sq2.setEnabled(true);
sq2.setTag(image[6]);
} else if (j.equals("7") || j.equals("10") || j.equals("23") || j.equals("31") || j.equals("38") || j.equals("47")) {
sq2.setImageResource(image[7]);
sq2.setEnabled(true);
sq2.setTag(image[7]);
}
startTime = System.currentTimeMillis();
sq2.postDelayed(this, 2000);
Log.d("int", String.valueOf(i));
duration = duration + 2000;
i++;
} }
*/
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
if (AgeActivity.age == 4 || AgeActivity.age == 5) { if (AgeActivity.age == 4 || AgeActivity.age == 5) {
...@@ -361,9 +334,11 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -361,9 +334,11 @@ public class DividedAttentionGame1 extends AppCompatActivity {
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors)); Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime)); Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration)); Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB(); Log.d("responses", String.valueOf(sequence_of_responses));
//saveDataToOnlineDB();
createTable(); createTable();
saveDataToLocalDB(); saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), DACompleteScreen.class); Intent intent = new Intent(getApplicationContext(), DACompleteScreen.class);
finish(); finish();
mp.pause(); mp.pause();
...@@ -387,11 +362,19 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -387,11 +362,19 @@ public class DividedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime); Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
correctresponse = 1;
sequence_of_responses.add("C");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
sq2.setEnabled(false); sq2.setEnabled(false);
} }
else { else {
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime); Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++; noOfCommissionErrors++;
missed = 2;
sequence_of_responses.add("W");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
sq2.setEnabled(false);
} }
} }
}); });
...@@ -423,6 +406,19 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -423,6 +406,19 @@ public class DividedAttentionGame1 extends AppCompatActivity {
/*************************************************************************************************/ /*************************************************************************************************/
private void checkIfMissed() {
if (missed == 0) {
sequence_of_responses.add("M");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
}
else if ( correctresponse == 0 ) {
sequence_of_responses.add("M");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
}
}
/*************************************************************************************************/
@Override @Override
public void onBackPressed() { public void onBackPressed() {
super.onBackPressed(); super.onBackPressed();
...@@ -554,12 +550,14 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -554,12 +550,14 @@ public class DividedAttentionGame1 extends AppCompatActivity {
"CREATE TABLE IF NOT EXISTS dividedAttention (\n" + "CREATE TABLE IF NOT EXISTS dividedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" + " id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int NOT NULL,\n" + " childID int NOT NULL,\n" +
" sequence_of_responses text NOT NULL,\n" +
" totalCorrectResponses int NOT NULL,\n" + " totalCorrectResponses int NOT NULL,\n" +
" noOfCorrectResponses int NOT NULL,\n" + " noOfCorrectResponses int NOT NULL,\n" +
" noOfCommissionErrors int NOT NULL,\n" + " noOfCommissionErrors int NOT NULL,\n" +
" noOfOmmissionErrors int NOT NULL,\n" + " noOfOmmissionErrors int NOT NULL,\n" +
" meanReactionTime int NOT NULL,\n" + " meanReactionTime int NOT NULL,\n" +
" totalDuration int NOT NULL\n" + " totalDuration int NOT NULL,\n" +
" diagnosis text NOT NULL\n" +
");" ");"
); );
} }
...@@ -578,13 +576,11 @@ public class DividedAttentionGame1 extends AppCompatActivity { ...@@ -578,13 +576,11 @@ public class DividedAttentionGame1 extends AppCompatActivity {
int total_duration = duration; int total_duration = duration;
String insertSQL = "INSERT INTO dividedAttention \n" + String insertSQL = "INSERT INTO dividedAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\n" + "(childID, sequence_of_responses, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration, diagnosis)\n" +
"VALUES \n" + "VALUES \n" +
"(?, ?, ?, ?, ?, ?, ?);"; "(?, ?, ?, ?, ?, ?, ?, ?, ?);";
mDatabase.execSQL(insertSQL, new Integer[]{child_ID, total_correct_responses, no_of_correct_responses, no_of_commission_errors, no_of_ommission_errors, mean_reaction_time, total_duration});
//Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show(); mDatabase.execSQL(insertSQL, new Object[]{child_ID, sequence_of_responses, total_correct_responses, no_of_correct_responses, no_of_commission_errors, no_of_ommission_errors, mean_reaction_time, total_duration, ParentDetailsActivity.diagnosis});
} }
/*************************************************************************************************/ /*************************************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment