Showcases a recommendation system using Amazon Personalize to generate real-time recommendations based on interactions by customers.
-
Deploy the backend on AWS
-
Upload
USERS.csv
,ITEMS.csv
andUSER_INTERACTIONS.csv
to an S3 bucket (Find these files in the shared GE box). -
Add a bucket policy allowing Amazon Personalize to access the contents.
Bucket policy
Replace
BUCKET_NAME
with your bucket name below.{ "Version": "2012-10-17", "Id": "PersonalizeS3BucketAccessPolicy", "Statement": [ { "Sid": "PersonalizeS3BucketAccessPolicy", "Effect": "Allow", "Principal": { "Service": "personalize.amazonaws.com" }, "Action": ["s3:GetObject", "s3:ListBucket"], "Resource": [ "arn:aws:s3:::BUCKET_NAME", "arn:aws:s3:::BUCKET_NAME/*" ] } ] }
-
Create an IAM role with the AmazonS3ReadOnlyAccess permission. Steps 2 and 3 can also be automated by running initRole.ipynb
-
In the Amazon personalize dashboard, create a dataset group and add the three datasets. The required shema for each of the datasets can be copied from below
Users dataset schema
{ "type": "record", "name": "Users", "namespace": "com.amazonaws.personalize.schema", "fields": [ { "name": "USER_ID", "type": "string" }, { "name": "USER_HOSPITAL", "type": ["null", "string"] }, { "name": "USER_ROLE", "type": "string", "categorical": true } ], "version": "1.0" }
Items dataset schema
{ "type": "record", "name": "Items", "namespace": "com.amazonaws.personalize.schema", "fields": [ { "name": "ITEM_NAME", "type": ["null", "string"] }, { "name": "ITEM_FAMILY", "type": "string", "categorical": true }, { "name": "ITEM_OVERVIEW", "type": ["null", "string"] }, { "name": "ITEM_ID", "type": "string" } ], "version": "1.0" }
Interactions dataset schema
{ "type": "record", "name": "Interactions", "namespace": "com.amazonaws.personalize.schema", "fields": [ { "name": "USER_ID", "type": "string" }, { "name": "ITEM_ID", "type": "string" }, { "name": "ACTION", "type": "string", "category": true }, { "name": "TIMESTAMP", "type": "long" } ], "version": "1.0" }
-
Once the dataset import jobs have completed, create a solution with the
arn:aws:personalize:::recipe/aws-user-personalization
recipe. -
Create a campaign with the given solution version and copy the campaign ARN
-
Create a lambda function with the code from getRecLambda.py. Copy the Campaign ARN to line 27.
-
Attach an API gateway trigger to the function.
-
-
Start the web app
Make sure you have NodeJS v16.6.0+ installed. Then, continue with the following steps:
# Install dependencies npm install # Copy the example env file to .env.local, and fill in your endpoint URL from API gateway cp .env.local.example .env.local # The development server should be available on http://localhost:3000 npm run dev
We submitted this project for GE Healthcare's GE Hack-E-LTH '21 hackathon and won 1st prize. Our team comprised of Joshua T, Samyuktha T H, Sandeep Rajakrishnan, and Vighnesh Shankar.