Interface: IDiscoveryService
Defined in: src/types/interfaces/discovery.interface.ts:624
Discovery service interface.
Remarks
Orchestrates preprint enrichment and discovery using external APIs (Semantic Scholar, OpenAlex) and internal data (citation graph, search).
Critical Constraint: All methods return only preprints indexed in Chive. External APIs are used as enrichment signals, not as sources of recommendations.
Follows the ClaimingService pattern:
- Constructor takes core dependencies (logger, db, search, ranking)
- Optional setter for plugin manager (works without plugins)
- Graceful degradation when external APIs are unavailable
Example
// Get recommendations for a user
const result = await discoveryService.getRecommendationsForUser(
userDid,
{ limit: 10, signals: ['fields', 'citations'] }
);
// Find related preprints
const related = await discoveryService.findRelatedPreprints(
preprintUri,
{ limit: 5, signals: ['citations', 'concepts'] }
);
Since
0.1.0
Methods
enrichPreprint()
enrichPreprint(
preprint):Promise<EnrichmentResult>
Defined in: src/types/interfaces/discovery.interface.ts:635
Enriches a preprint with data from Semantic Scholar and OpenAlex.
Parameters
preprint
Preprint to enrich
Returns
Promise<EnrichmentResult>
Enrichment result with external data
Remarks
Fetches citation data, concepts, and topics from external APIs. Stores Chive-to-Chive citations in Neo4j for graph queries.
findRelatedPreprints()
findRelatedPreprints(
preprintUri,options?):Promise<readonlyRelatedPreprint[]>
Defined in: src/types/interfaces/discovery.interface.ts:659
Finds related Chive preprints using multiple signals.
Parameters
preprintUri
AT-URI of the source preprint
options?
Query options
Returns
Promise<readonly RelatedPreprint[]>
Related preprints with relationship metadata
Remarks
Combines citation graph, concept overlap, and semantic similarity to find related preprints. All results are from Chive's index.
getRecommendationsForUser()
getRecommendationsForUser(
userDid,options?):Promise<RecommendationResult>
Defined in: src/types/interfaces/discovery.interface.ts:676
Gets personalized recommendations for a user.
Parameters
userDid
User's DID
options?
Recommendation options
Returns
Promise<RecommendationResult>
Paginated recommendations with explanations
Remarks
Uses user's research fields, claimed papers, and citation network to generate personalized recommendations. Uses extended RankingService for scoring with discovery signals.
lookupPaper()
lookupPaper(
identifier):Promise<null|UnifiedPaperMetadata>
Defined in: src/types/interfaces/discovery.interface.ts:646
Looks up paper metadata from external sources.
Parameters
identifier
Paper identifier (DOI, arXiv, etc.)
Returns
Promise<null | UnifiedPaperMetadata>
Unified metadata or null if not found
Remarks
Queries Semantic Scholar and OpenAlex in parallel, merges results.
recordInteraction()
recordInteraction(
userDid,interaction):Promise<void>
Defined in: src/types/interfaces/discovery.interface.ts:692
Records a user interaction for feedback loop.
Parameters
userDid
User's DID