Version: v0.1.330 Latest Latest

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

Go to latest
Published: Jul 7, 2021 License: GPL-3.0 Imports: 10 Imported by: 0



Package quality implements quality checks. TODO: Look at the JSON schema.



This section is empty.


View Source
var (
	// EarliestDate is the earliest publication date we accept.
	EarliestDate = time.Date(1458, 1, 1, 0, 0, 0, 0, time.UTC)
	// LatestDate represents the latest publication date we accept. Five years into the future.
	LatestDate = time.Now().AddDate(5, 0, 0)

	ErrInvalidEndPage              = errors.New("broken end page")
	ErrInvalidStartPage            = errors.New("broken start page")
	ErrEndPageBeforeStartPage      = errors.New("end page before start page")
	ErrSuspiciousPageCount         = errors.New("suspicious page count")
	ErrInvalidURL                  = errors.New("invalid URL")
	ErrKeyTooLong                  = fmt.Errorf("record id exceeds key limit of %d", span.KeyLengthLimit)
	ErrPublicationDateTooEarly     = errors.New("publication date too early")
	ErrRepeatedSubtitle            = errors.New("repeated subtitle")
	ErrCurrencyInTitle             = errors.New("currency in title")
	ErrExcessivePunctuation        = errors.New("excessive punctuation")
	ErrNoPublisher                 = errors.New("no publisher")
	ErrShortAuthorName             = errors.New("very short author name")
	ErrEtAlAuthorName              = errors.New("et al in author name")
	ErrNAInAuthorName              = errors.New("NA in author name")
	ErrWhitespaceAuthor            = errors.New("whitespace author")
	ErrHTMLEntityInAuthorName      = errors.New("html entity in author name")
	ErrRepeatedSlashInDOI          = errors.New("repeated slash in DOI")
	ErrNoURL                       = errors.New("record has no URL")
	ErrNonCanonicalISSN            = errors.New("non-canonical ISSN")
	ErrAtSignInAuthorName          = errors.New("@ in author name")
	ErrHTTPInAuthorName            = errors.New("http: in author name")
	ErrBlacklistedWordInAuthorName = errors.New("blacklisted word in author name")
	ErrLongAuthorName              = errors.New("long author name")
	ErrPageZero                    = errors.New("page is zero")
	ErrTitleTooLong                = errors.New("title too long")


func TestCanonicalISSN

func TestCanonicalISSN(is finc.IntermediateSchema) error

TestCanonicalISSN checks for the canonical ISSN format 1234-567X.

func TestCurrencyInTitle

func TestCurrencyInTitle(is finc.IntermediateSchema) error

TestCurrencyInTitle, e.g. http://goo.gl/HACBcW Cartier , Marie . Baby, You Are My Religion: Women, Gay Bars, and Theology Before Stonewall . Gender, Theology and Spirituality. Durham, UK: Acumen, 2013. xii+256 pp. $90.00 (cloth); $29.95 (paper).

func TestDate

func TestDate(is finc.IntermediateSchema) error

TestDate checks for suspicious dates, refs. #5686.

func TestExcessivePunctuation

func TestExcessivePunctuation(is finc.IntermediateSchema) error

TestExcessivePunctuation should detect things like this title: CrossRef????????????? https://goo.gl/AD0V1o

func TestFeasibleAuthor

func TestFeasibleAuthor(is finc.IntermediateSchema) error

TestFeasibleAuthor checks for a few suspicious authors patterns, refs. #4892, #4940, #5895.

func TestFincStageOne

func TestFincStageOne(is finc.IntermediateSchema) error

TestFincStageOne refers to stages from #9803.

func TestFincStageThree

func TestFincStageThree(is finc.IntermediateSchema) error

TestFincStageThree refers to stages from #9803.

func TestFincStageTwo

func TestFincStageTwo(is finc.IntermediateSchema) error

TestFincStageTwo refers to stages from #9803.

func TestHasURL

func TestHasURL(is finc.IntermediateSchema) error

TestHasURL checks for a value in URL. This is no URL validation.

func TestKeyLength

func TestKeyLength(is finc.IntermediateSchema) error

TestKeyLength checks the length of the record id. memcachedb limits is 250 bytes.

func TestPageCount

func TestPageCount(is finc.IntermediateSchema) error

TestPageCount checks, wether the start and end page look plausible.

func TestPublisher

func TestPublisher(is finc.IntermediateSchema) error

TestPublisher tests, whether a publisher is given.

func TestRepeatedSlashInDOI

func TestRepeatedSlashInDOI(is finc.IntermediateSchema) error

TestRepeatedSlashInDOI checks a DOI for repeated slashes, refs. #6312.

func TestSubtitleRepetition

func TestSubtitleRepetition(is finc.IntermediateSchema) error

TestSubtitleRepetition, refs #6553.

func TestTitleTooLong

func TestTitleTooLong(is finc.IntermediateSchema) error

TestTitleTooLong returns an err if the title exceeds a limit, refs. #9230.

func TestURL

func TestURL(is finc.IntermediateSchema) error

TestURL check if URLs are in order.


type Issue

type Issue struct {
	Err    error                   `json:"err"`
	Record finc.IntermediateSchema `json:"record"`

func (Issue) Error

func (i Issue) Error() string

func (Issue) MarshalJSON

func (i Issue) MarshalJSON() ([]byte, error)

type Tester

type Tester interface {
	TestRecord(finc.IntermediateSchema) error

Tester is a intermediate record checker.

type TesterFunc

type TesterFunc func(finc.IntermediateSchema) error

TesterFunc makes a function satisfy an interface.

func (TesterFunc) TestRecord

func (f TesterFunc) TestRecord(is finc.IntermediateSchema) error

TestRecord delegates test to the given func.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL