public static void ParseTest(SpssDataDocument doc, Test test, SpssFormat format = SpssFormat.Long) { int id = int.Parse(test.ID); //int overallAttempt = 0; if (format == SpssFormat.Long) { //UserID, AttemptNumber, Efficiency, Effectiveness, Accuracy, TargetSize, Direction, Technique, Experiment foreach (var type in AllTechniques) { foreach (var attempt in test.Attempts[type]) { SpssCase gestureAttempts = doc.Cases.New(); gestureAttempts[$"UserID"] = id; gestureAttempts[$"AttemptNumber"] = attempt.AttemptNumber; gestureAttempts[$"Efficiency"] = attempt.Time.TotalSeconds; gestureAttempts[$"Effectiveness"] = attempt.Hit ? "Hit" : "Miss"; gestureAttempts[$"Accuracy"] = MathHelper.GetDistance(attempt); gestureAttempts[$"TargetSize"] = attempt.Size.ToString().UppercaseFirst(); gestureAttempts[$"Direction"] = attempt.Direction.ToString().UppercaseFirst(); gestureAttempts[$"Technique"] = attempt.Type.ToString().UppercaseFirst(); gestureAttempts[$"Experiment"] = attempt.Source.ToString().UppercaseFirst(); gestureAttempts.Commit(); } } } }
public static void CreateMetaData(SpssDataDocument doc, SpssFormat format = SpssFormat.Long) { SpssNumericVariable vID = new SpssNumericVariable(); vID.Name = "UserID"; vID.Label = "The user's ID"; vID.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(vID); if(format == SpssFormat.Long) { SpssNumericVariable attemptNumber = new SpssNumericVariable(); attemptNumber.Name = $"AttemptNumber"; attemptNumber.Label = $"The continuous number of this attempt"; attemptNumber.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(attemptNumber); SpssNumericVariable time = new SpssNumericVariable(); time.Name = $"Efficiency"; time.Label = $"Time taken in seconds for the attempt"; time.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(time); SpssStringVariable hit = new SpssStringVariable(); hit.Name = $"Effectiveness"; hit.Label = $"Whether the user hit the target or not"; hit.ValueLabels.Add("Miss", "Miss"); hit.ValueLabels.Add("Hit", "Hit"); hit.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(hit); SpssNumericVariable accuracy = new SpssNumericVariable(); accuracy.Name = $"Accuracy"; accuracy.Label = $"Distance in pixels from target"; accuracy.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(accuracy); SpssStringVariable gridSize = new SpssStringVariable(); gridSize.Name = $"TargetSize"; gridSize.Label = $"Target (grid) size for attempt"; gridSize.ValueLabels.Add("Small", "Small"); gridSize.ValueLabels.Add("Large", "Large"); gridSize.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(gridSize); SpssStringVariable direction = new SpssStringVariable(); direction.Name = $"Direction"; direction.Label = $"Direction for attempt"; direction.ValueLabels.Add("Push", "Push"); direction.ValueLabels.Add("Pull", "Pull"); direction.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(direction); SpssStringVariable technique = new SpssStringVariable(); technique.Name = $"Technique"; technique.Label = $"The technique used for the attempt"; technique.ValueLabels.Add("Pinch", "Pinch"); technique.ValueLabels.Add("Swipe", "Swipe"); technique.ValueLabels.Add("Throw", "Throw"); technique.ValueLabels.Add("Tilt", "Tilt"); technique.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(technique); SpssStringVariable experiment = new SpssStringVariable(); experiment.Name = $"Experiment"; experiment.Label = $"The experiment in which the attempt was conducted in"; // Target, Field, Old, Accuracy experiment.ValueLabels.Add("Target", "Target"); experiment.ValueLabels.Add("Field", "Field"); experiment.ValueLabels.Add("Old", "Old"); experiment.ValueLabels.Add("Accuracy", "Accuracy"); experiment.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(experiment); } doc.CommitDictionary(); }
public static void CreateMetaData(SpssDataDocument doc, SpssFormat format = SpssFormat.Long) { SpssNumericVariable vID = new SpssNumericVariable(); vID.Name = "UserID"; vID.Label = "The user's ID"; vID.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(vID); if (format == SpssFormat.Long) { SpssNumericVariable attemptNumber = new SpssNumericVariable(); attemptNumber.Name = $"AttemptNumber"; attemptNumber.Label = $"The continuous number of this attempt"; attemptNumber.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(attemptNumber); SpssNumericVariable time = new SpssNumericVariable(); time.Name = $"Efficiency"; time.Label = $"Time taken in seconds for the attempt"; time.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(time); SpssStringVariable hit = new SpssStringVariable(); hit.Name = $"Effectiveness"; hit.Label = $"Whether the user hit the target or not"; hit.ValueLabels.Add("Miss", "Miss"); hit.ValueLabels.Add("Hit", "Hit"); hit.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(hit); SpssNumericVariable accuracy = new SpssNumericVariable(); accuracy.Name = $"Accuracy"; accuracy.Label = $"Distance in pixels from target"; accuracy.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_RAT; doc.Variables.Add(accuracy); SpssStringVariable gridSize = new SpssStringVariable(); gridSize.Name = $"TargetSize"; gridSize.Label = $"Target (grid) size for attempt"; gridSize.ValueLabels.Add("Small", "Small"); gridSize.ValueLabels.Add("Large", "Large"); gridSize.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(gridSize); SpssStringVariable direction = new SpssStringVariable(); direction.Name = $"Direction"; direction.Label = $"Direction for attempt"; direction.ValueLabels.Add("Push", "Push"); direction.ValueLabels.Add("Pull", "Pull"); direction.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(direction); SpssStringVariable technique = new SpssStringVariable(); technique.Name = $"Technique"; technique.Label = $"The technique used for the attempt"; technique.ValueLabels.Add("Pinch", "Pinch"); technique.ValueLabels.Add("Swipe", "Swipe"); technique.ValueLabels.Add("Throw", "Throw"); technique.ValueLabels.Add("Tilt", "Tilt"); technique.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(technique); SpssStringVariable experiment = new SpssStringVariable(); experiment.Name = $"Experiment"; experiment.Label = $"The experiment in which the attempt was conducted in"; // Target, Field, Old, Accuracy experiment.ValueLabels.Add("Target", "Target"); experiment.ValueLabels.Add("Field", "Field"); experiment.ValueLabels.Add("Old", "Old"); experiment.ValueLabels.Add("Accuracy", "Accuracy"); experiment.MeasurementLevel = MeasurementLevelCode.SPSS_MLVL_NOM; doc.Variables.Add(experiment); } doc.CommitDictionary(); }
public static void ParseTest(SpssDataDocument doc, Test test, SpssFormat format = SpssFormat.Long) { int id = int.Parse(test.ID); //int overallAttempt = 0; if (format == SpssFormat.Long) { //UserID, AttemptNumber, Efficiency, Effectiveness, Accuracy, TargetSize, Direction, Technique, Experiment foreach (var type in AllTechniques) { foreach(var attempt in test.Attempts[type]) { SpssCase gestureAttempts = doc.Cases.New(); gestureAttempts[$"UserID"] = id; gestureAttempts[$"AttemptNumber"] = attempt.AttemptNumber; gestureAttempts[$"Efficiency"] = attempt.Time.TotalSeconds; gestureAttempts[$"Effectiveness"] = attempt.Hit ? "Hit" : "Miss"; gestureAttempts[$"Accuracy"] = MathHelper.GetDistance(attempt); gestureAttempts[$"TargetSize"] = attempt.Size.ToString().UppercaseFirst(); gestureAttempts[$"Direction"] = attempt.Direction.ToString().UppercaseFirst(); gestureAttempts[$"Technique"] = attempt.Type.ToString().UppercaseFirst(); gestureAttempts[$"Experiment"] = attempt.Source.ToString().UppercaseFirst(); gestureAttempts.Commit(); } } } }