[Archivesspace_Users_Group] [External] Collection item count?

Corey Schmidt Corey.Schmidt at uga.edu
Tue Sep 27 10:13:43 EDT 2022

Hi Karen and Paul,

2 ways come to mind for me: 1) Using the database, if you have access to it. 2) Using the API.

For using the database, it would be the quickest and easiest provided you have access to it via your hosting provider. If you do and are familiar with SQL, something like the following would work:

SELECT * FROM archival_object WHERE root_record_id = 704 AND (level_id = 892 OR level_id = 890)

root_record_id is the ASpace ID for the resource you are trying to isolate. level_id is whether the archival object is a “item” or a “file” – in the example, it searches for objects with either “item” or “file” level. I use MySQL Workbench and it gets me the # of objects returned for a quick and easy count.

For using the API, you don’t need special permissions from your hosting provider, so you can access the API just as easily as you would any data from the staff interface. This would be more involved, as you would need to write a  script to execute, but if you’re familiar with Python or something of the like, it can be done. There are 2 endpoints that would seem useful for this: Get the list of URIs of this published resource and all published archival objects contained within<https://archivesspace.github.io/archivesspace/api/#get-the-list-of-uris-of-this-published-resource-and-all-published-archival-objects-contained-within-ordered-by-tree-order-i-e-if-you-fully-expanded-the-record-tree-and-read-from-top-to-bottom>, or Fetch tree information for the top-level resource record<https://archivesspace.github.io/archivesspace/api/#fetch-tree-information-for-the-top-level-resource-record>. The first endpoint would be good for getting all items that are published in a collection, but may include archival objects that are Series, sub-Series, etc. (aka not real items) and it excludes unpublished items. The second gets top level items, but if you have series, sub-series with children, then you would have to iterate through each of those to get an accurate count of every item (published or unpublished). Thankfully that endpoint gives you the data to point to those series/parents of children as precomputed waypoints, I believe, but it’s the more involved of the 2 endpoints to get right. Here’s an example<https://github.com/uga-libraries/aspace_scripts/blob/master/check_child_counts.py> when I used that endpoint to get all item counts that were greater or equal to 1000.

Paul’s way of doing it is straightforward and easy, so if that works, then that’s what I would recommend.

Hope this helps,


From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> On Behalf Of Paul Sutherland
Sent: Friday, September 23, 2022 10:50 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Re: [Archivesspace_Users_Group] [External] Collection item count?

Hi Karen,
I would also like to know how to generate a report like this, but a quick approach in the meantime I've used before: export the collection as EAD, and search level="item" (or file, or whichever else) within the resulting EAD.

On Fri, Sep 23, 2022 at 10:35 AM Karen Urbec <karen.urbec at whoi.edu<mailto:karen.urbec at whoi.edu>> wrote:
Hi Everyone,
I have what I thought would be a simple question, but it turns out is not so easy. I’m trying to get a complete item count from a collection, and I can’t see where that is listed or how to generate that report. I see where I can calculate the extent of each series, though those numbers don’t match what is in the series, so it’s unclear how that number is being calculated. This feels like such a simple question—I just want to know how many individual items are in a full collection, but we can’t seem to figure it out. Any help would be much appreciated!

Karen Urbec (she/her)
Institution Archivist, MBLWHOI Library
Data Library and Archives<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dla.whoi.edu_&d=DwMFAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=70gVc8PkZ8LRd0WR_N4Lh2vwCTUp-4jc9IXouEpQ4Go&m=Rnof0V_8dF2SSnx87z3t24T9RgaGs6I68nqfaHsda3I&s=5C-WWCkA-lM0yH2SlCEexe6H3zyzooInWRAyfuCJ0L8&e=>
Woods Hole Oceanographic Institution
266 Woods Hole Road, MS#8, Woods Hole, MA 02543

Archivesspace_Users_Group mailing list
Archivesspace_Users_Group at lyralists.lyrasis.org<mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>

Paul Sutherland (he/his)
Archivist of Indigenous Materials
Center for Native American and Indigenous Research
Library & Museum
American Philosophical Society
105 S. 5th Street, 2nd Floor
Philadelphia, PA 19406
Browse our Indigenous Subject Guide<https://indigenousguide.amphilsoc.org>
and read our latest blog posts<https://www.amphilsoc.org/blog-category/cnair>
Twitter: @paulssutherland<https://twitter.com/paulssutherland>

Becoming Weatherwise showing at the APS Museum<https://www.amphilsoc.org/visit-museum>, 4/8-12/30

The APS has updated its COVID responses<https://www.amphilsoc.org/aps-covid-vaccine-and-masking-policies>. APS buildings are open to staff and visitors, and it has expanded access to its Reading Room services. Please read our updated Reading Room policies on our website<https://www.amphilsoc.org/library#paragraph-36>.

I respectfully acknowledge that I work and reside in Lenapehoking, the homeland of the Lenape people in past, present, and future generations. I ​am grateful for the past and ongoing generosity of numerous Indigenous communities and individuals who have offered guidance, expertise, and opportunities for collaboration that make my work possible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20220927/313f7e3c/attachment.html>

More information about the Archivesspace_Users_Group mailing list