data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddParsedData

func AddParsedData(p gnparser.GNparser, nu *coldp.NameUsage)

Types

type Accessor

type Accessor interface {
	// Label returns a short, unique identifier for the external data source.
	// This label is typically used for internal identification and file naming.
	// For example: "itis".
	Label() string

	// Name returns the official, human-readable name of the external data
	// source. For example: "Integrated Taxonomic Information System".
	Name() string

	// Config returns the configuration data.
	Config() config.Config

	// Description provides a detailed description of the data source, including
	// information about its data structure, update frequency, and any known
	// limitations.  If the conversion process involves manual steps, those steps
	// MUST be documented clearly in this description.
	Description() string

	// ManualSteps returns true if the conversion process requires manual
	// intervention or steps that cannot be fully automated.  If true, the
	// Description() method MUST provide detailed instructions for these manual
	// steps.
	ManualSteps() bool
}

Accessor provides methods to get data from internal fields of the Accessor implenentation.

type Convertor

type Convertor interface {
	Accessor
	Processor
}

Convertor provides methods for converting data from an external source to the SFGA file format. Implementations of this interface handle the specific details of each external data source (e.g., ITIS, GBIF, etc.).

type DataSet

type DataSet struct {
	// Label is a short, unique identifier for the external data source. This
	// label is typically used for internal identification and file naming. For
	// example: "itis".
	Label string

	// Name returns the official, human-readable name of the external data
	// source. For example: "Integrated Taxonomic Information System".
	Name string
	// Notes provides a detailed description of the data source,
	// including information about its data structure, update frequency, and
	// any known limitations.  If the conversion process involves manual steps,
	// those steps MUST be documented clearly in this description.
	Notes string

	// ManualSteps is true if the conversion process requires manual
	// intervention or steps that cannot be fully automated.  If true, the
	// Description MUST provide detailed instructions for these manual steps.
	ManualSteps bool
	// URL provides the URL from which the source's data can be downloaded.
	// The URL can be provided by the maintainers of the source, or be
	// manually created if not available otherwise.
	URL string

	// New function creates the instance of Convertor interface from the
	// data provided in the set.
	New func(DataSet) Convertor
}

DataSet contains metadata required for conversion of an external biodiversity data source to SFGA format.

type Processor

type Processor interface {
	// Download downloads the data from the external source and stores it in a
	// local cache. It returns the path to the downloaded file in the cache.  If
	// the download fails, an error is returned, and the returned path may be an
	// empty string.  Implementations should handle caching appropriately (e.g.,
	// checking if the file already exists before downloading).
	Download() (string, error)

	// Extract extracts the relevant data from the downloaded file.  The 'path'
	// argument is the path returned by the Download() method.  The extracted
	// data should be placed in a separate cache directory.  An error is returned
	// if extraction fails.
	Extract(path string) error

	// InitSfga creates empty sfga.Archive and returns its instance.
	// In case of a failure it returns an error.
	InitSfga() (sfga.Archive, error)

	// ToSfga converts the extracted data to the SFGA file format.  This method
	// should use the data previously extracted by the Extract() method.  An
	// error is returned if the conversion fails.
	ToSfga(sfga.Archive) error
}

Processor contains actions for converting source into SFGArchive.

Jump to

Keyboard shortcuts

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