File size: 570 Bytes
dfd3544
 
 
 
 
 
 
 
 
 
a4aa491
 
 
 
dfd3544
a4aa491
 
dfd3544
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package request

import (
	"fmt"

	"github.com/go-gota/gota/dataframe"
	"github.com/gofiber/fiber/v2"
)

type Payload struct {
	CSVData   string   `json:"csv_data"`
	Features  []string `json:"features"`
	Target    string   `json:"target"`
	Algorithm string   `json:"algorithm"`

	Args map[string]interface{} `json:"args"`
	Df   dataframe.DataFrame
}

func (p *Payload) SetDf(df dataframe.DataFrame) {
	p.Df = df
}

func NewPayload(dest *Payload, c *fiber.Ctx) error {
	if err := c.BodyParser(dest); err != nil {
		return fmt.Errorf("invalid JSON data")
	}
	return nil
}