CLI Reference#
LitSync ships two commands: litsync (the mirror) and litsync-extract
(corpus extraction).
litsync#
litsync --data-root PATH --email EMAIL [options]
Options#
Flag |
Description |
|---|---|
|
Required. Root directory for the local mirror. |
|
Contact email sent in the |
|
Corpora to mirror: |
|
PMC OA groups: |
|
PMC formats: |
|
openFDA endpoints to mirror, e.g. |
|
Concurrent downloads (default: |
|
Per-file retry attempts (default: |
|
HTTP timeout (default: |
|
Plan only; download nothing. |
|
Re-download already-downloaded files to verify integrity. |
|
Delete local files no longer present on the server. |
|
Count articles in already-downloaded files and exit (no network). |
|
Disable Rich progress bars; use plain text output. |
|
Enable debug logging. |
Exit code is non-zero if any file failed, so cron/monitoring can alert.
Examples#
# Full mirror of all four sources
litsync --data-root /data/literature --email you@institute.org \
--sources pubmed pmc fda clinicaltrials
# Only two openFDA endpoints
litsync --data-root /data/literature --email you@institute.org \
--sources fda --fda-endpoints drug/event drug/label
# Daily cron entry (02:30)
30 2 * * * /path/to/venv/bin/litsync --data-root /data/literature \
--email you@institute.org >> /data/literature/_state/cron.log 2>&1
litsync-extract#
litsync-extract --data-root PATH --out PATH [options]
Options#
Flag |
Description |
|---|---|
|
Mirror root to read (default: |
|
Output directory for sharded JSONL (default: |
|
Sources to extract (default: |
|
Maximum shard size in MB (default: |
|
Extract at most N files per source (quick tests). |
|
Skip source files already recorded in resume state (default: on). |
|
Clear resume state and re-extract from the beginning. |
|
Split output into subdirectories by record year. |
|
Skip records with an empty abstract. |
|
Skip records with an empty body. |
|
Skip records with neither abstract nor body text. |
|
Disable Rich progress bars. |
|
Enable debug logging. |
Examples#
# Full corpus extraction (hours; very large)
litsync-extract --data-root /data/literature --out /data/corpus \
--sources pubmed pmc fda clinicaltrials
# Quick check: one file per source
litsync-extract --data-root /data/literature --out ./data/corpus_test \
--sources pubmed pmc fda clinicaltrials --limit 1
Makefile shortcuts#
The repository Makefile wraps both commands:
Target |
Description |
|---|---|
|
Install requirements / editable package. |
|
Run the incremental mirror. |
|
Plan only, download nothing. |
|
Maintenance operations. |
|
Sync a single source. |
|
Full extraction / one-file-per-source test. |
Environment variables#
NCBI_EMAILDefault contact email when
--emailis not given.