sources

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 15 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

This section is empty.

Variables

This section is empty.

Functions

func OpenAlexFilterPreset

func OpenAlexFilterPreset(name string) (map[string]string, bool)

func PaperRecords

func PaperRecords(response SourceResponse) ([]library.PaperRecord, error)

PaperRecords converts source records into library PaperRecords.

func RedactNASAADSToken

func RedactNASAADSToken(value string) string

Types

type ArXivConnector

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

ArXivConnector searches arXiv Atom feeds.

func NewArXivConnector

func NewArXivConnector(httpClient HTTPClient) ArXivConnector

NewArXivConnector creates an arXiv source connector.

func (ArXivConnector) Name

func (ArXivConnector) Name() string

Name returns the connector source name.

func (ArXivConnector) Search

Search queries arXiv and normalizes entries into SourceRecords.

type COREConnector

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

func NewCOREConnector

func NewCOREConnector(httpClient HTTPClient) COREConnector

func (COREConnector) Name

func (COREConnector) Name() string

func (COREConnector) Search

func (c COREConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)

type CitationEdge

type CitationEdge struct {
	SourceID string
	TargetID string
}

CitationEdge is a normalized citing paper -> referenced paper relationship.

type CitationGraphExpansion

type CitationGraphExpansion struct {
	SeedID  string
	Edges   []CitationEdge
	Records map[string]SourceRecord
	RawRef  string
}

CitationGraphExpansion is a normalized Semantic Scholar graph neighborhood.

type CrossrefConnector

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

CrossrefConnector searches Crossref works.

func NewCrossrefConnector

func NewCrossrefConnector(httpClient HTTPClient) CrossrefConnector

NewCrossrefConnector creates a Crossref source connector.

func (CrossrefConnector) LookupDOI

func (c CrossrefConnector) LookupDOI(ctx context.Context, doi string) (SourceRecord, string, error)

LookupDOI fetches one Crossref work by DOI and normalizes its metadata.

func (CrossrefConnector) Name

func (CrossrefConnector) Name() string

Name returns the connector source name.

func (CrossrefConnector) References

func (c CrossrefConnector) References(ctx context.Context, doi string) (SourceResponse, error)

References fetches one Crossref work and normalizes its reference-list DOI/title entries.

func (CrossrefConnector) Search

Search queries Crossref works and normalizes results into SourceRecords.

type DOAJConnector

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

func NewDOAJConnector

func NewDOAJConnector(httpClient HTTPClient) DOAJConnector

func (DOAJConnector) Name

func (DOAJConnector) Name() string

func (DOAJConnector) Search

func (c DOAJConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)

type EuropePMCConnector

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

EuropePMCConnector searches Europe PMC metadata.

func NewEuropePMCConnector

func NewEuropePMCConnector(httpClient HTTPClient) EuropePMCConnector

NewEuropePMCConnector creates a Europe PMC source connector.

func (EuropePMCConnector) Name

func (EuropePMCConnector) Name() string

Name returns the connector source name.

func (EuropePMCConnector) Search

Search queries Europe PMC and normalizes results into SourceRecords.

type GraphExpansionBudget

type GraphExpansionBudget struct {
	MaxDepth     int    `json:"maxDepth"`
	MaxNodes     int    `json:"maxNodes"`
	MaxAPICalls  int    `json:"maxApiCalls"`
	RetryBudget  int    `json:"retryBudget"`
	ResumeCursor string `json:"resumeCursor,omitempty"`
}

func NormalizeGraphExpansionBudget

func NormalizeGraphExpansionBudget(b GraphExpansionBudget) GraphExpansionBudget

type GraphExpansionBudgetEstimate

type GraphExpansionBudgetEstimate struct {
	SchemaVersion     string                        `json:"schemaVersion"`
	Source            string                        `json:"source"`
	SeedID            string                        `json:"seedId"`
	Direction         SemanticScholarGraphDirection `json:"direction"`
	Limit             int                           `json:"limit"`
	MaxDepth          int                           `json:"maxDepth"`
	MaxNodes          int                           `json:"maxNodes"`
	MaxAPICalls       int                           `json:"maxApiCalls"`
	RetryBudget       int                           `json:"retryBudget"`
	ResumeCursor      string                        `json:"resumeCursor,omitempty"`
	EstimatedAPICalls int                           `json:"estimatedApiCalls"`
	EstimatedMaxNodes int                           `json:"estimatedMaxNodes"`
	WithinBudget      bool                          `json:"withinBudget"`
	DryRunPlan        string                        `json:"dryRunPlan"`
}

func EstimateGraphExpansionBudget

func EstimateGraphExpansionBudget(source, seedID string, direction SemanticScholarGraphDirection, limit int, budget GraphExpansionBudget) GraphExpansionBudgetEstimate

type HTTPClient

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

HTTPClient makes source HTTP requests through an injected base URL.

func NewHTTPClient

func NewHTTPClient(options HTTPClientOptions) HTTPClient

NewHTTPClient creates an HTTP client suitable for real adapters and httptest servers.

func NewNASAADSHTTPClient

func NewNASAADSHTTPClient(baseURL, token string) HTTPClient

func (HTTPClient) Get

func (c HTTPClient) Get(ctx context.Context, path string, query map[string]string) ([]byte, error)

Get fetches a relative source path with query parameters and returns the response body.

type HTTPClientOptions

type HTTPClientOptions struct {
	BaseURL          string
	UserAgent        string
	Timeout          time.Duration
	MaxRetries       int
	MaxResponseBytes int64
	Headers          map[string]string
	Sleep            func(time.Duration)
}

HTTPClientOptions configures a local-testable scholarly source HTTP client.

type Identifiers

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

Identifiers are normalized scholarly IDs on a source result.

type NASAADSConnector

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

NASAADSConnector searches NASA ADS Solr records for physics/astronomy bibliography normalization.

func NewNASAADSConnector

func NewNASAADSConnector(httpClient HTTPClient) NASAADSConnector

func (NASAADSConnector) ExpandCitationGraph

func (c NASAADSConnector) ExpandCitationGraph(ctx context.Context, bibcode string, limit int) (CitationGraphExpansion, error)

func (NASAADSConnector) Name

func (NASAADSConnector) Name() string

func (NASAADSConnector) Search

type OpenAccessCandidate

type OpenAccessCandidate struct {
	PaperTitle               string `json:"paperTitle"`
	DOI                      string `json:"doi,omitempty"`
	Source                   string `json:"source"`
	URL                      string `json:"url"`
	License                  string `json:"license,omitempty"`
	OAStatus                 string `json:"oaStatus,omitempty"`
	Provenance               string `json:"provenance"`
	Attribution              string `json:"attribution,omitempty"`
	RateLimitPolicy          string `json:"rateLimitPolicy,omitempty"`
	APIProvenance            string `json:"apiProvenance,omitempty"`
	ReviewerApprovalRequired bool   `json:"reviewerApprovalRequired"`
}

type OpenAccessCandidateComparison

type OpenAccessCandidateComparison struct {
	SchemaVersion string                `json:"schemaVersion"`
	Candidates    []OpenAccessCandidate `json:"candidates"`
}

func CompareOpenAccessCandidates

func CompareOpenAccessCandidates(records []library.PaperRecord) OpenAccessCandidateComparison

type OpenAccessRecord

type OpenAccessRecord struct {
	DOI        string
	OpenAccess bool
	OAStatus   string
	License    string
	BestURL    string
	PDFURL     string
	SourceRef  library.SourceRef
}

OpenAccessRecord is normalized Unpaywall open-access metadata for one DOI.

type OpenAlexConnector

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

OpenAlexConnector searches OpenAlex works.

func NewOpenAlexConnector

func NewOpenAlexConnector(httpClient HTTPClient) OpenAlexConnector

NewOpenAlexConnector creates an OpenAlex source connector.

func (OpenAlexConnector) ExpandCitationGraph

func (c OpenAlexConnector) ExpandCitationGraph(ctx context.Context, query OpenAlexGraphQuery) (CitationGraphExpansion, error)

ExpandCitationGraph fetches OpenAlex references, citations, or both for one work.

func (OpenAlexConnector) Name

func (OpenAlexConnector) Name() string

Name returns the connector source name.

func (OpenAlexConnector) RelatedWorks

func (c OpenAlexConnector) RelatedWorks(ctx context.Context, workID string, limit int) (SourceResponse, error)

RelatedWorks returns related OpenAlex work IDs as lightweight discovery records.

func (OpenAlexConnector) Search

Search queries OpenAlex works and normalizes results into SourceRecords.

func (OpenAlexConnector) SearchAuthors

func (c OpenAlexConnector) SearchAuthors(ctx context.Context, query SourceQuery) ([]OpenAlexEntity, string, error)

SearchAuthors queries OpenAlex authors.

func (OpenAlexConnector) SearchConcepts

func (c OpenAlexConnector) SearchConcepts(ctx context.Context, query SourceQuery) ([]OpenAlexEntity, string, error)

SearchConcepts queries OpenAlex concepts.

func (OpenAlexConnector) SearchInstitutions

func (c OpenAlexConnector) SearchInstitutions(ctx context.Context, query SourceQuery) ([]OpenAlexEntity, string, error)

SearchInstitutions queries OpenAlex institutions.

type OpenAlexDisambiguationItem

type OpenAlexDisambiguationItem struct {
	Key           string           `json:"key"`
	Reason        string           `json:"reason"`
	Candidates    []OpenAlexEntity `json:"candidates"`
	ProvenanceRef string           `json:"provenanceRef"`
}

type OpenAlexDisambiguationQueue

type OpenAlexDisambiguationQueue struct {
	SchemaVersion string                       `json:"schemaVersion"`
	Query         string                       `json:"query"`
	Entity        string                       `json:"entity"`
	Items         []OpenAlexDisambiguationItem `json:"items"`
}

func BuildOpenAlexDisambiguationQueue

func BuildOpenAlexDisambiguationQueue(query, entity string, candidates []OpenAlexEntity, rawRef string) OpenAlexDisambiguationQueue

type OpenAlexEntity

type OpenAlexEntity struct {
	Source      string            `json:"source"`
	SourceID    string            `json:"sourceId"`
	DisplayName string            `json:"displayName"`
	WorksCount  int               `json:"worksCount"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

OpenAlexEntity is a normalized OpenAlex author or institution search result.

type OpenAlexGraphQuery

type OpenAlexGraphQuery struct {
	WorkID    string
	Limit     int
	Direction SemanticScholarGraphDirection
}

OpenAlexGraphQuery describes an OpenAlex citation graph expansion.

type PubMedConnector

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

PubMedConnector searches PubMed through NCBI E-utilities JSON endpoints.

func NewPubMedConnector

func NewPubMedConnector(httpClient HTTPClient) PubMedConnector

NewPubMedConnector creates a PubMed source connector.

func NewPubMedConnectorWithOptions

func NewPubMedConnectorWithOptions(httpClient HTTPClient, options PubMedOptions) PubMedConnector

NewPubMedConnectorWithOptions creates a PubMed source connector with optional NCBI identification.

func (PubMedConnector) Name

func (PubMedConnector) Name() string

Name returns the connector source name.

func (PubMedConnector) Search

Search queries PubMed ESearch then ESummary and normalizes results into SourceRecords.

type PubMedOptions

type PubMedOptions struct {
	APIKey string
	Tool   string
	Email  string
}

PubMedOptions configures optional NCBI E-utilities identification parameters.

type RequestProvenance

type RequestProvenance struct {
	Source string
	Query  SourceQuery
}

RequestProvenance records what was sent to a SourceConnector.

type ResponseCache

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

ResponseCache stores raw source payloads for reproducible connector runs.

func NewResponseCache

func NewResponseCache(root string) ResponseCache

NewResponseCache creates a filesystem-backed source response cache.

func (ResponseCache) Read

func (c ResponseCache) Read(ref string) ([]byte, error)

Read returns a raw source response by cache reference.

func (ResponseCache) Write

func (c ResponseCache) Write(source, query string, payload []byte) (string, error)

Write stores a raw source response and returns a stable cache reference.

type ResponseProvenance

type ResponseProvenance struct {
	Source      string
	RecordCount int
	RawRef      string
}

ResponseProvenance records what came back from a SourceConnector.

type SearchRun

type SearchRun struct {
	Connector          string
	Query              SourceQuery
	Response           SourceResponse
	RequestProvenance  RequestProvenance
	ResponseProvenance ResponseProvenance
}

SearchRun ties connector output to request and response Provenance metadata.

func RunSearch

func RunSearch(ctx context.Context, connector SourceConnector, query SourceQuery) (SearchRun, error)

RunSearch validates a query, invokes a connector, and records request/response Provenance metadata.

type SemanticScholarConnector

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

SemanticScholarConnector searches the Semantic Scholar Graph API paper index.

func NewSemanticScholarConnector

func NewSemanticScholarConnector(httpClient HTTPClient) SemanticScholarConnector

NewSemanticScholarConnector creates a Semantic Scholar source connector.

func (SemanticScholarConnector) ExpandCitationGraph

ExpandCitationGraph fetches references, citations, or both around one Semantic Scholar paper.

func (SemanticScholarConnector) Name

Name returns the connector source name.

func (SemanticScholarConnector) Search

Search queries Semantic Scholar papers and normalizes results into SourceRecords.

type SemanticScholarGraphDirection

type SemanticScholarGraphDirection string

SemanticScholarGraphDirection selects which graph neighborhood to fetch.

const (
	SemanticScholarDirectionReferences SemanticScholarGraphDirection = "references"
	SemanticScholarDirectionCitations  SemanticScholarGraphDirection = "citations"
	SemanticScholarDirectionBoth       SemanticScholarGraphDirection = "both"
)

type SemanticScholarGraphQuery

type SemanticScholarGraphQuery struct {
	PaperID   string
	Limit     int
	Direction SemanticScholarGraphDirection
}

SemanticScholarGraphQuery describes a Semantic Scholar citation graph expansion.

type SemanticScholarGraphRun

type SemanticScholarGraphRun struct {
	SchemaVersion     string                        `json:"schemaVersion"`
	SeedID            string                        `json:"seedId"`
	Direction         SemanticScholarGraphDirection `json:"direction"`
	Limit             int                           `json:"limit"`
	Depth             int                           `json:"depth"`
	MaxRecords        int                           `json:"maxRecords"`
	RequestedFields   []string                      `json:"requestedFields"`
	FieldRestrictions []string                      `json:"fieldRestrictions,omitempty"`
	QuotaRemaining    int                           `json:"quotaRemaining"`
	Budget            GraphExpansionBudget          `json:"budget"`
	BudgetEstimate    GraphExpansionBudgetEstimate  `json:"budgetEstimate"`
	ResumeCursor      string                        `json:"resumeCursor,omitempty"`
	Visited           []string                      `json:"visited"`
	NextFrontier      []string                      `json:"nextFrontier"`
	EdgeCount         int                           `json:"edgeCount"`
	RecordCount       int                           `json:"recordCount"`
	Completed         bool                          `json:"completed"`
}

func (SemanticScholarGraphRun) HasFieldRestriction

func (r SemanticScholarGraphRun) HasFieldRestriction(field string) bool

func (SemanticScholarGraphRun) RecordExpansion

func (r SemanticScholarGraphRun) RecordExpansion(expansion CitationGraphExpansion, nextFrontier []string, quotaRemaining int) SemanticScholarGraphRun

type SemanticScholarGraphRunOptions

type SemanticScholarGraphRunOptions struct {
	SeedID                   string
	Direction                SemanticScholarGraphDirection
	Limit, Depth, MaxRecords int
	RequestedFields          []string
	QuotaRemaining           int
	Budget                   GraphExpansionBudget
}

type SourceConnector

type SourceConnector interface {
	Name() string
	Search(context.Context, SourceQuery) (SourceResponse, error)
}

SourceConnector searches one scholarly metadata source.

type SourceQuery

type SourceQuery struct {
	Terms      string
	Limit      int
	PageCursor string
	Filters    map[string]string
}

SourceQuery describes a scholarly metadata search request.

type SourceRecord

type SourceRecord struct {
	Source      string
	SourceID    string
	Title       string
	Identifiers Identifiers
	Year        int
	Abstract    string
	Venue       string
	Publisher   string
	URLs        []string
	License     string
	OpenAccess  bool
	Metadata    map[string]string
}

SourceRecord is a source-specific scholarly metadata result.

type SourceResponse

type SourceResponse struct {
	Records        []SourceRecord
	RawRef         string
	NextPageCursor string
}

SourceResponse is the normalized response from a SourceConnector.

type UnpaywallConnector

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

UnpaywallConnector looks up open-access metadata for a DOI.

func NewUnpaywallConnector

func NewUnpaywallConnector(httpClient HTTPClient, email string) UnpaywallConnector

NewUnpaywallConnector creates an Unpaywall DOI lookup connector.

func (UnpaywallConnector) LookupDOI

LookupDOI fetches and normalizes Unpaywall metadata for a DOI.

func (UnpaywallConnector) Name

func (UnpaywallConnector) Name() string

Name returns the connector source name.

Jump to

Keyboard shortcuts

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