Documentation ¶
Index ¶
- Variables
- type ColumnConfig
- type Config
- type Constraint
- type ConstraintTarget
- type ConstraintType
- type DataRow
- type DataRowReader
- type Driver
- type EventSubscriber
- type Metrics
- func (m Metrics) BlankCount() int64
- func (m Metrics) CoherenceRateValidate() int
- func (m Metrics) IdentifiantRateValidate() int
- func (m Metrics) K() int
- func (m Metrics) MaskedRate() float64
- func (m Metrics) MaskedRateValidate() int
- func (m Metrics) NonBlankCount() int64
- func (m Metrics) NonMaskedCount() int64
- func (m *Metrics) Update(fieldname string, realValue any, maskedValue any, coherenceValue []any, ...) bool
- func (m Metrics) Validate() int
- type Multimap
- type Report
- type Suscribers
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 ColumnConfig ¶ added in v0.2.0
type ColumnConfig struct { Exclude []any // exclude values from the masking rate computation (default: exclude only nil values) CoherentWith []string // list of fields from witch the coherent rate is computed (default: the current field) Constraints []Constraint // list of constraints to validate }
func NewDefaultColumnConfig ¶ added in v0.2.0
func NewDefaultColumnConfig(columnname string) ColumnConfig
type Config ¶ added in v0.2.0
type Config struct { ColumnNames []string ColumnConfigs map[string]ColumnConfig }
type Constraint ¶ added in v0.2.0
type Constraint struct { Target ConstraintTarget Type ConstraintType Value float64 }
type ConstraintTarget ¶ added in v0.2.0
type ConstraintTarget int
const ( MaskingRate ConstraintTarget = iota CohenrentRate IdentifiantRate )
type ConstraintType ¶ added in v0.2.0
type ConstraintType int
const ( ShouldEqual ConstraintType = iota ShouldBeGreaterThan ShouldBeGreaterThanOrEqualTo ShouldBeLowerThan ShouldBeLessThanOrEqualTo )
type DataRowReader ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func NewDriver ¶
func NewDriver(realReader DataRowReader, maskedReader DataRowReader, subs ...EventSubscriber) Driver
type EventSubscriber ¶
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 Constraints []Constraint // Constraints is the set of rules to validate }
func NewMetrics ¶
func NewMetrics(constraints ...Constraint) Metrics
func (Metrics) BlankCount ¶
BlankCount is the number of blank (null or empty) values in real data.
func (Metrics) CoherenceRateValidate ¶ added in v0.2.0
CoherenceRateValidate returns :
- -1 if at least one constraint fail on the CoherenceRate,
- 0 if no constraint exist on the CoherenceRate,
- 1 if all constraints succeed on the CoherenceRate,
func (Metrics) IdentifiantRateValidate ¶ added in v0.2.0
IdentifiantRateValidate returns :
- -1 if at least one constraint fail on the IdentifiantRate,
- 0 if no constraint exist on the IdentifiantRate,
- 1 if all constraints succeed on the IdentifiantRate,
func (Metrics) MaskedRate ¶
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) MaskedRateValidate ¶ added in v0.2.0
MaskedRateValidate returns :
- -1 if at least one constraint fail on the MaskedRate,
- 0 if no constraint exist on the MaskedRate,
- 1 if all constraints succeed on the MaskedRate,
func (Metrics) NonBlankCount ¶
NonBlankCount is the number of non-blank (non-null and non-empty) values in real data.
func (Metrics) NonMaskedCount ¶
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, coherenceValue []any, subs Suscribers, config ColumnConfig, ) bool
type Multimap ¶
type Report ¶
func NewReport ¶
func NewReport(subs []EventSubscriber, config Config) Report
func (Report) ColumnMetric ¶
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)
Click to show internal directories.
Click to hide internal directories.