ReDBox provides an "alerts" system as a mechanism for other systems to provide records that can be imported into ReDBox. This is a file-based system in which other applications upload a CSV or XML file into a defined alerts directory (path). When a new file is found by the alerts system, it is processed as per the configuration and the various metadata used to create a new ReDBox record.
Version 1.6 of ReDBox sees the introduction of an extended alerts system. The old alerts system will still be available as per previous versions but users are recommended to transition to the new system. As the old alerts system may still be in operation, use of the new alerts system will need to be enabled using the procedure described below.
The alerts system differs to the harvest model seen in Mint, which harvests a data source (such as a CSV file), as described in Loading data into Mint.
Alerts are configured in system-config.json under the new-alerts key. Multiple alerts can be defined, allowing you to point to several directories, perhaps allocated per source system. The alerts system currently supports CSV (comma-separated) files and XML.
A detailed documented sample configuration is provided at https://github.com/redbox-mint/redbox/tree/master/config/src/main/config/home/lib/jython/alertlib
It is important to plan how alerts will be received into your defined alert path (directory) for handling. You're most likely needing to setup a new network directory for each specific application that will provide metadata. CSV-based alerts can provide multiple record imports in one file whereas XML-based alerts provide a single record for import.
The filename is important to ReDBox as it is used in generating an internal identifier. This means that files added to the alert path must never reuse a filename. At first glance, this may seem unreasonable but it is important to remember that other systems are depositing files into the alert path and using unique filenames will ensure that an incoming alert doesn't over-write an older alert that is yet to be processed. Possible models for ensuring that this doesn't occur includes:
It's also important to note that an alert will ONLY create a NEW record. If the other system updates a record and sends an alert file through with the same name, it won't be accepted either as a new record or as an update. Whilst, at first glance, it might be appealing to have updates come through from other systems, the record in ReDBox may have undergone reviews and edits and it is important to have this safe from an automated overwrite of the information.
As RIF-CS uses XML, a collection record can be imported via the alerts system. If you'd like to drag back records you've posted to RDA you can export the RIF-CS and break that export into individual collection descriptions. Please refer to Breaking up a RIF-CS export for assistance with this.
A very basic mapping file would look like:
The makeup of the mapping file decides how the XML being ingested is going to map into ReDBox data fields. Here is a sample (the file is quite long):
The following provides a sample of the relevant XML nodes this config is trying to ingest:
The configuration generally comes in the form of key/value pairs, where the key will be an XPath String identifying which part of the XML you are trying to map, and the key being the ReDBox field to ingest the data into. You'll note of course, that there is a slightly more complicated evolution of this where the XML contains repeatable elements. In this case the key is still XPath, but instead points at the repeatable node, and an the key contains a 'mini' config of key/value pairs mapping sub-elements into ReDBox fields.
At first glance it looks complicated, but it really a simple premise repeated over and over again. The hairiest part is probably going just be putting the XPath together.
Some XML documents utilise "default" namespaces without a prefix. The defaultNamespace configuration allows you to associate a prefix against the default namespace. You can then use this prefix in your XPaths.
Because in the XML we have just a basic ANZSRC code, we won't be able to line this up (trivially) with the full Mint URIs used in the form data:
Given the potential possible complications involved with completely unknown data being ingested we don't necessarily want to 'fix' the issue right now, we just want to flag the data for attention by a data entry staff member. We do this with the 'exceptions' config you can see above. The intent is to follow the standard process of resolved the XPath and mapping to a field, but then checking if there is an exception for that field and instead redirecting the output to a new field. In the example above, we are redirecting to a notes field and adding a descriptor to the data so that data entry staff can address the problem.
A testing script has been provided to let you test an alert without loading data into ReDBox. For details, please refer to https://github.com/redbox-mint/redbox/blob/master/config/src/main/config/home/lib/jython/alertlib/test/README.md
By default, the alerts system is not setup as a housekeeping job so this will need to be configured if you want the system to pickup alerts automatically. The following code snippet provides an example configuration for system-config.json.
The alerts codebase is located in https://github.com/redbox-mint/redbox/tree/master/config/src/main/config/home/lib/jython/alertlib