-
Notifications
You must be signed in to change notification settings - Fork 0
137 project request update location name for nmah #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…y, updated utilities_testdata.py to successfully run on PROD data, updated query_database in utilities.py to more accurately reflect error thrown, added test_invalid_query to utilities_tests.py, renamed update_locations.py to update_locationrepo.py
lorawoodford
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@crugas This all looks good, and I think is fine in one-time scripts. That said, I just am wondering why we can't just use the built-in batch_update endpoint in the API and avoid having a script altogether? I haven't tried this yet, but looking at the endpoint, you should be able to post a payload like this to /locations/batch_update and get the same result without have to post-back full location json over and over:
{
"building": "Updated Building Name",
"record_uris": ["/locations/1","/locations/2","/locations/3"]
}
|
@lorawoodford Oh my gosh, I completely forgot about that endpoint! That would be infinitely better and quite a bit faster too. I may end up refactoring the script so that it can use this endpoint (I've already confirmed the changes with NMAH), since it would be useful if we do need to use it again. But, I also need to update the original ticket, since NMAH wants text from the Room field into the Floor field - which may vary (but shouldn't because it's a one-story building) if we need to run the script again. So, I'll give this more thought before submitting, since I need to rethink how to approach the original script's endpoint to hit and the updated requirements for the task. |
|
[like] Woodford, Lora J. reacted to your message:
…________________________________
From: crugas ***@***.***>
Sent: Friday, December 5, 2025 9:44:29 PM
To: Smithsonian/caas-aspace-scripts ***@***.***>
Cc: Woodford, Lora J. ***@***.***>; Mention ***@***.***>
Subject: Re: [Smithsonian/caas-aspace-scripts] 137 project request update location name for nmah (PR #138)
External Email - Exercise Caution
[https://avatars.githubusercontent.com/u/62658840?s=20&v=4]crugas left a comment (Smithsonian/caas-aspace-scripts#138)<#138 (comment)>
@lorawoodford<https://github.com/lorawoodford> Oh my gosh, I completely forgot about that endpoint! That would be infinitely better and quite a bit faster too. I may end up refactoring the script so that it can use this endpoint (I've already confirmed the changes with NMAH), since it would be useful if we do need to use it again.
But, I also need to update the original ticket, since NMAH wants text from the Room field into the Floor field - which may vary (but shouldn't because it's a one-story building) if we need to run the script again. So, I'll give this more thought before submitting, since I need to rethink how to approach the original script's use of endpoint to hit and the updated requirements for the task.
—
Reply to this email directly, view it on GitHub<#138 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADTRNRQYIKEM5IZBJNTU3S34AH4D3AVCNFSM6AAAAACOFKKA4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMJYGY4TSNRZG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Description
Created a new script that updates the building field for a location. update_locationbuilding.py retrieves location IDs with a given building name passed in the oB (originalBuilding) argument using an SQL query to the ASpace database. Then it takes a list of those IDs and retrieves their JSON data from the API and updates the building field with the argument passed in the uB (updatedBuilding) argument. Then it posts the updated location JSON data to ArchivesSpace, saving the original JSON data in a given .jsonl file and logging the results of the update to a given log file. NOTE: put "" around the building name if it contains spaces, like so: -uB="NMAH-FSD, Building 92".
I also updated utilities_testdata.py since the digital object that was used for testing various get operations was deleted. Replaced it with a digital object in the test repository on ASpace PROD until we can implement #66.
Also, added another unittest for utilities_tests.py, renamed update_locations.py to update_locationrepo.py, and other small updates.
@lorawoodford Put this as a draft, in case you think it would be better in the repeatable folder, not one_time_scripts. I could see us using this in the future, but not frequently (I hope).
Related GitHub Issue
#137
Testing
Wrote unittests via updatelocationbuilding_tests.py
Screenshot(s):
Checklist