3-ftransform-forecasting #5

Open
romanov73 wants to merge 27 commits from 3-f-transform into master
Showing only changes of commit a8b6cf7d29 - Show all commits

View File

@ -0,0 +1,40 @@
package ru.ulstu.controller;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ru.ulstu.configuration.ApiConfiguration;
import ru.ulstu.datamodel.exception.ModelingException;
import ru.ulstu.datamodel.ts.TimeSeries;
import ru.ulstu.estimate.CompressionMetricService;
import ru.ulstu.service.UtilService;
import ru.ulstu.target.AnomalyDifferenceSmoothed;
import ru.ulstu.target.Target;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ExecutionException;
@RestController
@RequestMapping(ApiConfiguration.API_1_0)
public class AnomalyController {
private final UtilService utilService;
private final Target target;
public AnomalyController(UtilService utilService, CompressionMetricService compressionMetricService, AnomalyDifferenceSmoothed anomalyDifferenceSmoothed) {
this.utilService = utilService;
this.target = anomalyDifferenceSmoothed;
}
@PostMapping("getAnomalyAtDifferenceSmothed")
@Operation(description = "Получить метрику сжатия")
public ResponseEntity<TimeSeries> getRandomTimeSeries(@RequestParam("length") int length) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
var randomTS = utilService.getRandomTimeSeries(length);
var tsResult = target.calculate(randomTS);
return new ResponseEntity<>( tsResult, HttpStatus.OK);
}
}