DOI-USGS / DOI-USGS/sbtools

item_list_files(recursive=T) restricted to 20 children max default of item_list_children()

Open
#344 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
24
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Now that sciencebase items are being reworked to remove heavily nested child items, many of those items are being unnested and pushed up as separate child items, under the parent page.

You can customize the number of children you access in `item_list_children()` with the `limit = X` argument, with the default of 20 covering most-uses cases. With this new sciencebase restructuring, there are many cases of pages with more than 20 items, so this argument is quite important.

However, you can't customize the number of child items searched through with `item_list_files()`, as it uses a default call to `item_list_files()`. That is, even with recursive=T, you will only ever return the files in the first 20(+1) child items for each page.

This would be easily patched by having `item_list_files()` accept a child_limit argument, which then gets passed to the internal call to `item_list_children()`

Here's an example where this fails. While this is an extreme example, it is the most downloaded item on sciencebase! `item_list_files` returns 436 files across 21 child items, but the sciencebase pages contain 2,385 files across 158 child items.

Reprex:
```
item_list_files("5669a79ee4b08895842a1d47", recursive = T)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.