config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InputDir added in v0.0.9

func InputDir() string

Types

type Config

type Config struct {
	// BHLDumpURL contains the URL containing Biodiversity Heritage Library
	// dump files. These files provide metadata necessary for connection of
	// names occurrences with BHL pages.
	BHLDumpURL string

	// BHLNamesURL provides URL to BHLindex Data. This data provides names
	// occurrences and verifications. Together with data from BHL dumps it allows
	// to connect a name to pages in BHL.
	BHLNamesURL string

	// CoLDataURL provides a URL to the Catalogue of Life data in Darwin Core
	// format.
	CoLDataURL string

	// DbHost provides an IP or host name where PostgreSQL is located. The
	// database is used as the major data store for the project.
	DbHost string

	// DbUser is the username in PostgreSQL database. The user must have
	// writing permissions to the database.
	DbUser string

	// DbPass is the password for DBUser.
	DbPass string

	// DbDatabase is the name of the database to keep BHLnames data. By default
	// it is `bhlnames`.
	DbDatabase string

	// JobsNum provides concurrency value for finding references that contain
	// specified names.
	JobsNum int

	// PortREST is used for BHLnames RESTful service port.
	PortREST int

	// Format determines format of the output data.
	Format gnfmt.Format

	// Delimiter allows to set a delimiter for ingesting input CSV files. These
	// files contain names and other metadata to use for matching names,
	// citations to BHL pages.
	Delimiter rune

	// WithSynonyms determines if to provide synonyms of a name in the output.
	WithSynonyms bool

	// WithRebuild determines if BHL dump data need to be uploaded again, or
	// the data from local cache can be used. If `true` then local cache is
	// ignored and data is downloaded from BHLDumpURL.
	WithRebuild bool

	// WithCoLRecalc indicates that calculation of CoL nomenclatural events
	// tables will be emptied, and CoL nomenclatural data will be reimported
	// before linking to BHL data.
	WithCoLRecalc bool

	// SortDesc determines the order of sorting the output data. If `true`
	// data are sorted by year from latest to earliest. If `false` then from
	// earliest to latest.
	SortDesc bool

	// WithShortenedOutput determines if references details will be provided.
	// If it is `true`, found references are not provided, only the metadata
	// about them.
	WithShortenedOutput bool

	// InputDir provides the `root` directory where all the BHLnames files are
	// created.
	InputDir string

	// DownloadBHLFile provides the path where BHL dump compressed file will be
	// stored.
	DownloadBHLFile string

	// DownloadNamesFile provides the path where BHL dump compressed file will be
	// stored.
	DownloadNamesFile string

	// DownloadCoLFile provides the path where CoL DwCA compressed file will be
	// stored.
	DownloadCoLFile string

	// DownloadDir is the directory where  BHLnames extracts data from
	// BHL dump.
	DownloadDir string

	// PageDir provides the directory where BHLnames keeps key-value database for
	// pages information. We do not have file name of a page connected to page ID
	// in the BHL data dump. So we have to calculate this ID by using page
	// sequence in a title. We find out page id by concatenation of
	// "FileNum|TitleID" fields.
	//
	// This key-value store is generated using data dump from BHL databse.
	PageDir string

	// PageFileDir provides the directory to a key-value store database that
	// connects BHL's PageID to the page's file name in the BHL corpus
	// directory structure.
	//
	// It is generated using bhlindex page dump and key-value store from
	// PageDir
	PageFileDir string

	// PartDir is another key-value database to keep data about BHL's `parts`.
	// A `part` is usually a distinct entity in `item`, for example it can be
	// an scientific paper.
	PartDir string

	// AhoCorasickDir provides a directory where Aho-Corasick algorithm stores
	// its cached data.
	AhoCorasickDir string

	// AhoCorKeyValDir provides a directory to keep a Key-Value store used by
	// AhoCorasic library.
	AhoCorKeyValDir string
}

Config contains data needed for BHLnames functionality.

func New added in v0.0.9

func New(opts ...Option) Config

type Option

type Option func(*Config)

Option type for changing GNfinder settings.

func OptBHLDumpURL added in v0.0.9

func OptBHLDumpURL(s string) Option

func OptBHLNamesURL added in v0.1.0

func OptBHLNamesURL(s string) Option

func OptCoLDataURL added in v0.1.1

func OptCoLDataURL(s string) Option

func OptDbHost

func OptDbHost(s string) Option

func OptDbName

func OptDbName(s string) Option

func OptDbPass

func OptDbPass(s string) Option

func OptDbUser

func OptDbUser(s string) Option

func OptDelimiter added in v0.0.9

func OptDelimiter(r rune) Option

func OptFormat

func OptFormat(f gnfmt.Format) Option

func OptInputDir

func OptInputDir(s string) Option

func OptJobsNum

func OptJobsNum(i int) Option

func OptPortREST

func OptPortREST(i int) Option

func OptShort

func OptShort(b bool) Option

func OptSortDesc

func OptSortDesc(b bool) Option

func OptWithCoLRecalc added in v0.1.1

func OptWithCoLRecalc(b bool) Option

func OptWithRebuild added in v0.0.9

func OptWithRebuild(b bool) Option

func OptWithShortenedOutput added in v0.0.9

func OptWithShortenedOutput(b bool) Option

func OptWithSynonyms added in v0.0.9

func OptWithSynonyms(b bool) Option

Jump to

Keyboard shortcuts

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