pipeline

package
v0.0.0-...-21ec7a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

This takes some health data on strokes you can find at: https://www.kaggle.com/fedesoriano/stroke-prediction-dataset

It converts that data to a standard format with enumerators in the first stage and then writes out some stats in the second stage (how many were Males, Females, Married, ...).

Index

Constants

View Source
const (
	Residence_type
)

Variables

This section is empty.

Functions

func Calculate

func Calculate(ctx context.Context, in interface{}) (data interface{}, err error)

func Transformer

func Transformer(ctx context.Context, in interface{}) (data interface{}, err error)

Transformer transforms a csv line ([]string) representing a Victim into a Victim type.

Types

type Conditions

type Conditions struct {
	HyperTension  bool
	HeartDisease  bool
	GlucoseLevel  float64
	BMI           float64
	SmokingStatus SmokingStatus
	PrevStroke    bool
}

func (*Conditions) Unmarshal

func (c *Conditions) Unmarshal(line []string) error

type Data

type Data struct {
	Columns []string
	Victim  Victim
	Stats   *Stats
}

type Residence

type Residence int8
const (
	ResidenceUnknown Residence = 0
	Urban            Residence = 1
	Rural            Residence = 2
)

func (*Residence) Unmarshal

func (r *Residence) Unmarshal(s string) error

type Sex

type Sex int8
const (
	SexUnknown Sex = 0
	Male       Sex = 1
	Female     Sex = 2
	SexOther       = 3
)

type SmokingStatus

type SmokingStatus int8
const (
	SmokingStatusUnknown SmokingStatus = 0
	Smoked               SmokingStatus = 1
	NeverSmoked          SmokingStatus = 2
	Smokes               SmokingStatus = 3
	FormerlySmoked       SmokingStatus = 4
)

func (*SmokingStatus) Unmarshal

func (s *SmokingStatus) Unmarshal(str string) error

type Social

type Social struct {
	Married   bool
	WorkType  WorkType
	Residence Residence
}

func (*Social) Unmarshal

func (s *Social) Unmarshal(line []string) error

type Stats

type Stats struct {
	Victims                   int32
	Males                     int32
	Females                   int32
	MalesWithGreaterThanOne   int32
	FemalesWithGreaterThanOne int32
	PercentMalesMarried       float64
	PrecentFemalesMarried     float64
	// contains filtered or unexported fields
}

func (*Stats) Finalize

func (s *Stats) Finalize()

type StrokeDataParser

type StrokeDataParser struct {
	// contains filtered or unexported fields
}

func New

func New(in chan streaming.Request) *StrokeDataParser

func (*StrokeDataParser) Parse

func (s *StrokeDataParser) Parse(stream *streaming.Streamer) (*Stats, error)

type Victim

type Victim struct {
	ID  int
	Sex Sex
	Age float64

	Conditions Conditions
	Social     Social
}

func (*Victim) Unmarshal

func (v *Victim) Unmarshal(line []string) (Victim, error)

type WorkType

type WorkType int8
const (
	WorkTypeUnknown WorkType = 0
	Private         WorkType = 1
	SelfEmployed    WorkType = 2
	Govtjob         WorkType = 3
	Parent          WorkType = 4
	NeverEmployed   WorkType = 5
)

func (*WorkType) Unmarshal

func (w *WorkType) Unmarshal(s string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL