dataset

package
v0.0.0-...-f71a3e0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VoieSpécialeNonRenseignée = iota
	VoieSpécialeSansObjet
	PisteCyclable
	BandeCyclable
	AutreVoieSpéciale
)
View Source
const (
	GravitéNonRenseignée = iota
	Indemne
	Tué
	BlesséHospitalisé
	BlesséLéger
)
View Source
const (
	SexeNonRenseigné = iota
	Masculin
	Féminin
)

Variables

View Source
var (
	YearDatasetReaders map[uint]YearDatasetReader
	Years              []uint
	FirstYear          uint
	LastYear           uint
)

Functions

func Filter

func Filter[T any](slice []T, include func(T) bool) []T

func ToJson

func ToJson(obj any) (string, error)

func ToSliceOfAny

func ToSliceOfAny[T any](in []T) []any

func WriteCsv

func WriteCsv(objs []any, path *string) error

Types

type Accident

type Accident struct {
	IdAccident    string
	Date          string
	Département   string
	Commune       *int
	Adresse       string
	Latitude      string
	Longitude     string
	Lieu          *Lieu
	Véhicules     []*Véhicule
	AutresUsagers []*Usager // Users not associated with a vehicle
}

func (Accident) AsJson

func (accident Accident) AsJson() (string, error)

type CatégorieUsager

type CatégorieUsager int
const (
	Conducteur CatégorieUsager = iota
	Passager
	Piéton
)

func (CatégorieUsager) MarshalJSON

func (catégorieUsager CatégorieUsager) MarshalJSON() ([]byte, error)

func (CatégorieUsager) String

func (catégorieUsager CatégorieUsager) String() string

type CatégorieVéhicule

type CatégorieVéhicule int
const (
	CatégorieVéhiculeIndéterminable CatégorieVéhicule = iota
	Bicyclette
	Scooter
	Motocyclette
	VéhiculeLéger
	VéhiculeUtilitaire
	PoidsLourd
	Autobus
	Autocar
	Train
	Tramway
	AutreVéhicule
)

func (CatégorieVéhicule) MarshalJSON

func (catégorieVéhicule CatégorieVéhicule) MarshalJSON() ([]byte, error)

func (CatégorieVéhicule) String

func (catégorieVéhicule CatégorieVéhicule) String() string

type Gravité

type Gravité int

func (Gravité) MarshalJSON

func (gravité Gravité) MarshalJSON() ([]byte, error)

func (Gravité) String

func (gravité Gravité) String() string

type Jsonable

type Jsonable interface {
	AsJson() (string, error)
}

type Lieu

type Lieu struct {
	IdAccident   string
	VoieSpéciale VoieSpéciale
}

func (Lieu) AsJson

func (lieu Lieu) AsJson() (string, error)

type Sexe

type Sexe int

func (Sexe) MarshalJSON

func (sexe Sexe) MarshalJSON() ([]byte, error)

func (Sexe) String

func (sexe Sexe) String() string

type Usager

type Usager struct {
	IdVéhicule      string
	IdAccident      string
	CatégorieUsager CatégorieUsager
	Gravité         Gravité
	Sexe            Sexe
	AnnéeNaissance  int
}

func (Usager) AsJson

func (usager Usager) AsJson() (string, error)

type VoieSpéciale

type VoieSpéciale int

func (VoieSpéciale) MarshalJSON

func (voieSpéciale VoieSpéciale) MarshalJSON() ([]byte, error)

func (VoieSpéciale) String

func (voieSpéciale VoieSpéciale) String() string

type Véhicule

type Véhicule struct {
	IdVéhicule        string
	IdAccident        string
	CatégorieVéhicule CatégorieVéhicule
	Usagers           []*Usager
}

func (Véhicule) AsJson

func (véhicule Véhicule) AsJson() (string, error)

type YearDatasetReader

type YearDatasetReader interface {
	ReadCharacteristics(year uint, dataPath string) (accidents []*Accident, err error)
	ReadPlaces(year uint, dataPath string) (places []*Lieu, err error)
	ReadVehicles(year uint, dataPath string) (vehicles []*Véhicule, err error)
	ReadUsers(year uint, dataPath string) (users []*Usager, err error)
}

type YearDatasetReader1

type YearDatasetReader1 struct{}

func (*YearDatasetReader1) ReadCharacteristics

func (*YearDatasetReader1) ReadCharacteristics(year uint, dataPath string) (accidents []*Accident, err error)

func (*YearDatasetReader1) ReadPlaces

func (*YearDatasetReader1) ReadPlaces(year uint, dataPath string) (places []*Lieu, err error)

func (*YearDatasetReader1) ReadUsers

func (*YearDatasetReader1) ReadUsers(year uint, dataPath string) (users []*Usager, err error)

func (*YearDatasetReader1) ReadVehicles

func (*YearDatasetReader1) ReadVehicles(year uint, dataPath string) (vehicles []*Véhicule, err error)

type YearDatasetReader2

type YearDatasetReader2 struct{}

func (*YearDatasetReader2) ReadCharacteristics

func (*YearDatasetReader2) ReadCharacteristics(year uint, dataPath string) (accidents []*Accident, err error)

func (*YearDatasetReader2) ReadPlaces

func (*YearDatasetReader2) ReadPlaces(year uint, dataPath string) (places []*Lieu, err error)

func (*YearDatasetReader2) ReadUsers

func (*YearDatasetReader2) ReadUsers(year uint, dataPath string) (users []*Usager, err error)

func (*YearDatasetReader2) ReadVehicles

func (*YearDatasetReader2) ReadVehicles(year uint, dataPath string) (vehicles []*Véhicule, err error)

Jump to

Keyboard shortcuts

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