Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(journal-quality): follow OpenAlex 2026-06 standard-format snapshot layout (#4830)

LearningCircuitffa6a8578472
diff --git a/changelog.d/4830.bugfix.md b/changelog.d/4830.bugfix.md
new file mode 100644
index 0000000000..6ef5369eea
--- /dev/null
+++ b/changelog.d/4830.bugfix.md
@@ -0,0 +1 @@
+Journal-quality data downloads now follow OpenAlex's 2026-06 "standard-format" snapshot layout (`data/jsonl/<entity>/manifest.json`). The previous paths started returning 404, breaking the OpenAlex sources and institutions downloads.
diff --git a/src/local_deep_research/journal_quality/data_sources/_openalex_common.py b/src/local_deep_research/journal_quality/data_sources/_openalex_common.py
index eeb5ffe1da..65f7f0dcc0 100644
--- a/src/local_deep_research/journal_quality/data_sources/_openalex_common.py
+++ b/src/local_deep_research/journal_quality/data_sources/_openalex_common.py
@@ -22,7 +22,8 @@ from loguru import logger
# Public OpenAlex snapshot — CC0, no auth, no rate limits.
# Manifest format documented at:
# https://docs.openalex.org/download-all-data/snapshot-data-format
-# Each entry in ``manifest["entries"]`` has ``url`` (s3://...) and
+# Each entry in ``manifest["files"]`` (``manifest["entries"]`` before the
+# 2026-06 standard-format snapshot) has ``url`` (s3://...) and
# ``meta.content_length`` / ``meta.record_count``. We translate s3:// to
# the public HTTPS gateway so we don't need boto3.
OPENALEX_S3_BASE = "https://openalex.s3.amazonaws.com"
@@ -97,7 +98,7 @@ def iter_partitions(
count, schema-drift counters) that doesn't belong in the helper.
Args:
- entries: ``manifest["entries"]`` — each dict has ``url``
+ entries: ``manifest["files"]`` — each dict has ``url``
starting with ``s3://openalex/``.
data_dir: Directory used for the transient ``.<prefix>_part_<n>.gz``
files. Cleaned up even on exception.
diff --git a/src/local_deep_research/journal_quality/data_sources/institutions.py b/src/local_deep_research/journal_quality/data_sources/institutions.py
index 247c6d1214..c60f00b8db 100644
--- a/src/local_deep_research/journal_quality/data_sources/institutions.py
+++ b/src/local_deep_research/journal_quality/data_sources/institutions.py
@@ -35,7 +35,7 @@ from ..scoring import normalize_name
from .base import DataSource
_OPENALEX_INSTITUTIONS_MANIFEST = (
- f"{OPENALEX_S3_BASE}/data/institutions/manifest"
+ f"{OPENALEX_S3_BASE}/data/jsonl/institutions/manifest.json"
)
# Safety floor — OpenAlex has ~120K institutions. Refuse to overwrite
@@ -81,7 +81,10 @@ class InstitutionSource(DataSource):
manifest_resp.raise_for_status()
manifest = manifest_resp.json()
- entries = manifest.get("entries", [])
+ # OpenAlex's 2026-06 "standard-format" snapshot renamed the
+ # manifest's part list from ``entries`` to ``files`` (see
+ # ``openalex.py``). Entry shape (url + meta) is unchanged.
+ entries = manifest.get("files", [])
# Validate every part URL before fetching any part — SSRF
# defense in depth. If any entry points outside the OpenAlex
diff --git a/src/local_deep_research/journal_quality/data_sources/openalex.py b/src/local_deep_research/journal_quality/data_sources/openalex.py
index 47771e6e48..924481bed0 100644
--- a/src/local_deep_research/journal_quality/data_sources/openalex.py
+++ b/src/local_deep_research/journal_quality/data_sources/openalex.py
@@ -5,7 +5,7 @@ Downloads the **bulk snapshot** of ~280K journals + conferences from
used by the in-memory tier-2 lookups.
This is the public OpenAlex S3 snapshot — CC0 licensed, no auth, no
-rate limits, ~350 MB compressed across ~40 partition files. We stream
+rate limits, ~350 MB compressed across ~120 partition files. We stream
each part, extract the few fields we need, and discard the rest. Total
wall-clock is ~30–60 s on a normal connection.
@@ -39,7 +39,9 @@ from ._openalex_common import (
validate_manifest_entries,
)
-_OPENALEX_SOURCES_MANIFEST = f"{OPENALEX_S3_BASE}/data/sources/manifest"
+_OPENALEX_SOURCES_MANIFEST = (
+ f"{OPENALEX_S3_BASE}/data/jsonl/sources/manifest.json"
+)
class SchemaDriftError(RuntimeError):
@@ -93,7 +95,11 @@ class OpenAlexSource(DataSource):
manifest_resp.raise_for_status()
manifest = manifest_resp.json()
- entries = manifest.get("entries", [])
+ # OpenAlex's 2026-06 "standard-format" snapshot moved the data to
+ # ``data/jsonl/<entity>/`` and renamed the manifest's part list from
+ # ``entries`` to ``files``. Each file entry still has ``url``
+ # (s3://openalex/...) + ``meta.record_count`` / ``meta.content_length``.
+ entries = manifest.get("files", [])
total_records = sum(
e.get("meta", {}).get("record_count", 0) for e in entries
)
diff --git a/tests/journal_quality/test_institutions_malformed_lines.py b/tests/journal_quality/test_institutions_malformed_lines.py
index a840b10505..3b754420fe 100644
--- a/tests/journal_quality/test_institutions_malformed_lines.py
+++ b/tests/journal_quality/test_institutions_malformed_lines.py
@@ -34,8 +34,8 @@ def _gz_lines(lines: list[bytes]) -> bytes:
def _manifest(num_parts: int) -> dict:
return {
- "entries": [
- {"url": f"s3://openalex/data/institutions/part_{i}.gz"}
+ "files": [
+ {"url": f"s3://openalex/data/jsonl/institutions/part_{i}.gz"}
for i in range(num_parts)
]
}
diff --git a/tests/journal_quality/test_openalex_common.py b/tests/journal_quality/test_openalex_common.py
index c5e77a9f62..0ad3bf1b07 100644
--- a/tests/journal_quality/test_openalex_common.py
+++ b/tests/journal_quality/test_openalex_common.py
@@ -38,15 +38,15 @@ def _response(content: bytes) -> MagicMock:
class TestValidateManifestEntries:
def test_accepts_allowed_prefix(self):
entries = [
- {"url": "s3://openalex/data/sources/part_0.gz"},
- {"url": "s3://openalex/data/sources/part_1.gz"},
+ {"url": "s3://openalex/data/jsonl/sources/part_0.gz"},
+ {"url": "s3://openalex/data/jsonl/sources/part_1.gz"},
]
# Should not raise
validate_manifest_entries(entries, "test")
def test_rejects_disallowed_prefix(self):
entries = [
- {"url": "s3://openalex/data/sources/part_0.gz"},
+ {"url": "s3://openalex/data/jsonl/sources/part_0.gz"},
{"url": "s3://attacker/data/evil.gz"},
]
with pytest.raises(ValueError, match="disallowed URL"):
@@ -62,8 +62,8 @@ class TestIterPartitions:
def test_yields_records_per_partition(self, tmp_path):
"""Each partition yields (idx, total, records) once."""
entries = [
- {"url": "s3://openalex/data/sources/part_0.gz"},
- {"url": "s3://openalex/data/sources/part_1.gz"},
+ {"url": "s3://openalex/data/jsonl/sources/part_0.gz"},
+ {"url": "s3://openalex/data/jsonl/sources/part_1.gz"},
]
parts = [
_gz_lines([b'{"id": "S1"}', b'{"id": "S2"}']),
@@ -91,7 +91,7 @@ class TestIterPartitions:
def test_cleans_up_tmp_files(self, tmp_path):
"""Temp partition files must be deleted after each partition."""
- entries = [{"url": "s3://openalex/data/sources/part_0.gz"}]
+ entries = [{"url": "s3://openalex/data/jsonl/sources/part_0.gz"}]
safe_get = MagicMock(
return_value=_response(_gz_lines([b'{"id": "S1"}']))
)
@@ -112,7 +112,7 @@ class TestIterPartitions:
def test_cleans_up_tmp_files_on_exception(self, tmp_path):
"""If safe_get raises, the tmp file is still cleaned up."""
- entries = [{"url": "s3://openalex/data/sources/part_0.gz"}]
+ entries = [{"url": "s3://openalex/data/jsonl/sources/part_0.gz"}]
safe_get = MagicMock(side_effect=RuntimeError("network down"))
with pytest.raises(RuntimeError):
@@ -140,7 +140,7 @@ class TestIterPartitions:
exact failure shape that hit CI on the journal-data-integration
workflow.
"""
- entries = [{"url": "s3://openalex/data/sources/part_0.gz"}]
+ entries = [{"url": "s3://openalex/data/jsonl/sources/part_0.gz"}]
safe_get = MagicMock(
return_value=_response(_gz_lines([b'{"id": "S1"}']))
)
@@ -178,7 +178,7 @@ class TestIterPartitions:
request more than 3 retries AND a backoff schedule whose total
sleep exceeds the generic 7 s.
"""
- entries = [{"url": "s3://openalex/data/sources/part_0.gz"}]
+ entries = [{"url": "s3://openalex/data/jsonl/sources/part_0.gz"}]
safe_get = MagicMock(
return_value=_response(_gz_lines([b'{"id": "S1"}']))
)
@@ -211,7 +211,7 @@ class TestIterPartitions:
callers must still be able to override (e.g. tests that don't
want to wait, or future callers with different SLAs).
"""
- entries = [{"url": "s3://openalex/data/sources/part_0.gz"}]
+ entries = [{"url": "s3://openalex/data/jsonl/sources/part_0.gz"}]
safe_get = MagicMock(
return_value=_response(_gz_lines([b'{"id": "S1"}']))
)
@@ -234,7 +234,7 @@ class TestIterPartitions:
def test_suppresses_malformed_lines(self, tmp_path, caplog):
"""Bad JSON lines are skipped, not fatal; first-10 warnings logged."""
- entries = [{"url": "s3://openalex/data/sources/part_0.gz"}]
+ entries = [{"url": "s3://openalex/data/jsonl/sources/part_0.gz"}]
# One good line + 15 bad lines — the helper should yield the
# good one, skip the rest, and emit <= 11 warnings (10 per-line
# + 1 suppression notice, plus 1 aggregate summary).
diff --git a/tests/journal_quality/test_openalex_schema_drift.py b/tests/journal_quality/test_openalex_schema_drift.py
index f780f8ae88..ab140b72cf 100644
--- a/tests/journal_quality/test_openalex_schema_drift.py
+++ b/tests/journal_quality/test_openalex_schema_drift.py
@@ -33,8 +33,8 @@ def _make_jsonl_gz(records):
def _manifest(num_parts: int):
return {
- "entries": [
- {"url": f"s3://openalex/data/sources/part_{i}.gz"}
+ "files": [
+ {"url": f"s3://openalex/data/jsonl/sources/part_{i}.gz"}
for i in range(num_parts)
]
}