File size: 1,211 Bytes
1a5ba1e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """Shared Pydantic models.
``PaperRecord`` is the normalized in-memory shape produced by the fetch sources and stored
in the ``papers`` table. LLM output schemas (summary, analysis, scores, ...) are added in
later phases next to the stages that use them.
"""
from __future__ import annotations
from pydantic import BaseModel, Field
class Links(BaseModel):
abs: str | None = None
pdf: str | None = None
project_page: str | None = None
code: str | None = None
doi: str | None = None
class PaperRecord(BaseModel):
"""A fetched, source-normalized item (paper or news) before any LLM processing."""
id: str = Field(description="stable id, e.g. 'arxiv:2506.01234' or 'news:<sha1>'")
source: str
title: str
authors: list[str] = Field(default_factory=list)
published: str | None = None # ISO date
abstract: str | None = None
categories: list[str] = Field(default_factory=list)
links: Links = Field(default_factory=Links)
citations: int = 0
influential_citations: int = 0
has_code: bool = False
@property
def arxiv_id(self) -> str | None:
return self.id.split("arxiv:", 1)[1] if self.id.startswith("arxiv:") else None
|