Skip to content

AWS Lambda that maps a search query into controlled vocabulary filters and a fulltext query using ITA Taxonomy API

License

Notifications You must be signed in to change notification settings

GovWizely/lambda-semantic-query-service

Repository files navigation

CircleCI Maintainability Dependabot Status

Semantic Query Service

AWS Lambda mapping a search query into controlled vocabulary filters and a fulltext query using ITA Taxonomy API.

Example query: the United States and pacific rim contracting in oceania malasia pacifico cuba in scuba

response:

{
    'filters': {
        'country': ['Cuba', 'United States'],
        'world_region': ['Oceania', 'Pacific Rim']
    },
    'query': 'the and contracting in malasia pacifico in scuba'
}

Prerequisites

Local Development

git clone git@github.com:GovWizely/lambda-semantic-query-service.git
cd lambda-semantic-query-service
mkvirtualenv -p /usr/local/bin/python3.8 -r requirements-test.txt lambda-semantic-query-service

If you are using PyCharm, make sure you enable code compatibility inspections for Python 3.7/3.8.

Tests

python -m pytest

Configuration

  • Define the Taxonomies API key as an environment variable export TAXONOMIES_API_KEY=your_key.
  • Define AWS credentials in either config.yaml or in the [default] section of ~/.aws/credentials. To use another profile, you can do something like export AWS_DEFAULT_PROFILE=govwizely.
  • Edit config.yaml if you want to specify a different AWS region, role, and so on.
  • Make sure you do not commit the AWS credentials to version control.

Invocation

lambda invoke -v

Deploy

In the AWS Lambda console, set up the TAXONOMIES_API_KEY environment variable. Then you are ready to deploy:

lambda deploy --requirements requirements.txt

About

AWS Lambda that maps a search query into controlled vocabulary filters and a fulltext query using ITA Taxonomy API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages