OpenAlex Watcher monitors the OpenAlex S3 manifest for new works data
files, downloads the relevant JSONL archives, and processes them through
citescoop to produce temporary outputs for authors, institutions and
works.
- Watch the OpenAlex S3 manifest for updates
- Download new OpenAlex works files from S3
- Stream gzipped JSONL files into
citescoop - Combine processed temporary entity files into PBF outputs
- Python 3.11 or newer
citescoop-clibinary- Network access to the OpenAlex S3 bucket
-
Install requirements
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt -
Run the watcher:
python3 watcher.py \ --citescoop /path/to/citescoop-cli \ --output-dir /path/to/output \ --max-parallel 2
-
The watcher will process OpenAlex works files and write temporary outputs to
output-dir. After processing, it will combine entity files into:authors.pbfinstitutions.pbfworks.pbf
You can run the watcher on a schedule using cron or systemd timers.
Cron example (run daily at 02:00):
0 2 * * * /usr/bin/python3 /path/to/watcher.py --citescoop /path/to/citescoop-cli --output-dir /path/to/output --max-parallel 2 >> /var/log/openalex-watcher.log 2>&1systemd timer example:
Create a service unit at /etc/systemd/system/openalex-watcher.service:
[Unit]
Description=OpenAlex Watcher
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /path/to/watcher.py --citescoop /path/to/citescoop-cli --output-dir /path/to/output --max-parallel 2Create a timer unit at /etc/systemd/system/openalex-watcher.timer to run daily at 02:00:
[Unit]
Description=Run OpenAlex Watcher daily
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
[Install]
WantedBy=timers.targetEnable and start the timer:
sudo systemctl daemon-reload
sudo systemctl enable --now openalex-watcher.timerThe watcher reads its last processed date from a config file, which must contain a [watcher] section and a date value in ISO 8601 format.
Example:
[watcher]
date = 2025-01-01T00:00:00Use --force to reprocess the current manifest even if its date is not newer than the configured date.
See the CONTRIBUTING document.
This repo uses the REUSE standard in order to
communicate the correct license for the file. For those unfamiliar with
the standard the license for each file can be found in one of three
places. The license will either be in a comment block at the top of the
file, in a .license file with the same name as the file, or in the
dep5 file located in the .reuse directory. All files committed to this
repo must contain valid licensing information or the pull request can
not be accepted.