Re: [Archivesspace_Users_Group] Oddities when updating Agents via the API

2019-10-11 Thread Detelich, Alicia
Hi Rachel,

Basically, what you are seeing is that whenever a record is posted, all of its 
subrecords are deleted and recreated, even if no changes are made to the 
subrecords themselves. When this happens a new database identifier, create 
time, lock version etc. are assigned to each subrecord. I don’t think it’s a 
bug, per se, but it is an odd behavior that has come up numerous times in my 
work as well.

I am not sure why the decision to design subrecords that way was made by the 
original developers of the application (if anyone has thoughts please let me 
know!), nor do I have a sense of the amount of work/consequences involved in 
updating the application so that subrecords are persistent.

There isn’t a way to only post the changing fields via the API, since only 
top-level records (resources, archival objects, etc.) have their own URIs. An 
alternative solution would be to do a (very careful!) database update to the 
relevant field(s) in the relevant name table(s).

Hope this helps,

Alicia

Alicia Detelich
Archivist
Manuscripts and Archives
Yale University Libraries

From:  on behalf of 
Rachel Donahue 
Reply-To: Archivesspace Users Group 

Date: Friday, October 11, 2019 at 11:52 AM
To: "archivesspace_users_group@lyralists.lyrasis.org" 

Subject: [Archivesspace_Users_Group] Oddities when updating Agents via the API

Hi all,

I'm running some bulk updates to Agents (in this case people) via the API and 
noticed some rather odd changes to sub-records when I check the JSON after 
successfully running the update.

1. Every sub-record (e.g. names, telephones) has replaced "created_by" with the 
user authenticated by the API and create_time with the time of the API call. 
The Agent itself retains its created_by and time, thankfully, but all the bits 
and pieces lose it.
2. Possibly related to this, a new telephone number is created even though 
nothing about the phone number has changed. (e.g. what was /telephone/99 is now 
/telephone/204)
3. The lock_version for the sub-records isn't changing from 0.

The only thing changing in these updates is the name source and we're using 
ArchivesSpace 2.6.0. I have been reposting the entire object in the update--is 
it possible to post *only* the changing fields and perhaps avoid the problem?

While this isn't a make-or-break problem, I'd really like to retain the 
created_by information for names, as it is often *not* the same as the person 
who created the initial record. I'm also not sure if this is a bug or something 
I'm doing wrong. Any insights would be much appreciated!

Best,
Rachel

--

Please note that I currently do not have access to ARS email. If you need to 
contact me, use my LAC address: 
rachel.dona...@lac-group.com

The information contained in this e-mail message is confidential. If you are 
not the intended recipient, any dissemination or copying is strictly 
prohibited. If you think that you have received this e-mail message in error, 
please contact the sender.
___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


Re: [Archivesspace_Users_Group] Container and Location management reports

2019-03-19 Thread Detelich, Alicia
Hi Adrien,

We use top containers, container profiles, and locations. Our reporting needs 
vary, but often they are related to answering questions like:
   “What boxes/materials are in this location?”
“How much space do those boxes occupy?”
“What’s in the box(es)?”
“How many VHS boxes do we have?”
“How many linear feet is collection X?”
“Here’s a list of barcodes that should be in X location, are they actually 
there?”
“How many boxes are in ArchivesSpace that aren’t associated with a descriptive 
record?”

To answer these questions, and others, we’ve typically used database queries. 
The API is not usually the most efficient way to retrieve ArchivesSpace data, 
though we have used the search endpoints for some reporting functions. For 
instance, this tool - https://github.com/ucancallmealicia/barcode_search - will 
take a list of barcodes, which are stored in top container records, and 
retrieve data about the containers and their associated descriptive records. 
This helps us to manage transfers of material to off-site storage.

For the most part, though, SQL queries are the way to go. You’ll find a bunch 
of examples in these repos:
https://github.com/ucancallmealicia/mysql_demo
https://github.com/ucancallmealicia/archivesspace-sql
https://github.com/YaleArchivesSpace/yams_data_auditing

We haven’t used the out-of-the box reporting functionality, but we are 
considering it now that the module has been updated to allow users to add 
custom reports using raw SQL. Doing so would allow non-technical users to run 
these reports without having to ask technical staff for assistance. It has 
worked well during testing, though I think we as an institution will need to 
determine some criteria re: which reports we want to add before we start using 
it, since the reports are shared across repositories.

Hope this helps,

Alicia

Alicia Detelich
Archivist
Manuscripts and Archives
Yale University Libraries

From:  on behalf of 
"Hilton, Adrien" 
Reply-To: Archivesspace Users Group 

Date: Tuesday, March 19, 2019 at 9:53 AM
To: "archivesspace_users_group@lyralists.lyrasis.org" 

Subject: [Archivesspace_Users_Group] Container and Location management reports

Dear Colleagues,

I’m wondering if anyone at a repository that currently uses containers, 
container profiles, locations, and/or location profiles might offer me some 
advice regarding reporting.

What kinds of data do you find yourself needing most regularly? How are you 
getting that data? Customized reporting, out of the box reports, database 
queries, API, others?

Thanks in advance,
Adrien
___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


Re: [Archivesspace_Users_Group] batch re-ordering of controlled value lists; script/plugin, anyone?

2017-10-18 Thread Detelich, Alicia
Hi Steve,

I agree that being able to search across repositories would be a very useful 
option for admin users. As a workaround, I have some queries that will find all 
resource or archival object records (can also be extended to digital objects, 
accessions, etc.) that are linked to a certain enumeration. I have one for 
extent types here - 
https://github.com/ucancallmealicia/archivesspace-sql/blob/master/extent_type_rec_links.sql.
 I can also try to dig up the one I have for container profiles if you’d like - 
it generally follows the same process, just using different tables.

Alicia

Alicia Detelich
Archivist
Manuscripts and Archives
Yale University Libraries
alicia.detel...@yale.edu

From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
[mailto:archivesspace_users_group-boun...@lyralists.lyrasis.org] On Behalf Of 
Majewski, Steven (sdm7g)
Sent: Wednesday, October 18, 2017 3:30 PM
To: Archivesspace Users Group 
Subject: Re: [Archivesspace_Users_Group] batch re-ordering of controlled value 
lists; script/plugin, anyone?


It looks like the positioning would be very simple to do in mysql as you only 
have to modify the position value in the table — no complicated joins required. 
You could do it interactively with a GUI frontend like Sequel Pro or 
MySQLWorkbench. Just make sure you don’t leave any duplicate positions.

If you already have a table of enum values and new positions, and you want to 
do it programmatically, then you can load those pairs as a temporary table, and 
create a function return position given value string, and use that function in 
your update statement rather than try to explicitly iterate over the tables.

Merging enumeration values, on the other hand, is more complicated, and I would 
leave it to the frontend/backend, and not try MySQL surgery.

We are doing a similar controlled value cleanup.
The issue we’re having is that we have several repositories, and the frontend 
view and list of number of related items and links are repository based, so 
cleanup requires tediously switching between repositories trying to find the 
resources that are still linked to those values.

Does the merge operation also only merge enumeration_values for the current 
repository ?
( I *think* that is the case, but I’m not sure. )

Perhaps, if you’re logged in on an admin account, it should have an option for 
searching across repositories.


— Steve Majewski


On Oct 18, 2017, at 2:06 PM, Fox, Bobbi 
> wrote:

In the course of adapting ArchivesSpace to Harvard’s needs, we’ve ended up with 
some very weedy controlled values lists (extent type > 200 values! -- of 
course, some of them need to be removed) with arbitrary positioning.  Our 
support team is tasked with the job of wrangling the lists with a defined 
order, and the interactive “move up/down one position at a time, wait for the 
server to refresh, etc.” is really tedious.

Has anyone written a script/created a plugin that would do this with less 
effort?  I’m inclined to do it at the mysql level, rather than write an 
extension to the backend/controller/enumeration.rb, but maybe someone has done 
this already?

Thanks,
Bobbi
___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


Re: [Archivesspace_Users_Group] batch re-ordering of controlled value lists; script/plugin, anyone?

2017-10-18 Thread Detelich, Alicia
Hi Bobbi,

In case you want to avoid making the change via the database, I have a python 
script that will do what you are looking for, using a CSV as input. If you can 
get a list of enumeration value URIs from the database and output it to a CSV, 
using something like:

select CONCAT('/config/enumeration_values/', ev.id) as URI
, position
, value
from enumeration_value ev
WHERE ev.enumeration_id = whatever the enumeration is for extent types in your 
instance

you can then change the positions in the 2nd column to whatever you want, and 
use that CSV as the input for the script at this link:
https://github.com/ucancallmealicia/archivesspace-api-public/blob/master/update_enum_val_positions.py

I haven’t used this script in production, but it has worked perfectly well for 
me when playing around with our test data.

Hope this helps.

Alicia

Alicia Detelich
Archivist
Manuscripts and Archives
Yale University Libraries
alicia.detel...@yale.edu

From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
[mailto:archivesspace_users_group-boun...@lyralists.lyrasis.org] On Behalf Of 
Majewski, Steven (sdm7g)
Sent: Wednesday, October 18, 2017 3:30 PM
To: Archivesspace Users Group 
Subject: Re: [Archivesspace_Users_Group] batch re-ordering of controlled value 
lists; script/plugin, anyone?


It looks like the positioning would be very simple to do in mysql as you only 
have to modify the position value in the table — no complicated joins required. 
You could do it interactively with a GUI frontend like Sequel Pro or 
MySQLWorkbench. Just make sure you don’t leave any duplicate positions.

If you already have a table of enum values and new positions, and you want to 
do it programmatically, then you can load those pairs as a temporary table, and 
create a function return position given value string, and use that function in 
your update statement rather than try to explicitly iterate over the tables.

Merging enumeration values, on the other hand, is more complicated, and I would 
leave it to the frontend/backend, and not try MySQL surgery.

We are doing a similar controlled value cleanup.
The issue we’re having is that we have several repositories, and the frontend 
view and list of number of related items and links are repository based, so 
cleanup requires tediously switching between repositories trying to find the 
resources that are still linked to those values.

Does the merge operation also only merge enumeration_values for the current 
repository ?
( I *think* that is the case, but I’m not sure. )

Perhaps, if you’re logged in on an admin account, it should have an option for 
searching across repositories.


— Steve Majewski


On Oct 18, 2017, at 2:06 PM, Fox, Bobbi 
> wrote:

In the course of adapting ArchivesSpace to Harvard’s needs, we’ve ended up with 
some very weedy controlled values lists (extent type > 200 values! -- of 
course, some of them need to be removed) with arbitrary positioning.  Our 
support team is tasked with the job of wrangling the lists with a defined 
order, and the interactive “move up/down one position at a time, wait for the 
server to refresh, etc.” is really tedious.

Has anyone written a script/created a plugin that would do this with less 
effort?  I’m inclined to do it at the mysql level, rather than write an 
extension to the backend/controller/enumeration.rb, but maybe someone has done 
this already?

Thanks,
Bobbi
___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


Re: [Archivesspace_Users_Group] Updating containers via archival_object POST

2017-05-23 Thread Detelich, Alicia
Hi Don,

Are you using Python to make the updates? Can you post what you have tried so 
far? Here’s an example of how to make an update to a single archival object 
instance via Python 3, which worked for me when I tested it this morning:

api_url = your api url…
repo_num = your repository number…

archival_object_json = requests.get(api_url+ 
‘/repositories/repo_num/archival_objects/1987146’, headers=headers).json()

archival_object_json["instances"] = [{"container": {"barcode_1": 
'39002042614314', "container_locations": [{"jsonmodel_type": 
"container_location", "ref": '/locations/9', "start_date": "2015-06-02", 
"status": "current"}], "indicator_1": '2', "type_1": "box"}, "instance_type": 
"mixed_materials", "jsonmodel_type": "instance", "sub_container": 
{"jsonmodel_type": "sub_container", "top_container": {"ref": 
'/repositories/repo_num/top_containers/190797'}}}]

archival_object_data = json.dumps(archival_object_json)

archival_object_update = 
requests.post(api_url+‘/repositories/repo_num/archival_objects/1987146’, 
headers=headers, data=archival_object_data).json()


If you are trying to do something like archival_object_json[‘container’] I 
don’t think it will work, unless maybe you do 
archival_object_json[‘instances’][‘container’] – but I didn’t check on that.

Also, be sure that all data elements you are updating are correct and 
consistent – I tried to make a test update using fake container info and it did 
not work, but when I tried updating the instance with data from an existing top 
container everything went through just fine. I just changed the barcode, top 
container ref, indicator, and location to reflect the data from the other 
container, and it updated. Hope this helps.

P.S. I have a script which makes these kinds of updates in batch by pulling the 
info you wish to update from a CSV. I can clean it up a bit and share if anyone 
is interested…

Alicia Detelich
Archivist
Manuscripts and Archives
Yale University Libraries

From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
[mailto:archivesspace_users_group-boun...@lyralists.lyrasis.org] On Behalf Of 
Donald Mennerich
Sent: Monday, May 22, 2017 4:11 PM
To: Archivesspace Users Group 
Subject: [Archivesspace_Users_Group] Updating containers via archival_object 
POST

Hello List,
I'm working a data remediation problem via the aspace API I can't seem to get 
any of the values in a container key within an archival_object to update when I 
post. For example, within a json object of type archival_object like:

"container": {
"type_1": "box",
"indicator_1": "1",
"barcode_1": "31142054615128",
"type_2": "folder",
"indicator_2": "14",
"container_locations": [],
"lock_version": 25
}
If I change any of the values and POST, none of the updates seem to persist. 
This doesn't generate an errors, and any changes to the record otherwise seems 
to save. I'm wondering if this is just not possible, and if so, is there 
another endpoint that might be used to update container information?

Thanks, Don

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group