library

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	IdentityDecisionMerge = "merge"
	IdentityDecisionSplit = "split"
)
View Source
const (
	FidelitySupported   = "supported"
	FidelityPartial     = "partial"
	FidelityRedacted    = "redacted"
	FidelityUnsupported = "unsupported"
)

Variables

This section is empty.

Functions

func AppendIdentityConflict

func AppendIdentityConflict(path string, conflict IdentityConflictRecord) error

func AppendIdentityDecision

func AppendIdentityDecision(path string, decision IdentityDecision) error

func AppendIdentityDecisionThen added in v0.1.18

func AppendIdentityDecisionThen(path string, decision IdentityDecision, commit func() error) error

AppendIdentityDecisionThen appends a decision, runs commit, and restores the prior log if commit fails.

func ExportBibTeX

func ExportBibTeX(path string, records []PaperRecord) error

ExportBibTeX writes a minimal deterministic BibTeX file.

func ExportCSLJSON

func ExportCSLJSON(path string, records []PaperRecord) error

ExportCSLJSON writes PaperRecords as Zotero-compatible CSL-JSON items.

func ExportCSV

func ExportCSV(path string, records []PaperRecord) error

ExportCSV writes PaperRecords as stable CSV.

func ExportJSON

func ExportJSON(path string, records []PaperRecord) error

ExportJSON writes PaperRecords as stable, pretty JSON.

func ExportRIS

func ExportRIS(path string, records []PaperRecord) error

ExportRIS writes a minimal deterministic RIS file.

func ExportZoteroRDF

func ExportZoteroRDF(path string, records []PaperRecord) error

ExportZoteroRDF writes PaperRecords as a conservative Zotero-compatible RDF/XML subset.

Types

type Author

type Author struct {
	Given  string
	Family string
	ORCID  string
}

Author is one normalized paper author.

type DuplicateMatch

type DuplicateMatch struct {
	Duplicate bool
	Score     float64
	Reason    string
}

DuplicateMatch describes duplicate scoring between two PaperRecords.

func ScoreDuplicate

func ScoreDuplicate(left, right PaperRecord) DuplicateMatch

ScoreDuplicate scores whether two paper records represent the same scholarly work.

type FieldFidelity

type FieldFidelity struct {
	Status    string `json:"status"`
	Note      string `json:"note"`
	Preserved int    `json:"preserved,omitempty"`
	Lost      int    `json:"lost,omitempty"`
}

type Identifiers

type Identifiers struct {
	DOI               string
	ArXivID           string
	PMID              string
	PMCID             string
	OpenAlexID        string
	CrossrefID        string
	SemanticScholarID string
	ZoteroItemKey     string
	ADSBibcode        string
}

Identifiers are normalized scholarly IDs for a PaperRecord.

type IdentityCluster

type IdentityCluster struct {
	ID            string            `json:"id"`
	RecordIndexes []int             `json:"recordIndexes"`
	Identifiers   map[string]string `json:"identifiers"`
	Matches       []IdentityMatch   `json:"matches"`
}

type IdentityConflictRecord

type IdentityConflictRecord struct {
	SchemaVersion string `json:"schemaVersion"`
	ID            string `json:"id"`
	ClusterID     string `json:"clusterId"`
	Severity      string `json:"severity"`
	Reason        string `json:"reason"`
	RecordIndexes []int  `json:"recordIndexes"`
	Resolved      bool   `json:"resolved"`
}

func DetectIdentityConflicts

func DetectIdentityConflicts(report IdentityResolutionReport, records []PaperRecord) []IdentityConflictRecord

type IdentityDecision

type IdentityDecision struct {
	SchemaVersion string        `json:"schemaVersion"`
	ID            string        `json:"id"`
	ClusterID     string        `json:"clusterId"`
	Action        string        `json:"action"`
	Reviewer      string        `json:"reviewer,omitempty"`
	Reason        string        `json:"reason"`
	Reversible    bool          `json:"reversible"`
	Before        []PaperRecord `json:"before"`
	After         []PaperRecord `json:"after"`
}

type IdentityDecisionLog

type IdentityDecisionLog struct {
	SchemaVersion string                   `json:"schemaVersion"`
	Decisions     []IdentityDecision       `json:"decisions"`
	Conflicts     []IdentityConflictRecord `json:"conflicts"`
}

func ReadIdentityDecisionLog

func ReadIdentityDecisionLog(path string) (IdentityDecisionLog, error)

type IdentityMatch

type IdentityMatch struct {
	LeftIndex   int     `json:"leftIndex"`
	RightIndex  int     `json:"rightIndex"`
	Rule        string  `json:"rule"`
	Identifier  string  `json:"identifier"`
	Value       string  `json:"value"`
	Confidence  float64 `json:"confidence"`
	Explanation string  `json:"explanation"`
}

type IdentityResolutionReport

type IdentityResolutionReport struct {
	SchemaVersion        string            `json:"schemaVersion"`
	SupportedIdentifiers map[string]bool   `json:"supportedIdentifiers"`
	Clusters             []IdentityCluster `json:"clusters"`
}

func ResolveIdentityClusters

func ResolveIdentityClusters(records []PaperRecord) IdentityResolutionReport

type ImportSummary

type ImportSummary struct {
	Imported            int
	SkippedDuplicate    []string
	SkippedNoIdentifier int
}

ImportSummary reports the outcome of a resilient batch import.

type JabRefCollisionFinding

type JabRefCollisionFinding struct {
	CitationKey   string `json:"citationKey"`
	RecordIndexes []int  `json:"recordIndexes"`
}

type JabRefQualityIssue

type JabRefQualityIssue struct{ Kind, Severity, Message string }

type JabRefQualityReport

type JabRefQualityReport struct {
	SchemaVersion                  string                   `json:"schemaVersion"`
	RecordCount                    int                      `json:"recordCount"`
	MissingCitationKeys            []JabRefRecordFinding    `json:"missingCitationKeys,omitempty"`
	CitationKeyCollisions          []JabRefCollisionFinding `json:"citationKeyCollisions,omitempty"`
	GroupsAndSavedSearches         []JabRefRecordFinding    `json:"groupsAndSavedSearches,omitempty"`
	FieldCleanupDiffs              []JabRefRecordFinding    `json:"fieldCleanupDiffs,omitempty"`
	LinkedFilePrivacy              []JabRefRecordFinding    `json:"linkedFilePrivacy,omitempty"`
	ReviewerApprovedNormalizations []JabRefRecordFinding    `json:"reviewerApprovedNormalizations,omitempty"`
	Issues                         []JabRefQualityIssue     `json:"issues"`
}

func BuildJabRefQualityReport

func BuildJabRefQualityReport(records []PaperRecord) JabRefQualityReport

func (JabRefQualityReport) HasIssue

func (r JabRefQualityReport) HasIssue(kind string) bool

type JabRefRecordFinding

type JabRefRecordFinding struct {
	RecordIndex int    `json:"recordIndex"`
	Title       string `json:"title"`
	CitationKey string `json:"citationKey,omitempty"`
	Detail      string `json:"detail"`
}

type PaperRecord

type PaperRecord struct {
	// RecordID is the stable opaque identity assigned when the record enters a Store.
	RecordID      string `json:",omitempty"`
	Title         string
	Identifiers   Identifiers
	Authors       []Author
	Abstract      string
	Year          int
	Venue         string
	Publisher     string
	URLs          []string
	License       string
	OpenAccess    bool
	SourcePayload string
	SourceRefs    []SourceRef
}

PaperRecord is a normalized scholarly metadata entry for a paper or preprint.

func ApplyIdentityDecision

func ApplyIdentityDecision(records []PaperRecord, decision IdentityDecision) ([]PaperRecord, error)

ApplyIdentityDecision replaces decision.Before with decision.After within records, leaving every unrelated record untouched. It previously ignored records entirely and returned decision.After alone, which silently dropped every library record outside the decision's own cluster.

func ImportBibTeX

func ImportBibTeX(path string) ([]PaperRecord, int, error)

ImportBibTeX reads a minimal deterministic BibTeX fixture/export file. It skips entries that cannot be normalized into a storable PaperRecord and returns how many were skipped.

func ImportCSLJSON

func ImportCSLJSON(path string) ([]PaperRecord, int, error)

ImportCSLJSON reads Zotero-compatible CSL-JSON items into normalized PaperRecords.

func ImportCSV

func ImportCSV(path string) ([]PaperRecord, int, error)

ImportCSV reads PaperRecords from a deterministic CSV fixture/export file. It skips rows that cannot be normalized into a storable PaperRecord and returns how many were skipped.

func ImportJSON

func ImportJSON(path string) ([]PaperRecord, int, error)

ImportJSON reads PaperRecords from a deterministic JSON fixture/export file. It skips records that cannot be normalized into a storable PaperRecord (for example, records missing an identifier) and returns how many were skipped, so a single unstorable record cannot abort the whole import.

func ImportRIS

func ImportRIS(path string) ([]PaperRecord, int, error)

ImportRIS reads a minimal deterministic RIS fixture/export file. It skips entries that cannot be normalized into a storable PaperRecord and returns how many were skipped.

func ImportZoteroRDF

func ImportZoteroRDF(path string) ([]PaperRecord, int, error)

ImportZoteroRDF reads a small, interoperable subset of Zotero RDF into PaperRecords.

func MergeDuplicate

func MergeDuplicate(left, right PaperRecord) PaperRecord

MergeDuplicate merges metadata for two duplicate papers while preserving all identifiers and provenance.

func NewPaperRecord

func NewPaperRecord(input PaperRecordInput) (PaperRecord, error)

NewPaperRecord validates and normalizes a paper metadata record.

type PaperRecordInput

type PaperRecordInput struct {
	Title         string
	Identifiers   Identifiers
	Authors       []Author
	Abstract      string
	Year          int
	Venue         string
	Publisher     string
	URLs          []string
	License       string
	OpenAccess    bool
	SourcePayload string
	SourceRefs    []SourceRef
}

PaperRecordInput is caller-provided scholarly metadata before normalization.

type ReferenceManagerFidelityEntry

type ReferenceManagerFidelityEntry struct {
	Title  string          `json:"title"`
	DOI    string          `json:"doi,omitempty"`
	Fields map[string]bool `json:"fields"`
}

type ReferenceManagerFidelitySummary

type ReferenceManagerFidelitySummary struct {
	SchemaVersion string                          `json:"schemaVersion"`
	Records       []ReferenceManagerFidelityEntry `json:"records"`
}

ReferenceManagerFidelityReport summarizes whether imported reference-manager records retained review-relevant fields from Zotero/JabRef style sources.

func ReferenceManagerFidelityReport

func ReferenceManagerFidelityReport(records []PaperRecord) ReferenceManagerFidelitySummary

type ReferenceManagerFormatFidelity

type ReferenceManagerFormatFidelity struct {
	Format string                   `json:"format"`
	Label  string                   `json:"label"`
	Fields map[string]FieldFidelity `json:"fields"`
}

type ReferenceManagerInterchangeMatrix

type ReferenceManagerInterchangeMatrix struct {
	SchemaVersion string                           `json:"schemaVersion"`
	RecordCount   int                              `json:"recordCount"`
	FieldsPresent map[string]int                   `json:"fieldsPresent,omitempty"`
	Formats       []ReferenceManagerFormatFidelity `json:"formats"`
}

func BuildReferenceManagerInterchangeMatrix

func BuildReferenceManagerInterchangeMatrix(records []PaperRecord) ReferenceManagerInterchangeMatrix

func BuildReferenceManagerRoundTripMatrix

func BuildReferenceManagerRoundTripMatrix(records []PaperRecord) ReferenceManagerInterchangeMatrix

func DefaultReferenceManagerInterchangeMatrix

func DefaultReferenceManagerInterchangeMatrix() ReferenceManagerInterchangeMatrix

func (ReferenceManagerInterchangeMatrix) Format

func (ReferenceManagerInterchangeMatrix) HasFormat

func (m ReferenceManagerInterchangeMatrix) HasFormat(format string) bool

type SourceRef

type SourceRef struct {
	Source        string
	RawPayloadRef string
	RetrievedAt   string
	Metadata      map[string]string
}

SourceRef records source-specific payload Provenance for a PaperRecord.

type Store

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

Store persists PaperRecords for local library workflows.

func OpenStore

func OpenStore(path string) (Store, error)

OpenStore opens a local JSON-backed PaperRecord store.

func (Store) Create

func (s Store) Create(record PaperRecord) error

Create inserts a new PaperRecord.

func (Store) GetByRecordID added in v0.1.21

func (s Store) GetByRecordID(recordID string) (PaperRecord, bool, error)

GetByRecordID returns one stored paper by its stable opaque identity.

func (Store) ImportRecords

func (s Store) ImportRecords(records []PaperRecord) (ImportSummary, error)

ImportRecords adds records to the store, skipping records that have no identifier or whose identity key already exists in the store or earlier in the same batch. It returns an error only on a storage failure, never on a duplicate or identifier-less record, so a single bad record cannot abort an import or leave the library in a partial state.

func (Store) ImportRecordsThen added in v0.1.18

func (s Store) ImportRecordsThen(records []PaperRecord, commit func(ImportSummary) error) (ImportSummary, error)

ImportRecordsThen imports records, runs commit with the import summary, and restores the prior store if commit fails.

func (Store) List

func (s Store) List() ([]PaperRecord, error)

List returns all PaperRecords sorted by title.

func (Store) ReplaceAll

func (s Store) ReplaceAll(records []PaperRecord) error

ReplaceAll atomically replaces the store contents with the provided records.

func (Store) ReplaceAllThen added in v0.1.18

func (s Store) ReplaceAllThen(records []PaperRecord, commit func() error) error

ReplaceAllThen replaces the store contents, runs commit, and restores the prior store if commit fails.

func (Store) Search

func (s Store) Search(query string) ([]PaperRecord, error)

Search returns PaperRecords whose title or abstract contains query.

func (Store) Update

func (s Store) Update(record PaperRecord) error

Update replaces an existing PaperRecord by identifier.

Jump to

Keyboard shortcuts

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