Documentation
¶
Index ¶
- func OpenAlexFilterPreset(name string) (map[string]string, bool)
- func PaperRecords(response SourceResponse) ([]library.PaperRecord, error)
- func RedactNASAADSToken(value string) string
- type ArXivConnector
- type COREConnector
- type CitationEdge
- type CitationGraphExpansion
- type CrossrefConnector
- func (c CrossrefConnector) LookupDOI(ctx context.Context, doi string) (SourceRecord, string, error)
- func (CrossrefConnector) Name() string
- func (c CrossrefConnector) References(ctx context.Context, doi string) (SourceResponse, error)
- func (c CrossrefConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
- type DOAJConnector
- type EuropePMCConnector
- type GraphExpansionBudget
- type GraphExpansionBudgetEstimate
- type HTTPClient
- type HTTPClientOptions
- type Identifiers
- type NASAADSConnector
- type OpenAccessCandidate
- type OpenAccessCandidateComparison
- type OpenAccessRecord
- type OpenAlexConnector
- func (c OpenAlexConnector) ExpandCitationGraph(ctx context.Context, query OpenAlexGraphQuery) (CitationGraphExpansion, error)
- func (OpenAlexConnector) Name() string
- func (c OpenAlexConnector) RelatedWorks(ctx context.Context, workID string, limit int) (SourceResponse, error)
- func (c OpenAlexConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
- func (c OpenAlexConnector) SearchAuthors(ctx context.Context, query SourceQuery) ([]OpenAlexEntity, string, error)
- func (c OpenAlexConnector) SearchConcepts(ctx context.Context, query SourceQuery) ([]OpenAlexEntity, string, error)
- func (c OpenAlexConnector) SearchInstitutions(ctx context.Context, query SourceQuery) ([]OpenAlexEntity, string, error)
- type OpenAlexDisambiguationItem
- type OpenAlexDisambiguationQueue
- type OpenAlexEntity
- type OpenAlexGraphQuery
- type PubMedConnector
- type PubMedOptions
- type RequestProvenance
- type ResponseCache
- type ResponseProvenance
- type SearchRun
- type SemanticScholarConnector
- type SemanticScholarGraphDirection
- type SemanticScholarGraphQuery
- type SemanticScholarGraphRun
- type SemanticScholarGraphRunOptions
- type SourceConnector
- type SourceQuery
- type SourceRecord
- type SourceResponse
- type UnpaywallConnector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PaperRecords ¶
func PaperRecords(response SourceResponse) ([]library.PaperRecord, error)
PaperRecords converts source records into library PaperRecords.
func RedactNASAADSToken ¶
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 ¶
func (c ArXivConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
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 ¶
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 ¶
func (c CrossrefConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
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 ¶
func (c EuropePMCConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
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
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 ¶
func (c NASAADSConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
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 ¶
func (c OpenAlexConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
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 ¶
func (c PubMedConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
Search queries PubMed ESearch then ESummary and normalizes results into SourceRecords.
type PubMedOptions ¶
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.
type ResponseProvenance ¶
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 ¶
func (c SemanticScholarConnector) ExpandCitationGraph(ctx context.Context, query SemanticScholarGraphQuery) (CitationGraphExpansion, error)
ExpandCitationGraph fetches references, citations, or both around one Semantic Scholar paper.
func (SemanticScholarConnector) Name ¶
func (SemanticScholarConnector) Name() string
Name returns the connector source name.
func (SemanticScholarConnector) Search ¶
func (c SemanticScholarConnector) Search(ctx context.Context, query SourceQuery) (SourceResponse, error)
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 NewSemanticScholarGraphRun ¶
func NewSemanticScholarGraphRun(opts SemanticScholarGraphRunOptions) SemanticScholarGraphRun
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 ¶
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 ¶
func (c UnpaywallConnector) LookupDOI(ctx context.Context, doi string) (OpenAccessRecord, error)
LookupDOI fetches and normalizes Unpaywall metadata for a DOI.
func (UnpaywallConnector) Name ¶
func (UnpaywallConnector) Name() string
Name returns the connector source name.