emory-libraries / aspace

0 stars 0 forks source link

Create a custom report to track restrictions. #108

Closed erussey closed 1 year ago

erussey commented 1 year ago

We would like a custom report set up that reports information about restrictions imposed on archival objects, resources, and digital objects. This report will be used to track and lift restrictions that expire. Please be sure the custom report appears in the custom reports list in the staff UI. Note that there is an out of the box report for restricted material, but it keys off of fields we don't use and we would like the start/end dates for the restriction as part of the report. This report cannot be generated using the custom reports feature; please create an API script for this report that is emailed quarterly to a list of ASpace users. Note also that restrictions appear on all types of archival objects, so the level of description may very.

The report requestor should be able to set a start and end date for the report as well as be able to designate the repository to query. We would like these reports to be in .csv . Restrictions with no begin and end date should be returned regardless of the start and end date requested. We are looking for results with a local access restriction type imposed OR the "restrictions apply" box to be checked. All of our resources contain a restrictions on access note (no restrictions apply), so the script should not just look for the presence of the note.

The report should include: Repository, associated resource title, associated resource identifier, archival_object identifier where restriction appears, archival_object title, archival_object level of description, restriction on access begin, restriction on access end, local access restriction type, associated subnote text content.

Screen Shot 2023-03-13 at 3.52.29 PM.png

lisahamlett commented 1 year ago

According to https://archivesspace.atlassian.net/wiki/spaces/ArchivesSpaceUserManual/pages/2914877469/Creating+Managing+and+Running+Custom+Reports, "A custom reporting feature is in ArchivesSpace beginning in version v3.2. Reports will only include results based on the user's active repository. Reporting isn't available across repositories."

Therefore, this is not possible in ArchivesSpace and will need to be done via API.

lisahamlett commented 1 year ago

API work is not the responsibility of Core Systems, so I have reassigned this ticket to the backend team.

erussey commented 1 year ago

@AGCooper : Can you run a report like was done for #107 that exports all the available fields with sample data? It'd be best if it were run on the Rose repository. I can use that to amend the requirements above to fit what is available.

erussey commented 1 year ago

After looking at the report extract and the fields available in custom reports, it looks like we're not going to be able to do what we need to do using custom reports. This will need to be an API-based report and reassigned to the backend team. Per a conversation with @AGCooper , we might be able to automate this report to be emailed to archivists using Kleene.

tmill29 commented 1 year ago

@rotated8 will create a new repo for scripts

tmill29 commented 1 year ago

API scripts repo: https://github.com/emory-libraries/aspace-api-scripts

erussey commented 1 year ago

Refinement of the requirements based on a conversation with @bwatson78 : Restrictions need to be returned from archival objects only within resource records. Though digital objects carry restrictions, they are out of scope for this report. Restrictions are within a Note with a note type of Conditions Governing Access. Restrictions exist (and should be returned) for archival objects that either have the "restrictions apply" button checked in the archival object OR have a local access type in the restriction note. Presence of a restrictions note should not determine if the record should be returned since we create these for all resources (noting there are no restrictions if there are none).

Requirements for fields to return in the ticket are the same with the exception of the restriction begin date, which Brad and I determined we do not need.

bwatson78 commented 1 year ago

I started to build the SQL query to process this report and hit a wall when trying to access the notes within the note association. It turns out that the multiples of notes here are saved as binary objects that correlate to a customized JSONModel class that isn't accessible via generic SQL tools. I huddled with @rotated8 to get his opinion. He echoed my belief that this would be worthwhile to look at in the future, but not in our current scope.

erussey commented 1 year ago

Since the custom report within the UI seems to be an enhancement, I am wondering if a script could be developed that I could run myself using an API call through a command line prompt that returns the data in a .csv file. It probably would require two calls...one to the resource to get the resource data as well as the restricted note IDs + a call to the notes to pull back the data from the ones we want. It'd be great if this were in one script, but even multiple scripts that I could combine together (with a key that matches data in both) would work.

bwatson78 commented 1 year ago

Scripts are now here: https://github.com/emory-libraries/aspace-api-scripts Example reports: https://emory-my.sharepoint.com/:f:/g/personal/bwatso9_emory_edu/Emw6GtK5Y-NBlxXcAIWeEaoBZHvJa1169joI_vOKSM4BhA?e=mwHsI3

erussey commented 1 year ago

I was able to run this report successfully. Thanks for the help getting this going @bwatson78 ! We should be able to use similar scripts for data maintenance (scheduled for a later sprint).