implement trend detection logic
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
- for now aimed to detect weekly trends in car distances, easily extendable to all other attributes of the statsm model - including test
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package SuMoC.backend.trenddetection;
|
||||
|
||||
import SuMoC.backend.trenddetection.enums.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class TrendDetection {
|
||||
private Long userId;
|
||||
private TrendTimespan timespan;
|
||||
private TrendType type;
|
||||
private StatAttribute attribute;
|
||||
private DeltaType deltaType;
|
||||
private double changeValue;
|
||||
|
||||
public TrendConnotation getTrendConnotation() {
|
||||
if (this.type == TrendType.INCREASING) {
|
||||
return switch (attribute) {
|
||||
case CAR_DISTANCE -> TrendConnotation.NEGATIVE;
|
||||
default -> TrendConnotation.NEUTRAL;
|
||||
};
|
||||
} else if (type == TrendType.DECREASING) {
|
||||
return switch (attribute) {
|
||||
case CAR_DISTANCE -> TrendConnotation.POSITIVE;
|
||||
default -> TrendConnotation.NEUTRAL;
|
||||
};
|
||||
} else {
|
||||
return TrendConnotation.NEUTRAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user