linking cspace and resourcespace
pip3 install "fastapi[all]"
This will eventually be a simple API endpoint for urls called from the resourcespace UI. That will offer a few functions for realtime updates between RS and CS. For the moment I'm starting with a simpler script that will do the basics of a 2-way sync between CS and RS (data to RS and images to CS).
Usage: python3 nightlink.py MY_CSPACE_INSTANCE
-
Query RS for new items, checking for a
synced?field (value should beTrueorNull) -
For each new RS item, grab an accession number from an auto-populated
accession numberfield -
Query CSpace using the accession number, returning metadata for the object
-
Add the metadata to the RS item, and also send a specified derivative size to CSpace, creating
media&blobrecords, then make arelationrecord linking them to the original object -
If all is kosher, update the RS item with
synced=True
-
button is pushed on RS record view
-
triggers a POST request to specified URL, including RSID as a parameter
-
Use
RSIDandquery typeto query RS back and retrieve some relevant piece of metadata that will serve as a hook -
Use this value from RS (i.e.
cspace object idoraccession number) to query CSpace again -
Send CSpace response back to the item in RS
All queries just include RS number, but will also contain optional parameters in the URL. so:
query types:
validate_cspace_idpush_image- WIP:
push_image_group(this will be used for pushing groups of images to cinefiles; for example its primary use will be to send an arbitrary number of stills to a single cspace record for a movie)
Other default options?? TBD