#3 -- add smoothing by specific method
This commit is contained in:
parent
8201842801
commit
aa4f389bf0
@ -14,6 +14,7 @@ import ru.ulstu.HttpUtils;
|
|||||||
import ru.ulstu.configuration.ApiConfiguration;
|
import ru.ulstu.configuration.ApiConfiguration;
|
||||||
import ru.ulstu.datamodel.ForecastParams;
|
import ru.ulstu.datamodel.ForecastParams;
|
||||||
import ru.ulstu.datamodel.ModelingResult;
|
import ru.ulstu.datamodel.ModelingResult;
|
||||||
|
import ru.ulstu.datamodel.SmoothingParams;
|
||||||
import ru.ulstu.datamodel.exception.ModelingException;
|
import ru.ulstu.datamodel.exception.ModelingException;
|
||||||
import ru.ulstu.datamodel.ts.TimeSeries;
|
import ru.ulstu.datamodel.ts.TimeSeries;
|
||||||
import ru.ulstu.method.Method;
|
import ru.ulstu.method.Method;
|
||||||
@ -57,6 +58,16 @@ public class TimeSeriesController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("getSpecificMethodSmoothed")
|
||||||
|
@Operation(description = "Получить сглаженный временной ряд выбранным методом")
|
||||||
|
public ResponseEntity<ModelingResult> getSpecificMethodSmoothedTimeSeries(@RequestBody @Valid SmoothingParams smoothingParams, HttpServletRequest request) throws ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, ModelingException {
|
||||||
|
LOGGER.info("User ip: " + HttpUtils.getUserIp(request));
|
||||||
|
LOGGER.info("Time series for smoothing: " + smoothingParams.getOriginalTimeSeries());
|
||||||
|
ResponseEntity<ModelingResult> result = new ResponseEntity<>(timeSeriesService.smoothTimeSeries(smoothingParams.getOriginalTimeSeries(), smoothingParams.getMethodClassName()), HttpStatus.OK);
|
||||||
|
LOGGER.info("Smoothing complete");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("getSpecificMethodForecast")
|
@PostMapping("getSpecificMethodForecast")
|
||||||
@Operation(description = "Получить прогноз временного ряда указанным методом")
|
@Operation(description = "Получить прогноз временного ряда указанным методом")
|
||||||
public ResponseEntity<ModelingResult> getForecastTimeSeriesSpecificMethod(@RequestBody @Valid ForecastParams forecastParams, HttpServletRequest request) throws ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, ModelingException {
|
public ResponseEntity<ModelingResult> getForecastTimeSeriesSpecificMethod(@RequestBody @Valid ForecastParams forecastParams, HttpServletRequest request) throws ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, ModelingException {
|
||||||
|
35
src/main/java/ru/ulstu/datamodel/SmoothingParams.java
Normal file
35
src/main/java/ru/ulstu/datamodel/SmoothingParams.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package ru.ulstu.datamodel;
|
||||||
|
|
||||||
|
import ru.ulstu.datamodel.ts.TimeSeries;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class SmoothingParams {
|
||||||
|
@NotNull
|
||||||
|
private TimeSeries originalTimeSeries;
|
||||||
|
private String methodClassName;
|
||||||
|
|
||||||
|
public TimeSeries getOriginalTimeSeries() {
|
||||||
|
return originalTimeSeries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalTimeSeries(TimeSeries originalTimeSeries) {
|
||||||
|
this.originalTimeSeries = originalTimeSeries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethodClassName() {
|
||||||
|
return methodClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethodClassName(String methodClassName) {
|
||||||
|
this.methodClassName = methodClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ForecastParams{" +
|
||||||
|
"originalTimeSeries=" + originalTimeSeries +
|
||||||
|
", methodClassName=" + methodClassName +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user