This plugin provides integration between ArchivesSpace and Alma, focusing on MARC record synchronization and holdings management. It leverages the Alma API to perform operations and presents a user interface within ArchivesSpace for managing these integrations.
- Bi-directional sync between ArchivesSpace and Alma (push only)
- MARC record comparison
- Holdings management
- Item display from Alma within ArchivesSpace
The plugin requires specific configuration in ArchivesSpace's config.rb
file:
AppConfig[:alma_api_url] = 'https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs'
AppConfig[:alma_apikey] = 'your_api_key_here'
AppConfig[:alma_holdings] = [
['building_code1', 'location_code1'],
['building_code2', 'location_code2']
]
-
Controller (alma_integrations_controller.rb)
Handles user interactions and API calls:
def search @results = do_search(params) end def add_bibs post_bibs(params) end def add_holdings post_holdings(params) end
-
Alma Integrator (alma_integrator.rb)
Manages communication with the Alma API:
def search_bibs(ref, mms) aspace = get_archivesspace_bib(ref) alma = get_alma_bib(mms) results['marc'] = sync_bibs(aspace, alma) if aspace['content'] && alma['content'] results end def post_bib(mms, data) uri = mms.nil? ? URI(@baseurl) : URI("#{@baseurl}/#{mms}") uri.query = URI.encode_www_form({:apikey => @key}) response = AlmaRequester.new.post(uri, data, :use_ssl => true) end
-
Record Builder (record_builder.rb)
Constructs MARC XML for new or updated records:
def build_bib(record, mms) marc = Nokogiri::XML(record) # ... (code to build XML structure) data.root.add_child(marc.at_css('record')) data.to_xml end def build_holding(code, id) # ... (code to construct holdings XML) builder.to_xml end
To enhance the plugin's functionality and flexibility, I propose the following improvements:
-
MARCXML Export Enhancement
- Modify the ArchivesSpace MARCXML export to include all necessary data for bib, holdings, and item records.
- Add configuration options for field inclusion.
-
MARCXML Parser
- Create a new class to parse MARCXML and extract bib, holdings, and item data:
class MarcXMLParser def parse(xml) doc = Nokogiri::XML(xml) { bib: extract_bib_data(doc), holdings: extract_holdings_data(doc), items: extract_item_data(doc) } end private def extract_bib_data(doc) # Implementation end # Other extraction methods... end
-
Enhanced Alma API Integration
- Expand
AlmaIntegrator
to handle all record types:
class AlmaIntegrator def create_or_update_bib(data) # Implementation end def create_or_update_holdings(bib_id, data) # Implementation end def create_or_update_item(holdings_id, data) # Implementation end end
- Expand
-
Two-way Synchronization
- Implement functionality to pull changes from Alma back to ArchivesSpace.
-
Improved Error Handling and Logging
- Implement robust error handling and detailed logging for better troubleshooting.
These enhancements are untested, but could make the plugin more flexible, powerful, and easier to maintain.