package org.jeecg.yw;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.yw.ml.LinearRegression;
import org.jeecg.yw.spark.index;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

@RestController
@RequestMapping("/analysis")
public class analysis {
    @RequestMapping("/data")
    public Result test(@RequestBody Map<String, Object> map) {
        JSONObject json = new JSONObject();
        json.put("healthScore", index.getScore(map));
        json.put("foodRecommendations", LinearRegression.getResult(map));
        return Result.ok(json);
    }
}
