From f585bb016ac0369166b93a8d9ab545ea317cf10f Mon Sep 17 00:00:00 2001 From: Hsukqi Lee Date: Sun, 22 Nov 2026 01:42:20 +0800 Subject: [PATCH] feat: collect ICML and NeurIPS from official proceedings --- .agents/skills/conference-ingestion/SKILL.md | 5 +- README.md | 6 +- cmd/fastnews/conference_sources_test.go | 6 +- cmd/fastnews/proceedings_test.go | 180 ++++++++++++++ cmd/fastnews/testdata/icml-2025-feed.xml | 4 + cmd/fastnews/testdata/icml-2025-index.html | 9 + cmd/fastnews/testdata/neurips-2025-index.html | 7 + internal/catalog/catalog.go | 4 +- internal/jobs/conference.go | 28 ++- internal/jobs/conference_api.go | 21 +- internal/jobs/metrics.go | 4 +- internal/jobs/proceedings.go | 228 ++++++++++++++++++ internal/jobs/report.go | 2 +- 13 files changed, 481 insertions(+), 23 deletions(-) create mode 100644 cmd/fastnews/proceedings_test.go create mode 100644 cmd/fastnews/testdata/icml-2025-feed.xml create mode 100644 cmd/fastnews/testdata/icml-2025-index.html create mode 100644 cmd/fastnews/testdata/neurips-2025-index.html create mode 100644 internal/jobs/proceedings.go diff --git a/.agents/skills/conference-ingestion/SKILL.md b/.agents/skills/conference-ingestion/SKILL.md index 1649f30..80ac8e6 100644 --- a/.agents/skills/conference-ingestion/SKILL.md +++ b/.agents/skills/conference-ingestion/SKILL.md @@ -10,7 +10,8 @@ Use the production Go pipeline and the source registry in `internal/catalog/cata ## Existing sources - Security: `usenix`, `ieee-sp`, `ndss`, `ccs` use official conference pages. -- Machine learning: `iclr`, `icml`, `neurips` use OpenReview API v2 and the exact accepted conference venue for the requested year. +- ICLR uses OpenReview API v2 and the exact accepted conference venue for the requested year. +- ICML uses the official PMLR volume index plus the same volume's RSS abstracts. NeurIPS uses the official proceedings' `conference` track, excluding other tracks and leaving unavailable abstracts unknown. These official profiles are verified for 2024 and 2025; choose the year explicitly. Unsupported years fail without switching providers. - Software engineering: `icse`, `ase` use DBLP conference/workshop bibliography records for the requested stream/year. Preserve the actual venue; these records do not establish main-track-only coverage or provide paper abstracts. For a requested conference/year, run the stages the user requested: @@ -25,6 +26,8 @@ Fetching writes the local corpus. Summarization uses the configured model and re Inspect the records in `top-conf/data/conferences/_.jsonl`, the category/summary output and the rendered report. Check stable identities, original links, authors, source provenance, requested year and actual scope. Source errors, authentication challenges, unavailable proceedings and incomplete pagination remain explicit failures; do not replace them with unrelated pages or claim a successful empty collection. An override URL must expose the same provider protocol. Do not trigger release/deployment workflows merely to validate collection. +PMLR overrides must also serve `assets/rss/feed.xml`; the index's canonical volume and complete link set must agree with that RSS. Official OpenReview cross-links preserve PMLR identities when available. NeurIPS proceedings use their canonical landing URLs, with no inferred equivalence to older OpenReview IDs. Summarization/reporting validate the registered conference/year independently from default source availability, so existing archives remain usable. + ## Classification Supply the available title, abstract, keywords and venue to the model. Keep its structured category and summary. Detailed topics such as Coding Agents are semantic choices based on this evidence, not substring filters. When only bibliography/title evidence exists, the summary must say so and avoid invented methods, results or experiments. A successful fixture run proves protocol handling; live acquisition and model quality require their own observations. diff --git a/README.md b/README.md index 637acb4..53ed8e5 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,8 @@ FastRead 保留现有授权边界:Research 会话申请 `fast-read` 一次性 ./bin/fastnews weekly-report --days 7 --pdf ./bin/fastnews fetch-conf --conference usenix --year 2026 +./bin/fastnews fetch-conf --conference icml --year 2025 # PMLR 索引 + 同卷 RSS 完整摘要 +./bin/fastnews fetch-conf --conference neurips --year 2025 # 官方卷中 conference 主会轨道 ./bin/fastnews summarize-conf --conference usenix --year 2026 ./bin/fastnews conference-report --conference usenix --year 2026 --pdf ./bin/fastnews update-range --since 2023 --until 2026 @@ -108,9 +110,9 @@ FastRead 保留现有授权边界:Research 会话申请 `fast-read` 一次性 ./bin/fastnews index ``` -会议支持安全四会 `usenix / ieee-sp / ndss / ccs`、机器学习 `iclr / icml / neurips` 以及软件工程 `icse / ase`。安全会议读取官方页面;机器学习会议读取 OpenReview API v2 中指定年份的正式会议 venue;ICSE/ASE 读取 DBLP 中对应年份、会议流的会议及研讨会论文记录,并保留原始 venue。DBLP 不提供摘要时,生成结果必须说明仅依据标题,不补造实验。分类参考会议领域,支持 Coding Agents 等细分方向,不通过标题关键词自动判定类别。 +会议支持安全四会 `usenix / ieee-sp / ndss / ccs`、机器学习 `iclr / icml / neurips` 以及软件工程 `icse / ase`。安全会议读取官方页面;ICLR 读取 OpenReview API v2 指定年份的正式会议 venue。ICML 直接读取 PMLR 官方索引及同卷 RSS,以论文链接核对完整集合并保留原始摘要;NeurIPS 直接读取官方卷中声明为 `conference` 的主会轨道,排除其他轨道,索引不提供摘要时保持未知。ICML/NeurIPS 官方格式目前实测支持 2024、2025 年,未验证的年份明确报错,不自动切换其他来源。ICSE/ASE 读取 DBLP 中对应年份、会议流的会议及研讨会论文记录,并保留原始 venue。没有摘要时,生成结果必须说明仅依据标题,不补造实验。分类参考会议领域,支持 Coding Agents 等细分方向,不通过标题关键词自动判定类别。 -采集地址可通过 `--url` 指定同协议的来源。OpenReview/DBLP 分页全部校验完成后才追加数据;来源要求登录、返回验证页、分页不完整或会议/年份不符时返回错误并保留已有文件。新闻以 ID / URL 去重,结构化会议记录和论文摘要按稳定 ID 续跑,日报保持原 `source_hash` 检查点算法。`update-range` 仍按原安全四会运行,其他会议按 `fetch-conf → summarize-conf → conference-report` 单独选择年份;手动报告工作流支持全部已接入会议。`enrich-metrics` 使用 OpenAlex 并要求标题规范化后完全匹配。 +采集地址可通过 `--url` 指定同协议、同年份格式的来源,PMLR 来源同时需要可访问的 `assets/rss/feed.xml`。来源要求登录、返回验证页、分页或论文集合不完整、会议/年份不符时返回错误并保留已有文件。新闻以 ID / URL 去重,结构化会议记录和论文摘要按稳定 ID 续跑:PMLR 有官方 OpenReview 交叉链接时复用该身份,否则使用论文页面 URL;NeurIPS 使用官方论文页面 URL,不按标题猜测旧 OpenReview 记录是否等价。日报保持原 `source_hash` 检查点算法。`update-range` 仍按原安全四会运行,其他会议按 `fetch-conf → summarize-conf → conference-report` 单独选择年份;手动报告工作流支持全部已接入会议,ICML/NeurIPS 请显式选择已验证年份。`enrich-metrics` 使用 OpenAlex 并要求标题规范化后完全匹配。 HTML 报告由 Go 模板生成。PDF 使用 Chromium,通过 `FASTNEWS_CHROME` 指定可执行文件;不请求 PDF 时不需要浏览器。周报同时输出到 `output/` 及 `secnews/data/report/`。CI 的采集、摘要与报告工作流已改为 Go CLI。 diff --git a/cmd/fastnews/conference_sources_test.go b/cmd/fastnews/conference_sources_test.go index c7f812f..7790e9b 100644 --- a/cmd/fastnews/conference_sources_test.go +++ b/cmd/fastnews/conference_sources_test.go @@ -22,7 +22,7 @@ import ( ) func TestConferenceSourcesThroughCLIClassificationCatalogAndReport(t *testing.T) { - for _, conf := range []string{"iclr", "icml", "neurips", "icse", "ase"} { + for _, conf := range []string{"iclr", "icse", "ase"} { t.Run(conf, func(t *testing.T) { var mode atomic.Int32 var modelCalls atomic.Int32 @@ -33,7 +33,7 @@ func TestConferenceSourcesThroughCLIClassificationCatalogAndReport(t *testing.T) if !strings.Contains(string(body), "Study") { t.Error("model did not receive source paper evidence") } - if conf == "iclr" || conf == "icml" || conf == "neurips" { + if conf == "iclr" { if !strings.Contains(string(body), "Official abstract") || !strings.Contains(string(body), "Declared keyword") { t.Error("available abstract or keywords were lost before classification") } @@ -58,7 +58,7 @@ func TestConferenceSourcesThroughCLIClassificationCatalogAndReport(t *testing.T) w.WriteHeader(503) return } - if conf == "iclr" || conf == "icml" || conf == "neurips" { + if conf == "iclr" { venue := r.URL.Query().Get("content.venueid") if mode.Load() == 2 { venue = "Different.cc/2026/Conference" diff --git a/cmd/fastnews/proceedings_test.go b/cmd/fastnews/proceedings_test.go new file mode 100644 index 0000000..fe5a27c --- /dev/null +++ b/cmd/fastnews/proceedings_test.go @@ -0,0 +1,180 @@ +package main + +import ( + "context" + "fmt" + "io" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "strings" + "sync/atomic" + "testing" + + "github.com/FastR-D/FastNews/internal/catalog" + "github.com/FastR-D/FastNews/internal/config" + "github.com/FastR-D/FastNews/internal/httpapi" + "github.com/FastR-D/FastNews/internal/store" +) + +func TestOfficialProceedingsThroughCollectionClassificationAndReport(t *testing.T) { + for _, conf := range []string{"icml", "neurips"} { + t.Run(conf, func(t *testing.T) { + fixture := "icml-2025-index.html" + if conf == "neurips" { + fixture = "neurips-2025-index.html" + } + index, err := os.ReadFile(filepath.Join("testdata", fixture)) + if err != nil { + t.Fatal(err) + } + feed, err := os.ReadFile(filepath.Join("testdata", "icml-2025-feed.xml")) + if err != nil { + t.Fatal(err) + } + var mode atomic.Int32 + var models atomic.Int32 + original := http.DefaultTransport + http.DefaultTransport = newsTransport(func(r *http.Request) (*http.Response, error) { + if r.URL.Hostname() == "127.0.0.1" { + return original.RoundTrip(r) + } + if r.URL.Hostname() != "proceedings.mlr.press" && r.URL.Hostname() != "papers.nips.cc" { + return nil, fmt.Errorf("unexpected source %s", r.URL) + } + body := string(index) + if strings.HasSuffix(r.URL.Path, "feed.xml") { + body = string(feed) + if mode.Load() == 1 { + return &http.Response{StatusCode: 503, Body: io.NopCloser(strings.NewReader("unavailable")), Header: http.Header{}, Request: r}, nil + } + if mode.Load() == 2 { + body = strings.ReplaceAll(body, "aamand25a.html", "missing25a.html") + } + } else { + switch mode.Load() { + case 1: + if conf == "neurips" { + body = strings.Replace(body, "3 papers", "4 papers", 1) + } + case 2: + if conf == "neurips" { + body = strings.ReplaceAll(body, "/2025/hash/", "/2024/hash/") + } + case 3: + body = `Verification required` + case 4: + body = strings.ReplaceAll(body, `class="authors"`, `class="missing"`) + body = strings.ReplaceAll(body, `class="paper-authors"`, `class="missing"`) + case 5: + body = strings.ReplaceAll(body, "v267/", "v235/") + body = strings.ReplaceAll(body, `data-track="conference"`, `data-track="creative_ai_track"`) + } + } + return &http.Response{StatusCode: 200, Body: io.NopCloser(strings.NewReader(body)), Header: http.Header{}, Request: r}, nil + }) + t.Cleanup(func() { http.DefaultTransport = original }) + model := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + models.Add(1) + body, _ := io.ReadAll(r.Body) + if conf == "icml" && !strings.Contains(string(body), "description") { + t.Error("source evidence missing") + } + fmt.Fprint(w, `{"choices":[{"finish_reason":"stop","message":{"content":"{\"category\":\"Recorded test category\",\"summary_zh\":\"隔离模型协议验收,非真实模型质量评估。\"}"}}]}`) + })) + defer model.Close() + c := config.Config{Root: t.TempDir(), LLMKey: "fixture", LLMURL: model.URL} + args := []string{"--conference", conf, "--year", "2025"} + for range 2 { + if err := job(context.Background(), c, "fetch-conf", args); err != nil { + t.Fatal(err) + } + } + file := filepath.Join(c.Root, "top-conf/data/conferences", conf+"_2025.jsonl") + rows, err := catalog.Rows(file) + if err != nil || len(rows) != 2 { + t.Fatalf("scope/deduplication: %d records, %v", len(rows), err) + } + for _, row := range rows { + if catalog.Str(row, "author") == "" { + t.Fatal("author metadata lost") + } + if conf == "icml" && catalog.Str(row, "description") == "" { + t.Fatal("RSS abstract lost") + } + if conf == "neurips" && (catalog.Str(row, "track") != "conference" || catalog.Str(row, "description") != "") { + t.Fatal("track scope or unknown abstract changed", row) + } + } + if conf == "icml" && rows[0]["_id"] != "https://openreview.net/forum?id=jYmGi1175R" { + t.Fatal("publisher-linked identity changed", rows[0]["_id"]) + } + for range 2 { + if err := job(context.Background(), c, "summarize-conf", args); err != nil { + t.Fatal(err) + } + } + if models.Load() != 2 { + t.Fatal("summary checkpoint was not reused", models.Load()) + } + if err := job(context.Background(), c, "conference-report", args); err != nil { + t.Fatal(err) + } + data, err := os.ReadFile(filepath.Join(c.Root, "top-conf/data/report", strings.ToUpper(conf)+"_2025_Report.html")) + if err != nil || !strings.Contains(string(data), catalog.Str(rows[0], "title")) { + t.Fatal("report artifact missing", err) + } + db, err := store.Open(filepath.Join(c.Root, "accounts")) + if err != nil { + t.Fatal(err) + } + defer db.Close() + app, err := httpapi.New(c, db) + if err != nil { + t.Fatal(err) + } + recorder := httptest.NewRecorder() + app.Handler().ServeHTTP(recorder, httptest.NewRequest("GET", "/api/papers?conference="+conf+"&year=2025", nil)) + if recorder.Code != 200 || !strings.Contains(recorder.Body.String(), catalog.Str(rows[0], "title")) { + t.Fatal("catalog failed", recorder.Code, recorder.Body.String()) + } + before, err := os.ReadFile(file) + if err != nil { + t.Fatal(err) + } + for _, failure := range []int32{1, 2, 3, 4, 5} { + mode.Store(failure) + if err := job(context.Background(), c, "fetch-conf", args); err == nil { + t.Fatal("invalid proceedings accepted", failure) + } + after, err := os.ReadFile(file) + if err != nil || string(after) != string(before) { + t.Fatal("failed source changed corpus", failure, err) + } + } + }) + } +} + +func TestUnverifiedProceedingsYearFailsBeforeNetworkOrCorpusWrites(t *testing.T) { + var requests atomic.Int32 + original := http.DefaultTransport + http.DefaultTransport = newsTransport(func(r *http.Request) (*http.Response, error) { + requests.Add(1) + return nil, fmt.Errorf("unexpected network request") + }) + t.Cleanup(func() { http.DefaultTransport = original }) + for _, conf := range []string{"icml", "neurips"} { + c := config.Config{Root: t.TempDir()} + if err := job(context.Background(), c, "fetch-conf", []string{"--conference", conf, "--year", "2026"}); err == nil { + t.Fatal("unverified year accepted", conf) + } + if _, err := os.Stat(filepath.Join(c.Root, "top-conf")); !os.IsNotExist(err) { + t.Fatal("unsupported year created corpus", conf, err) + } + } + if requests.Load() != 0 { + t.Fatal("unsupported source was fetched", requests.Load()) + } +} diff --git a/cmd/fastnews/testdata/icml-2025-feed.xml b/cmd/fastnews/testdata/icml-2025-feed.xml new file mode 100644 index 0000000..51f0402 --- /dev/null +++ b/cmd/fastnews/testdata/icml-2025-feed.xml @@ -0,0 +1,4 @@ +Proceedings of Machine Learning Research +Lightweight Protocols for Distributed Private Quantile Estimationhttps://proceedings.mlr.press/v267/aamand25a.htmlDistributed data analysis is a powerful approach for large-scale data processing.Mon, 06 Oct 2025 00:00:00 +0000 +Aggregation of Dependent Expert Distributions in Multimodal Variational Autoencodershttps://proceedings.mlr.press/v267/a-mancisidor25a.htmlMultimodal learning with variational autoencoders (VAEs) requires estimating joint distributions to evaluate the evidence lower bound (ELBO).Mon, 06 Oct 2025 00:00:00 +0000 + diff --git a/cmd/fastnews/testdata/icml-2025-index.html b/cmd/fastnews/testdata/icml-2025-index.html new file mode 100644 index 0000000..c104693 --- /dev/null +++ b/cmd/fastnews/testdata/icml-2025-index.html @@ -0,0 +1,9 @@ + +

Volume 267: International Conference on Machine Learning, 13-19 July 2025

+

Aggregation of Dependent Expert Distributions in Multimodal Variational Autoencoders

+

Rogelio A. Mancisidor, Robert Jenssen, Shujian Yu, Michael Kampffmeyer

+
+

Lightweight Protocols for Distributed Private Quantile Estimation

+

Anders Aamand, Fabrizio Boninsegna, Abigail Gentle, Jacob Imola, Rasmus Pagh

+
+ diff --git a/cmd/fastnews/testdata/neurips-2025-index.html b/cmd/fastnews/testdata/neurips-2025-index.html new file mode 100644 index 0000000..b1b7416 --- /dev/null +++ b/cmd/fastnews/testdata/neurips-2025-index.html @@ -0,0 +1,7 @@ +

Advances in Neural Information Processing Systems 38 Main Conference

+
3 papers
+ diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index 2745841..23451ba 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -64,8 +64,8 @@ var Conferences = map[string]Conference{ "ndss": {"NDSS", "security", "html", ""}, "ccs": {"ACM CCS", "security", "html", ""}, "iclr": {"ICLR", "ml", "openreview", "ICLR.cc"}, - "icml": {"ICML", "ml", "openreview", "ICML.cc"}, - "neurips": {"NeurIPS", "ml", "openreview", "NeurIPS.cc"}, + "icml": {"ICML", "ml", "pmlr", ""}, + "neurips": {"NeurIPS", "ml", "neurips-proceedings", ""}, "icse": {"ICSE", "software", "dblp", "icse"}, "ase": {"ASE", "software", "dblp", "kbse"}, } diff --git a/internal/jobs/conference.go b/internal/jobs/conference.go index 650967a..abad103 100644 --- a/internal/jobs/conference.go +++ b/internal/jobs/conference.go @@ -15,10 +15,28 @@ import ( "golang.org/x/net/html" ) -func ConferenceURLs(conf string, year int) ([]string, error) { +func conferenceInfo(conf string, year int) (catalog.Conference, error) { metadata, ok := catalog.Conferences[conf] if !ok { - return nil, fmt.Errorf("unknown conference %q", conf) + return metadata, fmt.Errorf("unknown conference %q", conf) + } + if year < 2000 || year > 2100 { + return metadata, fmt.Errorf("invalid conference year") + } + return metadata, nil +} + +func ConferenceURLs(conf string, year int) ([]string, error) { + metadata, err := conferenceInfo(conf, year) + if err != nil { + return nil, err + } + if metadata.Provider == "pmlr" || metadata.Provider == "neurips-proceedings" { + source, err := proceedingsURL(conf, year) + if err != nil { + return nil, err + } + return []string{source}, nil } if metadata.Provider == "openreview" { query := url.Values{"content.venueid": {fmt.Sprintf("%s/%d/Conference", metadata.RemoteID, year)}} @@ -167,8 +185,8 @@ func (p *Pipeline) FetchConference(ctx context.Context, conf string, year int, o if err != nil { return err } - if year < 2000 || year > 2100 { - return fmt.Errorf("invalid conference year") + if provider := catalog.Conferences[conf].Provider; provider == "pmlr" || provider == "neurips-proceedings" { + return p.fetchProceedings(ctx, conf, year, catalog.First(override, urls[0])) } if catalog.Conferences[conf].Provider != "html" { return p.fetchStructuredConference(ctx, conf, year, catalog.First(override, urls[0])) @@ -239,7 +257,7 @@ func (p *Pipeline) FetchConference(ctx context.Context, conf string, year int, o return appendRows(file, found) } func (p *Pipeline) SummarizeConference(ctx context.Context, conf string, year int) error { - if _, e := ConferenceURLs(conf, year); e != nil { + if _, e := conferenceInfo(conf, year); e != nil { return e } base := fmt.Sprintf("%s_%d", conf, year) diff --git a/internal/jobs/conference_api.go b/internal/jobs/conference_api.go index e9b7135..30c72ae 100644 --- a/internal/jobs/conference_api.go +++ b/internal/jobs/conference_api.go @@ -94,10 +94,7 @@ func (p *Pipeline) fetchStructuredConference(ctx context.Context, conf string, y if err != nil { return err } - publicEndpoint := *u - publicEndpoint.User = nil - publicEndpoint.RawQuery = "" - publicEndpoint.Fragment = "" + publicEndpoint := publicConferenceEndpoint(u) rows := []map[string]any{} seen := map[string]bool{} offset := 0 @@ -137,7 +134,7 @@ func (p *Pipeline) fetchStructuredConference(ctx context.Context, conf string, y seen[link] = true rows = append(rows, map[string]any{"_id": link, "title": note.Content.Title.Value, "link": link, "description": note.Content.Abstract.Value, "author": strings.Join(note.Content.Authors.Value, ", "), - "keywords": note.Content.Keywords.Value, "presentation": note.Content.Venue.Value, "source_url": publicEndpoint.String()}) + "keywords": note.Content.Keywords.Value, "presentation": note.Content.Venue.Value, "source_url": publicEndpoint}) } } else { query.Set("q", fmt.Sprintf("stream:conf/%s: year:%d:", metadata.RemoteID, year)) @@ -194,7 +191,7 @@ func (p *Pipeline) fetchStructuredConference(ctx context.Context, conf string, y } seen[v.Key] = true rows = append(rows, map[string]any{"_id": "https://dblp.org/rec/" + v.Key, "title": v.Title, "link": link, - "description": "", "author": strings.Join(authors, ", "), "venue": strings.Join(venues, ", "), "source_url": publicEndpoint.String()}) + "description": "", "author": strings.Join(authors, ", "), "venue": strings.Join(venues, ", "), "source_url": publicEndpoint}) } } if expectedTotal >= 0 && total != expectedTotal { @@ -212,6 +209,16 @@ func (p *Pipeline) fetchStructuredConference(ctx context.Context, conf string, y if len(rows) == 0 { return fmt.Errorf("no papers returned for %s %d", conf, year) } + return p.appendConferenceRecords(conf, year, rows) +} + +func publicConferenceEndpoint(endpoint *url.URL) string { + public := *endpoint + public.User, public.RawQuery, public.Fragment = nil, "", "" + return public.String() +} + +func (p *Pipeline) appendConferenceRecords(conf string, year int, rows []map[string]any) error { file := filepath.Join(p.Config.Root, "top-conf/data/conferences", fmt.Sprintf("%s_%d.jsonl", conf, year)) existing, err := catalog.Rows(file) if err != nil { @@ -226,7 +233,7 @@ func (p *Pipeline) fetchStructuredConference(ctx context.Context, conf string, y if known[catalog.Str(row, "_id")] { continue } - row["source"] = metadata.Name + " " + strconv.Itoa(year) + row["source"] = catalog.Labels[conf] + " " + strconv.Itoa(year) row["fetched_at"] = time.Now().UTC().Format(time.RFC3339) out = append(out, row) } diff --git a/internal/jobs/metrics.go b/internal/jobs/metrics.go index 511e62b..b5729f3 100644 --- a/internal/jobs/metrics.go +++ b/internal/jobs/metrics.go @@ -60,7 +60,7 @@ func ParseAwards(raw []byte, source, conf string, year int) ([]map[string]any, e return out, nil } func (p *Pipeline) Awards(ctx context.Context, conf string, year int, rawURL string) error { - if _, e := ConferenceURLs(conf, year); e != nil { + if _, e := conferenceInfo(conf, year); e != nil { return e } if rawURL == "" { @@ -105,7 +105,7 @@ func (p *Pipeline) Awards(ctx context.Context, conf string, year int, rawURL str return writeJSON(file, map[string]any{"generated_at": time.Now().UTC().Format(time.RFC3339), "papers": out}) } func (p *Pipeline) Metrics(ctx context.Context, conf string, year int, limit int) error { - if _, e := ConferenceURLs(conf, year); e != nil { + if _, e := conferenceInfo(conf, year); e != nil { return e } file := filepath.Join(p.Config.Root, "top-conf/data/conferences", fmt.Sprintf("%s_%d.jsonl", conf, year)) diff --git a/internal/jobs/proceedings.go b/internal/jobs/proceedings.go new file mode 100644 index 0000000..9ab1d93 --- /dev/null +++ b/internal/jobs/proceedings.go @@ -0,0 +1,228 @@ +package jobs + +import ( + "context" + "encoding/xml" + "fmt" + "net/url" + "strconv" + "strings" + + "golang.org/x/net/html" +) + +// These publisher volumes were checked against the official 2024/2025 indexes. +var pmlrVolumes = map[int]string{2024: "235", 2025: "267"} +var neuripsVolumes = map[int]string{ + 2024: "https://papers.nips.cc/paper_files/paper/2024", + 2025: "https://papers.nips.cc/paper_files/paper/2025/vol38-main-conference", +} + +func proceedingsURL(conf string, year int) (string, error) { + if conf == "icml" && pmlrVolumes[year] != "" { + return "https://proceedings.mlr.press/v" + pmlrVolumes[year] + "/", nil + } + if conf == "neurips" && neuripsVolumes[year] != "" { + return neuripsVolumes[year], nil + } + return "", fmt.Errorf("official %s proceedings profile is not verified for %d; supported years: 2024, 2025", conf, year) +} + +func hasClass(n *html.Node, class string) bool { + for _, value := range strings.Fields(attr(n, "class")) { + if value == class { + return true + } + } + return false +} + +func (p *Pipeline) fetchProceedings(ctx context.Context, conf string, year int, source string) error { + canonical, err := proceedingsURL(conf, year) + if err != nil { + return err + } + raw, err := get(ctx, source) + if err != nil { + return err + } + doc, err := html.Parse(strings.NewReader(string(raw))) + if err != nil { + return err + } + var rows []map[string]any + if conf == "icml" { + rows, err = pmlrRecords(ctx, doc, source, canonical) + } else { + rows, err = neuripsRecords(doc, canonical, year) + } + if err != nil { + return err + } + if len(rows) == 0 { + return fmt.Errorf("no papers parsed from official %s proceedings", conf) + } + u, err := url.Parse(source) + if err != nil { + return err + } + for _, row := range rows { + row["source_url"] = publicConferenceEndpoint(u) + } + return p.appendConferenceRecords(conf, year, rows) +} + +func pmlrRecords(ctx context.Context, doc *html.Node, source, canonical string) ([]map[string]any, error) { + declared := "" + blocks := []*html.Node{} + walk(doc, func(n *html.Node) { + if n.Type != html.ElementNode { + return + } + if n.Data == "meta" && attr(n, "property") == "og:url" { + declared = attr(n, "content") + } + if n.Data == "div" && hasClass(n, "paper") { + blocks = append(blocks, n) + } + }) + if declared != canonical || len(blocks) == 0 { + return nil, fmt.Errorf("PMLR index does not declare the expected volume %s", canonical) + } + base, _ := url.Parse(canonical) + rows := []map[string]any{} + byLink := map[string]map[string]any{} + identities := map[string]bool{} + for _, block := range blocks { + title, authors, link, review := "", "", "", "" + walk(block, func(n *html.Node) { + if n.Type != html.ElementNode { + return + } + if hasClass(n, "title") { + title = text(n) + } + if hasClass(n, "authors") { + authors = text(n) + } + if n.Data != "a" { + return + } + u, err := url.Parse(absolute(canonical, attr(n, "href"))) + if err != nil || u.User != nil { + return + } + if u.Scheme == "https" && u.Host == base.Host && strings.HasPrefix(u.Path, base.Path) && strings.HasSuffix(u.Path, ".html") { + link = u.String() + } + if u.Scheme == "https" && u.Host == "openreview.net" && u.Path == "/forum" && u.Query().Get("id") != "" { + review = "https://openreview.net/forum?" + url.Values{"id": {u.Query().Get("id")}}.Encode() + } + }) + id := link + if review != "" { + id = review + } + if title == "" || authors == "" || link == "" || byLink[link] != nil || identities[id] { + return nil, fmt.Errorf("PMLR paper has missing or repeated identity/title/authors") + } + row := map[string]any{"_id": id, "title": title, "author": authors, "link": link, "description": ""} + rows = append(rows, row) + byLink[link] = row + identities[id] = true + } + u, err := url.Parse(source) + if err != nil { + return nil, err + } + feedURL := u.ResolveReference(&url.URL{Path: "assets/rss/feed.xml"}).String() + raw, err := get(ctx, feedURL) + if err != nil { + return nil, err + } + var feed Feed + if err := xml.Unmarshal(raw, &feed); err != nil { + return nil, err + } + if feed.XMLName.Local != "rss" || len(feed.Channel.Items) != len(rows) { + return nil, fmt.Errorf("PMLR index/RSS paper counts disagree") + } + seen := map[string]bool{} + for _, item := range feed.Channel.Items { + link := "" + for _, l := range item.Links { + if l.Rel == "" || l.Rel == "alternate" { + link = l.Text + break + } + } + row := byLink[link] + if row == nil || seen[link] { + return nil, fmt.Errorf("PMLR RSS identity is missing from or repeated against index: %s", link) + } + seen[link] = true + row["description"] = item.Description + if item.PubDate != "" { + row["published"] = item.PubDate + } + } + return rows, nil +} + +func neuripsRecords(doc *html.Node, canonical string, year int) ([]map[string]any, error) { + declared := -1 + listed := 0 + rows := []map[string]any{} + seen := map[string]bool{} + var invalid error + base, _ := url.Parse(canonical) + prefix := fmt.Sprintf("/paper_files/paper/%d/hash/", year) + walk(doc, func(n *html.Node) { + if invalid != nil || n.Type != html.ElementNode { + return + } + if hasClass(n, "paper-count") { + parts := strings.Fields(text(n)) + if len(parts) > 0 { + value, err := strconv.Atoi(parts[0]) + if err == nil { + declared = value + } + } + } + if n.Data != "li" || n.Parent == nil || !hasClass(n.Parent, "paper-list") { + return + } + listed++ + if attr(n, "data-track") != "conference" { + return + } + title, authors, link := "", "", "" + walk(n, func(child *html.Node) { + if child.Type != html.ElementNode { + return + } + if hasClass(child, "paper-authors") { + authors = text(child) + } + if child.Data == "a" && attr(child, "title") == "paper title" { + title = text(child) + link = absolute(canonical, attr(child, "href")) + } + }) + u, err := url.Parse(link) + if err != nil || u.User != nil || u.Scheme != "https" || u.Host != base.Host || !strings.HasPrefix(u.Path, prefix) || !strings.HasSuffix(u.Path, "-Abstract-Conference.html") || title == "" || authors == "" || seen[link] { + invalid = fmt.Errorf("NeurIPS paper lacks valid main-track identity/title/authors for %d", year) + return + } + seen[link] = true + rows = append(rows, map[string]any{"_id": link, "title": title, "author": authors, "link": link, "description": "", "track": "conference"}) + }) + if invalid != nil { + return nil, invalid + } + if declared < 0 || declared != listed { + return nil, fmt.Errorf("NeurIPS declared/listed paper counts disagree: %d / %d", declared, listed) + } + return rows, nil +} diff --git a/internal/jobs/report.go b/internal/jobs/report.go index bc15d3c..b570ccf 100644 --- a/internal/jobs/report.go +++ b/internal/jobs/report.go @@ -102,7 +102,7 @@ func PDF(ctx context.Context, html, pdf string) error { return e } func (p *Pipeline) ConferenceReport(conf string, year int, pdf bool) error { - if _, e := ConferenceURLs(conf, year); e != nil { + if _, e := conferenceInfo(conf, year); e != nil { return e } papers, e := p.Catalog.Papers()