Slim atlas payload for mapped domain
This commit is contained in:
+18
-3
@@ -289,6 +289,22 @@ def paper_public(paper: dict[str, Any]) -> dict[str, Any]:
|
||||
return {key: value for key, value in paper.items() if not key.startswith("_") and key != "meta"}
|
||||
|
||||
|
||||
def paper_card(paper: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"id": paper["id"],
|
||||
"title": paper["title"],
|
||||
"year": paper["year"],
|
||||
"venue": paper["venue"],
|
||||
"url": paper["url"],
|
||||
"source": paper["source"],
|
||||
"published_at": paper["published_at"],
|
||||
"status": paper["status"],
|
||||
"relevance": paper["relevance"],
|
||||
"topics": paper["topics"],
|
||||
"collection_score": paper["collection_score"],
|
||||
}
|
||||
|
||||
|
||||
def topic_counts(papers: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
counts: dict[str, int] = {}
|
||||
for paper in papers:
|
||||
@@ -321,7 +337,7 @@ def top_papers_for(papers: list[dict[str, Any]], limit: int = 8, recent: bool =
|
||||
ranked.sort(key=lambda item: (item["published_at"], item["collection_score"]), reverse=True)
|
||||
else:
|
||||
ranked.sort(key=lambda item: (item["collection_score"], item["published_at"]), reverse=True)
|
||||
return [paper_public(paper) for paper in ranked[:limit]]
|
||||
return [paper_card(paper) for paper in ranked[:limit]]
|
||||
|
||||
|
||||
def build_atlas() -> dict[str, Any]:
|
||||
@@ -377,7 +393,6 @@ def build_atlas() -> dict[str, Any]:
|
||||
"y": y,
|
||||
"stance": profile["stance"],
|
||||
"question": profile["question"],
|
||||
"key_papers": top_papers_for(topic_papers, 5),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -471,7 +486,7 @@ def topic_focus(topic: str) -> dict[str, Any]:
|
||||
"routes": routes,
|
||||
"key_papers": top_papers_for(topic_papers, 12),
|
||||
"recent_papers": top_papers_for(topic_papers, 12, recent=True),
|
||||
"evidence": top_papers_for(topic_papers, 40),
|
||||
"evidence": top_papers_for(topic_papers, 24),
|
||||
"reading_lens": [
|
||||
"先看主题问题,再看高分论文,不要从论文列表开始迷路。",
|
||||
"优先对比相邻主题,它们通常代表真实系统里的交叉问题。",
|
||||
|
||||
Reference in New Issue
Block a user