mimo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrReadingDataRow is returned when an error occurs while reading a data row.
	ErrReadingDataRow = errors.New("error while reading datarow")

	// ErrOrphanRow is returned when a original row does not have a masked version, or the other way around.
	ErrOrphanRow = errors.New("error datarow is orphan")
)

Functions

This section is empty.

Types

type DataRow

type DataRow map[string]any

type DataRowReader

type DataRowReader interface {
	ReadDataRow() (DataRow, error)
}

type Driver

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

func NewDriver

func NewDriver(realReader DataRowReader, maskedReader DataRowReader, subs ...EventSubscriber) Driver

func (Driver) Analyze

func (d Driver) Analyze() (Report, error)

type EventSubscriber

type EventSubscriber interface {
	NewField(fieldname string)
	FirstNonMaskedValue(fieldname string, value any)
}

type Metrics

type Metrics struct {
	TotalCount  int64    // TotalCount is the number of values analyzed
	NilCount    int64    // NilCount is the number of null values in real data
	EmptyCount  int64    // EmptyCount is the number of empty values in real data (empty string or numbers at 0 value)
	MaskedCount int64    // MaskedCount is the number of non-blank real values masked
	Coherence   Multimap // Coherence is a multimap used to compute the coherence rate
	Identifiant Multimap // Identifiant is a multimap used to compute the identifiable rate
}

func NewMetrics

func NewMetrics() Metrics

func (Metrics) BlankCount

func (m Metrics) BlankCount() int64

BlankCount is the number of blank (null or empty) values in real data.

func (Metrics) K

func (m Metrics) K() int

K is the minimum number of value pseudonym was attributed.

func (Metrics) MaskedRate

func (m Metrics) MaskedRate() float64

MaskedRate is equal to

Number of non-blank real values masked
  / (Number of values analyzed - Number of blank (null or empty) values in real data) ).

func (Metrics) NonBlankCount

func (m Metrics) NonBlankCount() int64

NonBlankCount is the number of non-blank (non-null and non-empty) values in real data.

func (Metrics) NonMaskedCount

func (m Metrics) NonMaskedCount() int64

NonMaskedCount is the number of non-blank (non-null and non-empty) values in real data that were not masked.

func (*Metrics) Update

func (m *Metrics) Update(fieldname string, realValue any, maskedValue any, subs Suscribers) bool

type Multimap

type Multimap map[string]map[string]int

func (Multimap) Add

func (m Multimap) Add(key string, value string)

Add a key/value pair to the multimap.

func (Multimap) Count

func (m Multimap) Count(key string) int

Count the number of values associated to key.

func (Multimap) CountMin

func (m Multimap) CountMin() int

CountMin returns the minimum count of values associated to a key across the map.

func (Multimap) Rate

func (m Multimap) Rate() float64

Rate return the percentage of keys that have a count of 1.

type Report

type Report struct {
	Metrics map[string]Metrics
	// contains filtered or unexported fields
}

func NewReport

func NewReport(subs []EventSubscriber) Report

func (Report) ColumnMetric

func (r Report) ColumnMetric(colname string) Metrics

func (Report) Columns

func (r Report) Columns() []string

func (Report) Update

func (r Report) Update(realRow DataRow, maskedRow DataRow)

type Suscribers

type Suscribers []EventSubscriber

func (Suscribers) PostFirstNonMaskedValue

func (subs Suscribers) PostFirstNonMaskedValue(fieldname string, value any)

func (Suscribers) PostNewField

func (subs Suscribers) PostNewField(fieldname string)

Jump to

Keyboard shortcuts

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