public async Task <IActionResult> GetDeviceAccelerationCombinedCollection(int?id) { if (id == null) { return(NotFound()); } var deviceAccelerationCollection = await _arDbContext.DeviceAccelerations.Where(da => da.AnswerRecordID == id).ToListAsync(); var deviceAccelerationCombinedCollection = MovementSupervisor.CombineDeviceAcceleration(deviceAccelerationCollection); return(Ok(deviceAccelerationCombinedCollection)); }
public async Task <IActionResult> GetMovementFilteredCollection(int?id) { if (id == null) { return(NotFound()); } var movementCollection = await _arDbContext.Movements.Where(da => da.AnswerRecordID == id).ToListAsync(); var movementFilterCollection = MovementSupervisor.FilterMovementForceCollection(movementCollection); return(Ok(movementFilterCollection)); }
public IActionResult GetAnswerRecord(int id) { var answerRecord = _arDbContext.AnswserRecords.Where(a => a.ID == id).SingleOrDefault(); if (answerRecord == null) { return(NotFound()); } var movements = _arDbContext.Movements.Where(m => m.AnswerRecordID == id).ToList(); var deviceAccelerations = _arDbContext.DeviceAccelerations.Where(d => d.AnswerRecordID == id).ToList(); // supervise process var movementSupervisor = new MovementSupervisor(movements, deviceAccelerations); var movementSupervisedCollection = movementSupervisor.SuperviseByAcceleration(); var vm = new AnswerReplayGetAnswerViewModel { ID = answerRecord.ID, AssignmentRecordID = answerRecord.AssignmentRecordID, SentenceEN = answerRecord.SentenceEN, SentenceJP = answerRecord.SentenceJP, Division = answerRecord.Division, StandardAnswerDivision = answerRecord.StandardAnswerDivision, Resolution = answerRecord.Resolution, AnswerDivision = answerRecord.AnswerDivision, IsCorrect = answerRecord.IsCorrect, ConfusionDegree = answerRecord.ConfusionDegree, ConfusionElement = answerRecord.ConfusionElement, StartDate = answerRecord.StartDate, EndDate = answerRecord.EndDate, MovementCollection = movements.OrderBy(m => m.Index).ToList(), MovementSupervisedCollection = movementSupervisedCollection.OrderBy(m => m.Index).ToList(), DeviceAccelerationCollection = deviceAccelerations.OrderBy(da => da.Index).ToList(), }; //Request.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*"); //Request.HttpContext.Response.Headers.Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); return(Ok(vm)); }
public async Task <IActionResult> GetMovementSupervisedCollection(int?id) { if (id == null) { return(NotFound()); } var movementCollection = await _arDbContext.Movements.Where(da => da.AnswerRecordID == id).ToListAsync(); var deviceAccelerationCollection = await _arDbContext.DeviceAccelerations.Where(da => da.AnswerRecordID == id).ToListAsync(); // supervise process var movementSupervisor = new MovementSupervisor(movementCollection, deviceAccelerationCollection); var movementSupervisedCollection = movementSupervisor.SuperviseByAcceleration(); return(Ok(movementSupervisedCollection)); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var answerRecord = await _arDbContext.AnswserRecords.SingleOrDefaultAsync(q => q.ID == id); if (answerRecord == null) { return(NotFound()); } var vm = Mapper.Map <AnswerRecord, AnswerRecordManageDetailsViewModel>(answerRecord); var splitConfusionElement = answerRecord.ConfusionElement.Split('#'); var splitDivision = answerRecord.Division.Split('|'); var sortedWordCollection = new List <string>(); foreach (var confusionElement in splitConfusionElement) { if (confusionElement != "") { sortedWordCollection.Add(splitDivision[Convert.ToInt32(confusionElement)]); } } vm.ConfusionWordString = StringConverter.ConvertToSingleString(sortedWordCollection, ","); var movementCollection = await _arDbContext.Movements.Where(m => m.AnswerRecordID == answerRecord.ID).ToListAsync(); var deviceAccelerationCollection = await _arDbContext.DeviceAccelerations.Where(da => da.AnswerRecordID == answerRecord.ID).ToListAsync(); // supervise process var movementSupervisor = new MovementSupervisor(movementCollection, deviceAccelerationCollection); var movementSupervisedCollection = movementSupervisor.SuperviseByAcceleration(); vm.MovementCollection = movementCollection; vm.DeviceAccelerationCollection = deviceAccelerationCollection; // Parameter Analyze vm.DDIntervalAVG = ParameterAnalyzer.CalculateDDIntervalAVG(movementCollection); vm.DDIntervalMAX = ParameterAnalyzer.CalculateDDIntervalMAX(movementCollection); vm.DDIntervalMIN = ParameterAnalyzer.CalculateDDIntervalMIN(movementCollection); vm.DDProcessAVG = ParameterAnalyzer.CalculateDDProcessAVG(movementCollection); vm.DDProcessMAX = ParameterAnalyzer.CalculateDDProcessMAX(movementCollection); vm.DDProcessMIN = ParameterAnalyzer.CalculateDDProcessMIN(movementCollection); vm.TotalDistance = ParameterAnalyzer.CalculateTotalDistance(movementCollection); vm.DDSpeedAVG = ParameterAnalyzer.CalculateDDSpeedAVG(movementCollection); vm.DDSpeedMAX = ParameterAnalyzer.CalculateDDSpeedMAX(movementCollection); vm.DDSpeedMIN = ParameterAnalyzer.CalculateDDSpeedMIN(movementCollection); vm.DDFirstTime = ParameterAnalyzer.CalculateDDFirstTime(movementCollection); vm.DDCount = ParameterAnalyzer.CalculateDDCount(movementCollection); vm.UTurnHorizontalCount = ParameterAnalyzer.CalculateUTurnHorizontalCount(movementCollection); vm.UTurnVerticalCount = ParameterAnalyzer.CalculateUTurnVerticalCount(movementCollection); // ParameterFixed Analyze vm.DDProcessAVGFixed = ParameterAnalyzerForMovementSupervised.CalculateDDProcessAVG(movementSupervisedCollection); vm.DDProcessMAXFixed = ParameterAnalyzerForMovementSupervised.CalculateDDProcessMAX(movementSupervisedCollection); vm.DDProcessMINFixed = ParameterAnalyzerForMovementSupervised.CalculateDDProcessMIN(movementSupervisedCollection); vm.TotalDistanceFixed = ParameterAnalyzerForMovementSupervised.CalculateTotalDistance(movementSupervisedCollection); vm.DDSpeedAVGFixed = ParameterAnalyzerForMovementSupervised.CalculateDDSpeedAVG(movementSupervisedCollection); vm.DDSpeedMAXFixed = ParameterAnalyzerForMovementSupervised.CalculateDDSpeedMAX(movementSupervisedCollection); vm.DDSpeedMINFixed = ParameterAnalyzerForMovementSupervised.CalculateDDSpeedMIN(movementSupervisedCollection); vm.UTurnHorizontalCountFixed = ParameterAnalyzerForMovementSupervised.CalculateUTurnHorizontalCount(movementSupervisedCollection); vm.UTurnVerticalCountFixed = ParameterAnalyzerForMovementSupervised.CalculateUTurnVerticalCount(movementSupervisedCollection); // var experimentStatistician = new ExperimentStatistician(); vm.Precision = experimentStatistician.CalculatePrecision(movementSupervisedCollection); vm.Recall = experimentStatistician.CalculateRecall(movementSupervisedCollection); vm.FMeasure = experimentStatistician.CalculateFMeasure(movementSupervisedCollection); return(View(vm)); }