The SubjectHeadingPoster
is a Lambda listening to the BibStream
to post bib data to the Subject Heading (SHEP) API. It only posts Bib records that it identifies as non-suppressed Research bibs. It does that by first looking for a 910 var field, subfield a ('RL' in the content field means the Bib is Research); if there's no 910|a field it falls back to the isResearchLayer
which is a Lambda Layer deployed on AWS. The code for the Layer lives in the is-research-service
repo.
This services use the Ruby2.5 runtime.
bundle install; bundle install --deployment
If you get the error You must use Bundler 2 or greater with this lockfile.
run
gem install bundler -v 2.0.2
All config is in sam.[ENVIRONMENT].yml
templates, encrypted as necessary.
- Cut branches from
development
. - Create PR against
development
. - After review, PR author merges.
- Merge
development
>qa
- Merge
qa
>master
- Tag version bump in
master
The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
To use the SAM CLI, you need the following tools.
- AWS CLI - Install the AWS CLI and [configure it with your AWS credentials].
- SAM CLI - Install the SAM CLI
- Ruby - Install Ruby 2.5
- Docker - Install Docker community edition
The following will invoke the lambda against various mock events. Replace [event]
with one of the mock events listed below.
To locally test a successful bib ingest, run the SHEP API (https://github.com/NYPL/subject-headings-explorer-poc) locally. Match the port to the one in the 'SHEP_API_BIBS_ENDPOINT' in the template. E.g., 'SHEP_API_BIBS_ENDPOINT': http://docker.for.mac.localhost:8080/api/v0.1/bibs is the url for the API running on port :8080.
sam local invoke SubjectHeadingPoster --template sam.[environment].yml --event events/[event].json
Refer to this lsp workflow documentation for a method to trigger an event on the bib stream.
bundle exec rspec -fd