Application for fetching patron records for both studens and employees and formatting those records into XML to be loaded by Ex Libris into Alma using their sync process.
Additional documentation can be found on B-Drive: link
Because of differences in the two APIs (SIS and UCPath), these do not operate exactly the same. UCPath's API is driven by a "change log". When it runs, it looks back 7 days from the current date for any recods that have been added or updated and then processes those. SIS does not have a change log. Instead we pull the entire collection of users for the current semester everytime we run SIS.
If the SIS Alma-User-Load fails to run on it's scheduled day, it's not considered detrimental - the next scheduled run will pick up any new or updated records the previous run would have picked up.
If UCPath fails to run on it's scheduled day, a manual run is necessary. The startdate (see Commandline Options below) needs to be the date 7 days prior to the scheduled date that was missed. (e.g., if UCPath was scheduled to run on April 10, 2025 and failed and you wanted to run it on April 11th, you'd need to pass -startdate 2025-04-03 as a commandline arguement).
You can perform that locally and manually copy the zipped file to the patron_employees folder (see XML and Zip File Output below)
Alma-User_load is deployed via the Docker Swarm and is kept in the lap/alma-user-load repo.
Data is harvested from several sources:
UCPath: https://developers.api.berkeley.edu/api/8
SIS: https://developers.api.berkeley.edu/api/6
Additional data is pulled from CalNet via LDAP
- SIS : Monday and Wednesday Mornings 1am
- UCPath : Thursday Mornings 1am
The schedules are defined in the ops/docker-swarm
repo: files/production/swarm/stacks/alma_user_loader.yml
Files are saved to:
SIS: upload.lib.berkeley.edu/alma/patron_students
UCPath: upload.lib.berkeley.edu/alma/patron_employees
Production logs can be found in Amazon CloudWatch under the following log groups:
production/alma_user_loader/sis
production/alma_user_loader/ucpath
You'll need to sign in with the IAM account alias uc-berkeley-library-it and then with your IAM user name and password (created by the DevOps team).
In the event Alma-User-Load fails to run:
SIS: Because SIS pull the full collection of users for the current semester every run, there are no special steps for recovery. You can either let it run
To run locally, clone the repo, then add a .env file to the root of the project. (API info can be found in LastPass)
# UCPath Secrets:
UCPATH_API_URL=https://gateway.api.berkeley.edu/hr/v3/
UCPATH_API_ID=[API ID]
UCPATH_API_KEY=[API KEY]# SIS Secrets:
SIS_API_URL=https://gateway.api.berkeley.edu/sis/v2/students
SIS_API_ID=[API ID] SIS_API_KEY=[API KEY]# LDAP Secrets:
LDAP_HOST=ldap.berkeley.edu
LDAP_PASS=[LDAP Password]
Note - you cannot run students and employees at the same time, you can only run them one at a time.
Alma-User-Load can be run directly or using Docker.
ruby alma_user_load.rb -t <ucpath|sis>Build the container:
docker build -t alma-user-load .-
Run UCPath:
docker run -v $PWD:/opt/app --rm alma-user-load -t ucpath -
Run SIS:
docker run -v $PWD:/opt/app --rm alma-user-load -t sis -
Run UCPath for a specific user:
docker run -v $PWD:/opt/app --rm alma-user-load -t ucpath -u 10192606 -
Run UCPath for a specific user(s) locally:
ruby alma_user_load.rb -t ucpath -u '10671129,10674086'
> rspecNote - to run the test suite you need to change the LDAP setting in your .env file
# For testing:
LDAP_HOST=ldap.fake.edu
LDAP_PASS=FAKEPW
Commandline Options
- --type [ucpath|sis] required
- --term [term-code] SIS only
- --startdate Declare start date [yyyy-mm-dd]
- --enddate Declare end date [yyyy-mm-dd]
- --outdir Set the output directory for xml/zip files
- --help
- Replace fixtures w/some sort of factory (VCR)
- DRY things up (UCPath vs. SIS --> phone, email, address, names, etc...)
- SIS - add run by user id (similar to how I setup ucpath)...if possible
- Move 'create_user_record' from user.rb to a separate class
- Add a check to make sure all necessary config settings are set!
- Setup a rake command to run the test suite
- Reduce some of the complexity in the complexity so I can remove some of the rubocop disables