Documentation
¶
Index ¶
- Constants
- func AppendIdentityConflict(path string, conflict IdentityConflictRecord) error
- func AppendIdentityDecision(path string, decision IdentityDecision) error
- func AppendIdentityDecisionThen(path string, decision IdentityDecision, commit func() error) error
- func ExportBibTeX(path string, records []PaperRecord) error
- func ExportCSLJSON(path string, records []PaperRecord) error
- func ExportCSV(path string, records []PaperRecord) error
- func ExportJSON(path string, records []PaperRecord) error
- func ExportRIS(path string, records []PaperRecord) error
- func ExportZoteroRDF(path string, records []PaperRecord) error
- type Author
- type DuplicateMatch
- type FieldFidelity
- type Identifiers
- type IdentityCluster
- type IdentityConflictRecord
- type IdentityDecision
- type IdentityDecisionLog
- type IdentityMatch
- type IdentityResolutionReport
- type ImportSummary
- type JabRefCollisionFinding
- type JabRefQualityIssue
- type JabRefQualityReport
- type JabRefRecordFinding
- type PaperRecord
- func ApplyIdentityDecision(records []PaperRecord, decision IdentityDecision) ([]PaperRecord, error)
- func ImportBibTeX(path string) ([]PaperRecord, int, error)
- func ImportCSLJSON(path string) ([]PaperRecord, int, error)
- func ImportCSV(path string) ([]PaperRecord, int, error)
- func ImportJSON(path string) ([]PaperRecord, int, error)
- func ImportRIS(path string) ([]PaperRecord, int, error)
- func ImportZoteroRDF(path string) ([]PaperRecord, int, error)
- func MergeDuplicate(left, right PaperRecord) PaperRecord
- func NewPaperRecord(input PaperRecordInput) (PaperRecord, error)
- type PaperRecordInput
- type ReferenceManagerFidelityEntry
- type ReferenceManagerFidelitySummary
- type ReferenceManagerFormatFidelity
- type ReferenceManagerInterchangeMatrix
- type SourceRef
- type Store
- func (s Store) Create(record PaperRecord) error
- func (s Store) GetByRecordID(recordID string) (PaperRecord, bool, error)
- func (s Store) ImportRecords(records []PaperRecord) (ImportSummary, error)
- func (s Store) ImportRecordsThen(records []PaperRecord, commit func(ImportSummary) error) (ImportSummary, error)
- func (s Store) List() ([]PaperRecord, error)
- func (s Store) ReplaceAll(records []PaperRecord) error
- func (s Store) ReplaceAllThen(records []PaperRecord, commit func() error) error
- func (s Store) Search(query string) ([]PaperRecord, error)
- func (s Store) Update(record PaperRecord) error
Constants ¶
const ( IdentityDecisionMerge = "merge" IdentityDecisionSplit = "split" )
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 DuplicateMatch ¶
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 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 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 ¶
ImportSummary reports the outcome of a resilient batch import.
type JabRefCollisionFinding ¶
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 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 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 (m ReferenceManagerInterchangeMatrix) Format(format string) (ReferenceManagerFormatFidelity, bool)
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 (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.