NEWS


openalexPro 0.18.1

openalexPro 0.18.0

openalexPro 0.17.0

openalexPro 0.16.0

openalexPro 0.15.0

openalexPro 0.14.1

openalexPro 0.14.0

openalexPro 0.13.0

extract_doi(): fewer truncated and false DOIs, new lower

A query with no results no longer fails to convert

pro_fetch() / pro_request_parquet() stopped with "Cannot extract field from expression "r.*" because it is not a struct" when a query matched no works: with "results": [] DuckDB has no record to infer the columns from. The columns now come from the baseline schema of the entity named in the query record (_query.json), and the output is a zero-row dataset with the usual columns, which arrow::open_dataset() reads.

Fewer, larger Parquet files: compact_parquet, pro_compact_parquet()

pro_request_parquet() writes one Parquet file per API page (up to 200 records), so a large query becomes thousands of small files, which are slow to read. New argument compact_parquet (pro_request_parquet(), pro_fetch(); default NULL keeps one file per page, as before) and new function pro_compact_parquet() (for an existing dataset) combine each query's page files into files of up to that many records, e.g. 250000. Records, columns and their order do not change. For 1.1 million works, compaction took about 20 seconds; afterwards aggregates and lookups by ID ran 35 to 50 times faster, reading full records with DuckDB 4 times faster, and the dataset was 40% smaller.

A compacted file holds whole consecutive pages and is named after them (results_pages_1-1250.parquet). Files are written one at a time (.part, record count checked, renamed, then the pages deleted), so an interrupted compaction is completed by running it again, and resume = TRUE never converts a compacted page again. A query that cannot be compacted keeps its page files, with a warning. pro_compact_parquet() stops if an openalexSnapshot index (which points to files and row numbers) exists next to the dataset.

Resume in the middle of a query

resume = TRUE no longer fetches an interrupted query again from page 1: it continues after the last saved page. OpenAlex's cursors are positions in the sort order that do not expire (a cursor from May still worked in October), but contain nothing about the query; so after each page the exact query (the URL, or for via = "oqo" the OQO that ran) and the cursor are written to _paging.json, with the time the cursor was created, which the resume message reports. Anything that cannot be trusted falls back to fetching the query again from page 1, with the reason. Samples and semantic search still start again.

New argument inconsistency_on_resume = c("error", "warning", "ignore", "oldest", "newest") (pro_request(), pro_fetch()): after a resume, duplicates (found exactly, by work ID) and missing records (only as a net difference to OpenAlex's current count) stop the run by default; nothing is lost, and a rerun with another value applies the choice without downloading again. "oldest" / "newest" remove the other copy from its page file. The resume is recorded in _query.json.

Readable query files for papers: _query_oql.txt, _query_oql.html

Next to _query.json, each downloaded query now gets its OQL -- OpenAlex's readable rendering of the query that ran -- as plain text (to paste into a methods section) and as a self-contained HTML page with highlighted keywords, OpenAlex IDs linked to their records, and the exact OQO. Because OpenAlex's rendering can be lossy in some details, the OQL is translated back and compared: the files say whether it reproduces the query exactly. Both use OpenAlex's free /query endpoint (two calls per query); if it is unreachable the download is unaffected and the files are marked "not checked". Both are copied into the Parquet partition.

For a list of queries, _queries_oql.txt and _queries_oql.html at the top of the output summarise all queries in list order -- name, records, whether the OQL is exact, the OQL -- with totals, for a paper's supplement (queries skipped by resume included, failed ones listed as not downloaded).

Test recordings refreshed

All recorded API responses were re-recorded from the live API (with the key sent as a header and masked). The snapshot differences were checked: only data drift (counts, citations, one record with fewer locations) and fields OpenAlex has added since spring (study_designs, volume, awards details, observed_orcids, location doi / listed_in, meta.x_query); no field was removed. The URL / OQO equivalence tests passed again on the fresh data, and a pro_count() comparison was added. inst/scripts/record_cassettes.R now records all tests even when snapshots fail (testthat stopped after 10 failures and left later cassettes unrecorded, while reporting success) and stops if any cassette is missing.

Lossless queries: via = "oqo", query record, cost, key as header

OQL and OQO queries

pro_query() gains oql and oqo (both default NULL, behaviour unchanged) for OpenAlex's query language and its JSON form, which express what the classic filter syntax cannot, such as nested and / or conditions:

pro_query(oql = "works where year >= (2020) and (title has (coral) or title has (reef))")
pro_query(oqo = list(get_rows = "works",
                     filter_rows = list(list(column_id = "publication_year", value = 2020))))

The URL targets the API root and runs through pro_request(), pro_count() and pro_fetch() unchanged. Entity, conditions, grouping, sample and corpus belong inside the query; combining it with entity, id, doi, search arguments, group_by or filters is an error, because OpenAlex would silently ignore them. select and options are passed alongside. An invalid query fails with OpenAlex's parse error and position.

pro_request() now detects grouped results from the response (meta$groups_count) instead of looking for group_by= in the URL, so grouping inside an OQL / OQO query is saved and converted correctly.

pro_fetch() gains download_workers

Downloading is limited by the API, converting by CPU and memory, so the best number of workers differs. pro_fetch() used workers for both steps. download_workers (default workers, so existing calls are unchanged) now sets the download workers separately; workers sets the conversion workers.

Download robustness: failing queries, paging parameters, semantic search

Filter and select validation per entity

pro_query() checked filter names and select fields against the lists for works, whatever the entity, so valid entity-specific names were rejected before reaching OpenAlex -- e.g. pro_query(entity = "institutions", country_code = "US") or select = "orcid" for authors. Refreshing with update = TRUE did not help, as it fetched the works list again.

opt_filter_names() and opt_select_fields() gain an entity argument (default "works", so existing calls are unchanged) and cache one list per entity; pro_query() validates against the queried entity's lists. The lists come from OpenAlex's error message for an invalid name, which costs no credits. An entity without a list (the retired "venues") skips validation and lets OpenAlex answer.

Parsing that message also dropped the first name of every list (e.g. the abstract.search filter, and id, which was patched back in by hand) and left a trailing period on the last select field ("created_date."); both are fixed.

An argument of the functions that send a query, given to pro_query() by mistake (e.g. pro_query(doi = dois, via = "oqo")), was taken as a filter and failed with "Invalid filter name(s): via". It now says where it belongs: "via is an argument of pro_fetch(), pro_request(), pro_count()", with an example.

Documentation brought up to date

delete_input no longer deletes pages that failed to convert

With on_error = "warn" or "ignore", pro_request_parquet(delete_input = TRUE) deleted the JSON input even when some files had failed -- the only copy of those pages -- so resume = TRUE could not recover them. The input is now kept unless every file converted.

Downloads survive network failures and stalls

api_call() retried only on HTTP 429/5xx. A dropped connection or curl error aborted the whole leaf, and a stalled transfer could hang a worker forever. Network failures are now retried with the same backoff, and a transfer below 1 byte/s for 120 s is aborted and retried. Requires httr2 >= 1.0.0.

resume works for a single URL, and in pro_fetch()

pro_request(resume = TRUE) was silently ignored for a single URL and failed with "Directory exists". A single URL is now treated as one leaf. pro_fetch() gains resume (default FALSE, behaviour unchanged), which completes an interrupted download and conversion and returns a finished run unchanged.

No count request per query before a parallel download

To size its progress bar, pro_request() with a list of queries first sent a count request for every leaf, one after another, before downloading anything. For a chunked DOI / ID list (one page per leaf) that doubled the requests and their cost. Progress now counts leaves, each advancing in fractions as its pages arrive, with no extra requests.

Clearer API errors, and no pointless retries on an exhausted budget

A 4xx error now includes OpenAlex's own explanation (e.g. which filter name is invalid) instead of only "HTTP 400 Bad Request". A 429 caused by the daily budget -- used up (X-RateLimit-Remaining at zero), or a query refused as costing more than is left ("error": "not_enough_credits") -- fails immediately and says when the budget resets, instead of backing off for about 17 minutes before failing. verbose = TRUE no longer prints the API key as part of the URL.

pro_query() no longer fetches the list of valid select fields when no select is given, saving a request per session.

pro_query() knows the current entities

entity now also accepts "sources", "topics" and "locations". "venues" and "concepts" (replaced by sources and topics in OpenAlex) are kept for compatibility. The default is still "works".

Better load balancing for parallel downloads

pro_request() with a list of queries pre-split the leaves into one block per worker, so a worker that drew the large leaves ran on while the others sat idle. Each leaf is now dispatched to the next free worker.

openalexPro 0.12.1

The startup banner pointed at the old r-universe

.onAttach() printed https://rkrug.r-universe.dev/openalexPro. The package has been distributed from https://openalexpro.r-universe.dev since the move to the openalexPro organisation -- and DESCRIPTION's Additional_repositories already said so -- so the one URL every user saw on every library(openalexPro) was the one that was wrong.

Also tidies two typos in the same banner (functions definitions, and a space before a comma).

openalexPro 0.12.0

Breaking: pro_request_parquet() no longer hides conversion failures

A JSON file that failed to convert was caught, message()d only when verbose, and the run then reported success anyway. The page was simply absent from the resulting corpus: read_corpus() worked, nothing warned, and every downstream count was quietly wrong. On a large run under memory pressure this is worse than a crash, because a crash at least announces itself.

Failures are now collected, retried once sequentially with the full memory budget (per-file peak memory varies with how large and nested a page is, so sizing the per-worker limit for the worst file would throttle all of them), and whatever still fails is reported according to the new on_error argument: "error" (default) stops and names the files, "warn" warns and returns, "ignore" restores the old silence.

This will stop runs that previously appeared to succeed. That is the point. Pass on_error = "warn" for the closest thing to the old behaviour, but visible.

Each file is now written to a .part sidecar and renamed on success. A parquet footer is written last, so a worker killed mid-COPY used to leave a file that looked plausible to file.exists() but could not be read.

DuckDB connections are configured rather than left at their defaults

New internal .pro_con() factory, mirroring openalexSnapshot:::.oas_con(). Every connection in the package now goes through it, including the schema inference pass and convert_json_to_parquet().

This matters most inside future workers. Each worker used to open a bare dbConnect(duckdb::duckdb()), which means:

Workers now get a per-worker memory budget derived from physical RAM and the worker count, threads = 1 (the processes already saturate the machine), and a private spill directory under tempdir(). memory_limit and retry_memory_limit are exposed for callers who want to set them directly.

Physical RAM is derived without a new dependency or platform code: a bare DuckDB connection's own memory_limit is 80% of it.

resume for both request functions

pro_request(resume = TRUE) refetches only the leaf queries that did not complete, using the 00_in.progress sentinel each leaf directory already carried and which nothing previously read. pro_request_parquet(resume = TRUE) converts only the files that are not already present -- trustworthy because of the .part-and-rename change above.

Previously the only options were overwrite = TRUE (delete everything and refetch) or overwrite = FALSE (hard error). There was no way to continue an interrupted download.

openalexPro 0.11.0

Breaking changes

Bug fixes

openalexPro 0.10.4

Internal / Code Quality

New Features

Bug Fixes

Breaking Changes

Internal Changes

openalexPro 0.9.0

New Features

openalexPro 0.8.1

Bug Fixes

openalexPro 0.8.0

New Features

openalexPro 0.7.0

Breaking Changes

New Features

openalexPro 0.6.1

Bug Fixes

Changes

Testing and Tooling

openalexPro 0.6.0

New Features

Internal Changes

Deprecations

Bug Fixes

Changes

Breaking Changes

openalexPro 0.5.0

New Features

Snapshot Handling

Documentation

Changes

Bug Fixes

Changes

Tests

openalexPro 0.4.2

Breaking Changes

Documentation

Tests

openalexPro 0.4.1

openalexPro 0.4.0

openalexPro 0.3.1

openalexPro 0.3.0

openalexPro 0.2.0