Skip to content

Polls Sierra for items placed on a holdshelf. Notifies patrons.

Notifications You must be signed in to change notification settings

NYPL/holdshelf-poller

Repository files navigation

Holdshelf Poller

This is an app to poll Sierra for items placed on a holdshelf and notify those patrons.

Purpose

This app connects to the Sierra database directly to identify items placed on a holdshhelf. The specific holdshelves and item holding locations are configurable. When it encounters an item on a holdshelf, it checks Redis to determine if the hold has already been processed. If it has not been processed, a call is made to the PatronServices Notify endpoint (TK).

Installation

Via Docker:

docker image build -t holdshelf-poller:local .
docker container run -e ENVIRONMENT=development holdshelf-poller:local

Or for development in OSX:

pyenv local 3.10
python -m venv localenv
source localenv/bin/activate
pip install -r dev-requirements.txt
pip install -r requirements.txt

Usage

Running locally

To build a set of local test data for the development environment:

psql -c 'CREATE DATABASE sierra_local_item_status_listener';
psql sierra_local_item_status_listener < sierra-schema.sql
AWS_PROFILE=nypl-digital-dev python create_test_data.py

To run the app against local test data:

AWS_PROFILE=nypl-digital-dev ENVIRONMENT=development python main.py

Note test data is created with current timestamps, so if you see "Found 0 holdshelf entries", you may need to re-run the create_test_data command to generate fresh "holds":

AWS_PROFILE=nypl-digital-dev ENVIRONMENT=development python create_test_data.py

To disable notifications (i.e. to test Sierra connection or run the poller in a "dry run" mode), add DISABLE_NOTIFICATIONS=true

Contributing

This repo uses the Main-QA-Production Git Workflow

Testing

make test

To check linting:

make lint

Troubleshooting

Troubleshooting psycopg "ImportError: no pq wrapper available."

In OSX, if you have a /usr/local/opt/libpq/lib and xcode installed, but get above error when running the app locally, you may need to install the psycopg this way:

pip uninstall psycopg
pip install "psycopg[c]"

Troubleshooting psycopg "library not found for -lssl"

Try first:

xcode-select --install

Followed by:

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg

About

Polls Sierra for items placed on a holdshelf. Notifies patrons.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •