Commit 74b5c2e0 authored by Anuththara18's avatar Anuththara18

Analysing factors added- Selective Attention

parent adf9eff9
......@@ -4,56 +4,148 @@ public class Selective {
private int id;
private int childID;
private String stimulus;
private String colour;
private String sequence_of_responses;
private String order_of_selection;
private String no_of_clicks;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
private int totalDuration;
private String diagnosis;
public Selective(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
public Selective(int id, int childID, String stimulus, String colour, String sequence_of_responses, String order_of_selection, String no_of_clicks, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration, String diagnosis) {
this.id = id;
this.childID = childID;
this.stimulus = stimulus;
this.colour = colour;
this.sequence_of_responses = sequence_of_responses;
this.order_of_selection = order_of_selection;
this.no_of_clicks = no_of_clicks;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
this.diagnosis = diagnosis;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getChildID() {
return childID;
}
public void setChildID(int childID) {
this.childID = childID;
}
public String getStimulus() {
return stimulus;
}
public void setStimulus(String stimulus) {
this.stimulus = stimulus;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
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 String getOrder_of_selection() {
return order_of_selection;
}
public void setOrder_of_selection(String order_of_selection) {
this.order_of_selection = order_of_selection;
}
public String getNo_of_clicks() {
return no_of_clicks;
}
public void setNo_of_clicks(String no_of_clicks) {
this.no_of_clicks = no_of_clicks;
}
public int getTotalCorrectResponses() {
return totalCorrectResponses;
}
public void setTotalCorrectResponses(int totalCorrectResponses) {
this.totalCorrectResponses = totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public void setNoOfCorrectResponses(int noOfCorrectResponses) {
this.noOfCorrectResponses = noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public void setNoOfCommissionErrors(int noOfCommissionErrors) {
this.noOfCommissionErrors = noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public void setNoOfOmmissionErrors(int noOfOmmissionErrors) {
this.noOfOmmissionErrors = noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public void setMeanReactionTime(int meanReactionTime) {
this.meanReactionTime = meanReactionTime;
}
public int getTotalDuration() {
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 (
id int NOT NULL AUTO_INCREMENT,
......
......@@ -154,12 +154,18 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
dataList.add(new Selective(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
cursorEmployees.getString(2),
cursorEmployees.getString(3),
cursorEmployees.getString(4),
cursorEmployees.getString(5),
cursorEmployees.getString(6),
cursorEmployees.getInt(7),
cursorEmployees.getInt(8),
cursorEmployees.getInt(9),
cursorEmployees.getInt(10),
cursorEmployees.getInt(11),
cursorEmployees.getInt(12),
cursorEmployees.getString(13)
));
} while (cursorEmployees.moveToNext());
}
......@@ -176,7 +182,7 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
writer = new CSVWriter(new FileWriter(csv));
String[] entries = {"id","child_gender","child_age","level",
"stimulus", "colour", "sequence_of_responses", "no_of_clicks", "order_of_selection",
"stimulus", "colour", "sequence_of_responses", "order_of_selection", "no_of_clicks",
"total_correct_responses","correct_responses",
"commission_errors","omission_errors","mean_reaction_time",
"total_duration","diagnosis"};
......@@ -191,20 +197,18 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
String.valueOf(String.valueOf(gameData.getChildID()).charAt(0)),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(1)),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(2)),
String.valueOf(SelectiveAttentionGame1.stimulus),
String.valueOf(SelectiveAttentionGame1.colour),
String.valueOf("null"),
String.valueOf(SelectiveAttentionGame1.no_of_clicks),
String.valueOf("null"),
String.valueOf(gameData.getStimulus()),
String.valueOf(gameData.getColour()),
String.valueOf(gameData.getSequence_of_responses()),
String.valueOf(gameData.getOrder_of_selection()),
String.valueOf(gameData.getNo_of_clicks()),
String.valueOf(gameData.getTotalCorrectResponses()),
String.valueOf(gameData.getNoOfCorrectResponses()),
String.valueOf(gameData.getNoOfCommissionErrors()),
String.valueOf(gameData.getNoOfOmmissionErrors()),
String.valueOf(gameData.getMeanReactionTime()),
String.valueOf(gameData.getTotalDuration()),
String.valueOf(ParentDetailsActivity.diagnosis)
String.valueOf(gameData.getDiagnosis())
});
}
......
......@@ -29,6 +29,7 @@ import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.db.Api;
import com.anuththara18.attentionassessment.db.RequestHandler;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.focused.FocusedAttentionGame1;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
......@@ -97,9 +98,9 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
public static String stimulus;
public static String colour;
public static String sequence_of_responses;
public static ArrayList<String> sequence_of_responses;
public static int no_of_clicks;
public static String order_of_selection;
public static String order_of_selection = "";
MediaPlayer mp;
int clickCount = 0;
......@@ -124,6 +125,8 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
textview.setText(LanguageSetter.getresources().getString(R.string.select));
sequence_of_responses = new ArrayList<>();
mp = MediaPlayer.create(getApplicationContext(), R.raw.selective);
mp.start();
......@@ -149,7 +152,7 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
// level 1 & 2
a = R.drawable.ladybird;
a1 = "ladybird";
a1 = "red_ladybird";
b = R.drawable.blue_buterfly;
b1 = "blue_buterfly";
c = R.drawable.yellow_bee;
......@@ -159,7 +162,7 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
e = R.drawable.pink_flower;
e1 = "pink_flower";
f = R.drawable.bear;
f1 = "bear";
f1 = "brown_bear";
g = R.drawable.pink_pig;
g1 = "pink_pig";
......@@ -496,6 +499,10 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
if ( data.getImage_name().equals(image_name) ) {
noOfCorrectResponses++;
correctResponses.add(position);
sequence_of_responses.add("C");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
//Toast.makeText(getApplicationContext(), data.getImage_name(), Toast.LENGTH_SHORT).show();
order_of_selection = order_of_selection + data.getImage_name() + ", ";
gridView.setAdapter(adapter);
}
else {
......@@ -503,6 +510,10 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
noOfCommissionErrors++;
incorrectResponses.add(position);
gridView.setAdapter(adapter);
sequence_of_responses.add("W");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
//Toast.makeText(getApplicationContext(), data.getImage_name(), Toast.LENGTH_SHORT).show();
order_of_selection = order_of_selection + data.getImage_name() + ", ";
}
}
});
......@@ -526,6 +537,8 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("duration", String.valueOf(completionTime));
Log.d("sequence", String.valueOf(sequence_of_responses));
Log.d("order", String.valueOf(order_of_selection));
no_of_clicks = noOfCorrectResponses + noOfCommissionErrors;
GVAdapter2 adapter = new GVAdapter2(getApplicationContext(), gridModelArrayList);
gridView.setAdapter(adapter);
......@@ -563,7 +576,7 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
myEdit.commit();
}
saveDataToOnlineDB();
//saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
clickCount++;
......@@ -932,12 +945,18 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
"CREATE TABLE IF NOT EXISTS selectiveAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int NOT NULL,\n" +
" stimulus text NOT NULL,\n" +
" colour text NOT NULL,\n" +
" sequence_of_responses text NOT NULL,\n" +
" order_of_selection text NOT NULL,\n" +
" no_of_clicks text NOT NULL,\n" +
" totalCorrectResponses int NOT NULL,\n" +
" noOfCorrectResponses int NOT NULL,\n" +
" noOfCommissionErrors int NOT NULL,\n" +
" noOfOmmissionErrors int NOT NULL,\n" +
" meanReactionTime int NOT NULL,\n" +
" totalDuration int NOT NULL\n" +
" totalDuration int NOT NULL,\n" +
" diagnosis int NOT NULL\n" +
");"
);
}
......@@ -956,11 +975,11 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
int total_duration = (int) completionTime;
String insertSQL = "INSERT INTO selectiveAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\n" +
"(childID, stimulus, colour, sequence_of_responses, order_of_selection, no_of_clicks, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration, diagnosis)\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});
mDatabase.execSQL(insertSQL, new Object[]{child_ID, stimulus, colour, sequence_of_responses, order_of_selection, no_of_clicks, total_correct_responses, no_of_correct_responses, no_of_commission_errors, no_of_ommission_errors, mean_reaction_time, total_duration, ParentDetailsActivity.diagnosis});
//Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
......
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