mapping

package
v0.0.0-...-457a45f Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

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

Mapper handles data mapping/translation tasks.

func NewMapper

func NewMapper(s *sources.Database) *Mapper

NewMapper starts a new background processor and returns the newly created Mapper instance.

func (*Mapper) Start

func (m *Mapper) Start(fname string, opts *Options) string

Start a new identifier mapping task in the background and return a job token.

func (*Mapper) Status

func (m *Mapper) Status(token string) (res *Result, done bool)

Status checks for a Result using the given job-token.

type Options

type Options struct {
	// FromField indicates the input Field in each record used for Mapping.
	FromField string

	// FromSource indicates the source for identifiers in FromField.
	FromSource string

	// ToSource indicates the source to map identifiers to.
	ToSource string

	// Replace is true if the values should be replaced in-place,
	// false if the mapped values should be appended.
	Replace bool

	// DropMissing indicates that rows that could not be mapped should be
	// dropped from output. If false, empty values are used.
	DropMissing bool

	// OutputFormat describes the requested output format.
	OutputFormat string
}

Options records various mapping parameters to control the process.

type Result

type Result struct {
	// Token for retrieving result metadata.
	Token string `json:"token"`

	// Options that were used to drive the mapping process.
	Options *Options `json:"options"`

	// Log of the versions/timestamps of data and software used for mapping.
	Log string `json:"log"`
	// Methods contains a prose description of the process used to map values.
	Methods string `json:"methods"`
	// Citations contains a list of citations that match the Methods.
	Citations []string `json:"citations"`
	// NewFilename contains the filename for the output mapped CSV file.
	NewFilename string `json:"newfilename"`

	// Stats for how the mapping went.
	Stats *Stats `json:"stats"`
}

Result describes the mapping process and results.

type Stats

type Stats struct {
	// StartTime of the mapping process.
	StartTime time.Time `json:"start_time"`

	// EndTime of the mapping process.
	EndTime time.Time `json:"end_time"`

	// TotalRecords counts the total number of records processed.
	TotalRecords int `json:"total_records"`

	// SourceMissingRecords counts the number of records that contained a
	// Source ID that was not in the mapping dataset.
	SourceMissingRecords int `json:"source_missing_records"`

	// SourceMissingValues is similar to SourceMissingRecords but instead
	// counts the number of unique values missing.
	SourceMissingValues int `json:"source_missing_values"`

	// DestinationMultipleRecords counts the number of input records that
	// contained a Source ID that had multiple mapped values each.
	DestinationMultipleRecords int `json:"destination_multiple_records"`

	// DestinationMultipleValues is similar to DestinationMultipleRecords
	// but instead counts the number of unique values with multiple hits.
	DestinationMultipleValues int `json:"destination_multiple_values"`

	// DestinationMultipleNewCount counts the number of new records added
	// as a result of multiple mappings.
	DestinationMultipleNewCount int `json:"destination_multiple_new"`
}

Stats describes various metrics for how the mapping went.

Jump to

Keyboard shortcuts

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