Skip to content

Commit

Permalink
AWS Interactive Video Service (IVS) Demo, and Personalised Discount a…
Browse files Browse the repository at this point in the history
…ddition to the retail demo (#96)

* Signup changes (#86)

* Add optimizely container params (#82)

* added optimizely sdk key param to containers

* logging add

* pprint

* ssm:GetParameters to task exec role

* rename ssm policy for execution role

* removed debug logging

* resource_bucket_path in CopyImagesLambdaFunction (#84)

* Bump selfsigned version for node-forge vuln

* remove phone number field from signUp form

* Update the READMEs and instructions to reflect changes in signup

Co-authored-by: Igor Krtolica <[email protected]>
Co-authored-by: Bastien <[email protected]>
Co-authored-by: James Jory <[email protected]>

* fix #87 by running npm audit fix

* AWS Interactive Video Service (IVS) Demo addition to the retail demo. Summary as follow:
* IVS: Addition of IVS container, IVS cloud formation.
* UI: Adding UI Tab and page for the streams, its products, recommendations and discounts.
* UI: Adding Reset Amazon Personalize button on the user profile.
* UI: Refactoring for the menu.
* Amazon Personalize: Addition of new campaign for discounts, update to the container service code.
* Amazon Personalize: Additional Jupyter notebook, remove dependancy on bucket to stage data,  instead generate it from script.
* Update to the readmes and documentations.
This work was done by Dae.mn Team.
Co-authored-by: Akram Dweikat <[email protected]>
Co-authored-by: Akram Dweikat  <[email protected]>
Co-authored-by: Damien Jade Duff <[email protected]>
Co-authored-by: daemon-joe <[email protected]>

* add welcome page

* more semantic markup

* service badges

* New product detail design + ability to change quantity on product page

* Remove extra console log

* Adjust spacing

* fix hover color on quantity background

* Add text alerts UI

* Use margin over gap property

* Use margin over gap property

* fix repeated cart update bug

* Avoid v-bind if unnecessary

* New product detail design + ability to change quantity on product page

* Remove extra console log

* Adjust spacing

* fix hover color on quantity background

* Use margin over gap property

* fix repeated cart update bug

* Shift responsibilities to Layout component

* Abstract out functionality into mixins

* Merge

* Updates to PR based on comments/discussions

- Scoped down on permissions for IVS and Personalize.
- Minor refactor of the recommender endpoint to clean up logic with respect to how discounts are extracted from reranking and experiment information added, to address the comment about why we have ‘old_url’ (we don’t anymore).
- Additional images and products are now using the original numbering scheme. Products are sequential in products.yaml and images are numbered per category.
- Merged a pinpoint fix from trunk (pull Arns rather than name from CloudFormation).
- Fixed a regression preventing pinpoint from accessing personalize recommendations.
- Fixed some typos.

* Protect text alerts component

* Use mixins within mixins

* Remove unneeded parameters from recommender service

* Remove optimisation about not regenerating interactions

* Enhance cart page

* only show cart summary if there are items in the cart

* formatting

* remove shipping and tax from mixin

* fix cart length check

* Fix cart item keys

* Use carousel component on product and home pages

* Adding UI button to trigger Abandoned Cart email

* Bump selfsigned version for node-forge vuln

* Pass ARNs to Pinpoint auto workshop lambda (#90)

* user-personalization recipe (#94)

* Event Engine support (#99)

* Wildcard resource due to CFN case sensitivity

* Add base Event Engine template

* Shorten IAM role name

* Task role name dynamic

* Shorten PinpointPersonalize role name

* Cache campaign and solution version details (#95)

* BugFix: Update csv path (#97)

When using RelativeResourceBucketPath, the CSV files are not written into the root of the bucket but under the ResourceBucketRelativePath. Fixing path with this commit

* Adding UI button to trigger Abandoned Cart email

* Feature/contextual metadata discounts (#16)

Following up on our conversations, we have moved the Personalize Discounts into using the "contextual metadata" feature to identify whether a product was being offered at a discount when it was viewed. Therefore, we use a single campaign and get different recommendations depending on the context of whether a discount is active. This will replace the previously mentioned solution. This change involves:

-Changes to training data (user-product interactions) to add the context field which will record which offer is active in the interaction (from {'DISCOUNT':'No'} and {'DISCOUNT':'Yes'})
-Remove the discounts campaign.
-Update the reranking campaign training and inference in the Lambda function that automatically trains all Personalize campaigns to take the contextual metadata (we use the reranking campaign with discounts because it allows us to “pick the top N”) (reranking also supports contextual metadata).
-Update the recommendations discounts endpoint to provide the context to Personalize.
-Update the experimentations framework to match this.
Ran unit tests.
-Workshop: We will also update the Jupyter notebook we added to show:
--How the interactions are generated.
--How the campaign is created.
--How recommendations might be retrieved from Personalize and from the endpoint.
--We also visualise to ensure that the recommender gives expected results.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This work was done by Dae.mn Team.
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Damien Jade Duff [email protected]
Co-authored-by: Joe Major [email protected]

* remove index of product rendered on carousel

* Abandoned cart pushing attributes initial work

* Temporary commit

* Revert "Temporary commit"

This reverts commit dd4e803.

* Adding in product information for event

* add welcome page

* more semantic markup

* service badges

* Use margin over gap property

* Avoid v-bind if unnecessary

* Adding in explicit URL locations for website images/locations

* use vuex to track welcome page visit

* remove copy that is only sometimes relevant

* add skip login for now button

* put text alerts section behind feature flag

* Upadting text tempalte

* fix analytics following removal of cart subtotal

* put abandon shopping cart button behind feature flag while waiting for back end service

* Enhance cart page

* only show cart summary if there are items in the cart

* formatting

* remove shipping and tax from mixin

* fix cart length check

* Fix cart item keys

* fix analytics following removal of cart subtotal

* put abandon shopping cart button behind feature flag while waiting for back end service

* add back cart feature flag

* Use carousel component on product and home pages

* remove index of product rendered on carousel

* Move data globally and add new nav

* New footer

* Remove role='presentation' from search results + truncate length

* Move margins style to parent component

* Move footer to partials/

* Make layout padding-top condition based on showNav

* Remove unnecessary breakpoint declaration

* Remove categories navigation from CategoryDetail page

* Updating UI conditional view and workshop books

* Fixing typos and grammar errors

* Adding bank in tempalte loads and links to tempalte files

* Feature/merge notebooks (#17)

Updates:

Merged the Notebook of Discounts (1.3) to the Notebook of Personalise (1.1)
Renamed delete notebook to 1.3
This work was done by Dae.mn Team.
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Damien Jade Duff [email protected]
Co-authored-by: Joe Major [email protected]

* Feature/master merge 20201119 (#18)

Update: Bring master new commits to Daemn branch 

This work was done by Dae.mn Team.
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Damien Jade Duff [email protected]
Co-authored-by: Joe Major [email protected]

* Add back product stock behavior

* Refine product stock behavior

* Use dynamic titles for recommendations section

* Only show user recommendations when logged in

* use personalizeUser state to decide when to show recommendations

* fix ProductDetail logic

* fix personalizeUserId sent on search rerank

* Changes as requested on PR (#29)

Changes to PR as requested including:
- Default streams JSON pulled from S3
- Capitalisation of IVS
- Small code and doc changes
- Bump Golang version - Due to dependency update.

This work was done by Dae.mn Team.
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Damien Jade Duff [email protected]
Co-authored-by: Joe Major [email protected]

* Feature/remove copier dependency (#30)

Merge removal of copier dependency from master.

This work was done by Dae.mn Team.
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Akram Dweikat [email protected]
Co-authored-by: Damien Jade Duff [email protected]
Co-authored-by: Joe Major [email protected]

* Resize screenshot of discounts UI for notebook (#31)

Resize screenshot of discounts UI for notebook
 
This work was done by Dae.mn Team.
 Co-authored-by: Akram Dweikat [email protected]
 Co-authored-by: Akram Dweikat [email protected]
 Co-authored-by: Damien Jade Duff [email protected]
 Co-authored-by: Joe Major [email protected]

Co-authored-by: Shivani Mehendarge <[email protected]>
Co-authored-by: Igor Krtolica <[email protected]>
Co-authored-by: Bastien <[email protected]>
Co-authored-by: James Jory <[email protected]>
Co-authored-by: Kaz Baig <[email protected]>
Co-authored-by: Alex Chirayath <[email protected]>
Co-authored-by: damiendaemon <[email protected]>
Co-authored-by: daemon-joe <[email protected]>
Co-authored-by: Daemon Solutions <[email protected]>
Co-authored-by: Chirayath <[email protected]>
Co-authored-by: Aleksandr Patrushev <[email protected]>
Co-authored-by: Dae.mn <[email protected]>
  • Loading branch information
13 people authored Dec 2, 2020
1 parent 14aba78 commit 6dab660
Show file tree
Hide file tree
Showing 108 changed files with 4,311 additions and 1,317 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.idea
__pycache__/
.vscode
build/*
.venv/
venv/
workshop/*/.ipynb_checkpoints
workshop/1-Personalization/interactions.csv
workshop/1-Personalization/items.csv
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Here you will find several workshops in a directory structure in the notebook in

If you're interested in contributing enhancements, features, or fixes to the Retail Demo Store, please see the [Developer Instructions](./Developer-Instructions.md) for details on how to setup your local environment and deployment environment.


# Delivering a Demo of the Retail Demo Store

Once you have deployed the Retail Demo Store, you may want to walk through the demonstration guide to learn how to show the features the Retail Demo Store provides.
Expand Down
4 changes: 4 additions & 0 deletions aws/cloudformation-templates/base/_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ Outputs:
Description: Optimizely SDK key Parameter
Value: !GetAtt SSMParameters.Outputs.ParameterOptimizelySdkKey

ParameterIVSVideoChannelMap:
Description: Retail Demo Store video file to IVS channel mapping parameter
Value: !GetAtt SSMParameters.Outputs.ParameterIVSVideoChannelMap

ParameterSegmentWriteKey:
Description: Segment write key Parameter
Value: !GetAtt SSMParameters.Outputs.ParameterSegmentWriteKey
Expand Down
59 changes: 29 additions & 30 deletions aws/cloudformation-templates/base/authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
AWSTemplateFormatVersion: 2010-09-09

Description: >
This template deploys the Retail Demo Store Cognito Configuration.
This template deploys the Retail Demo Store Cognito Configuration.
Parameters:
AuthName:
Type: String
Expand All @@ -18,20 +17,20 @@ Resources:
SNSRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Service:
Principal:
Service:
- "cognito-idp.amazonaws.com"
Action:
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: "CognitoSNSPolicy"
PolicyDocument:
PolicyDocument:
Version: "2012-10-17"
Statement:
Statement:
- Effect: "Allow"
Action: "sns:publish"
Resource: "*"
Expand Down Expand Up @@ -93,52 +92,52 @@ Resources:
StringAttributeConstraints:
MinLength: '1'
MaxLength: '200'

# Creates a User Pool Client to be used by the identity pool
UserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
ClientName: !Sub ${AuthName}-client
GenerateSecret: false
UserPoolId: !Ref UserPool

# Creates a federeated Identity pool
IdentityPool:
Type: AWS::Cognito::IdentityPool
Properties:
IdentityPoolName: !Sub ${AuthName}Identity
AllowUnauthenticatedIdentities: true
CognitoIdentityProviders:
CognitoIdentityProviders:
- ClientId: !Ref UserPoolClient
ProviderName: !GetAtt UserPool.ProviderName

# Create a role for unauthorized acces to AWS resources. Very limited access. Only allows users in the previously created Identity Pool
CognitoUnAuthorizedRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Principal:
Federated: "cognito-identity.amazonaws.com"
Action:
Action:
- "sts:AssumeRoleWithWebIdentity"
Condition:
StringEquals:
StringEquals:
"cognito-identity.amazonaws.com:aud": !Ref IdentityPool
"ForAnyValue:StringLike":
"cognito-identity.amazonaws.com:amr": unauthenticated
Policies:
- PolicyName: "CognitoUnauthorizedPolicy"
PolicyDocument:
PolicyDocument:
Version: "2012-10-17"
Statement:
Statement:
- Effect: "Allow"
Action:
- mobiletargeting:UpdateEndpoint
- mobiletargeting:PutEvents
Resource:
Resource:
- !Sub "arn:aws:mobiletargeting:${AWS::Region}:${AWS::AccountId}:apps/${PinpointAppId}/*"
- Effect: "Allow"
Action:
Expand All @@ -148,7 +147,7 @@ Resources:
- Effect: "Allow"
Action:
- "cognito-sync:*"
Resource:
Resource:
- !Sub "arn:aws:cognito-sync:${AWS::Region}:${AWS::AccountId}:identitypool/${IdentityPool}"
- Effect: "Allow"
Action:
Expand All @@ -161,29 +160,29 @@ Resources:
CognitoAuthorizedRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Principal:
Federated: "cognito-identity.amazonaws.com"
Action:
Action:
- "sts:AssumeRoleWithWebIdentity"
Condition:
StringEquals:
StringEquals:
"cognito-identity.amazonaws.com:aud": !Ref IdentityPool
"ForAnyValue:StringLike":
"cognito-identity.amazonaws.com:amr": authenticated
Policies:
- PolicyName: "CognitoAuthorizedPolicy"
PolicyDocument:
PolicyDocument:
Version: "2012-10-17"
Statement:
Statement:
- Effect: "Allow"
Action:
- mobiletargeting:UpdateEndpoint
- mobiletargeting:PutEvents
Resource:
Resource:
- !Sub "arn:aws:mobiletargeting:${AWS::Region}:${AWS::AccountId}:apps/${PinpointAppId}/*"
- Effect: "Allow"
Action:
Expand All @@ -193,19 +192,19 @@ Resources:
- Effect: "Allow"
Action:
- "cognito-identity:*"
Resource:
Resource:
- !Sub "arn:aws:cognito-identity:${AWS::Region}:${AWS::AccountId}:identitypool/${IdentityPool}"
- Effect: "Allow"
Action:
- "cognito-sync:*"
Resource:
Resource:
- !Sub "arn:aws:cognito-sync:${AWS::Region}:${AWS::AccountId}:identitypool/${IdentityPool}"
- Effect: "Allow"
Action:
- "lex:PostText"
Resource:
- !Sub "arn:aws:lex:${AWS::Region}:${AWS::AccountId}:bot:RetailDemoStore:*"

# Assigns the roles to the Identity Pool
IdentityPoolRoleMapping:
Type: "AWS::Cognito::IdentityPoolRoleAttachment"
Expand All @@ -224,4 +223,4 @@ Outputs:
Value: !Ref UserPoolClient
IdentityPoolId:
Description: Identity Pool Id
Value: !Ref IdentityPool
Value: !Ref IdentityPool
13 changes: 11 additions & 2 deletions aws/cloudformation-templates/base/notebook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Resources:
Action:
- ssm:PutParameter
- ssm:GetParameter
Resource: !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/retaildemostore-*'
Resource: !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/retaildemostore*'
-
Effect: "Allow"
Action:
Expand Down Expand Up @@ -155,6 +155,15 @@ Resources:
Condition:
StringEquals:
aws:ResourceTag/RetailDemoStoreServiceName: 'web-ui'
-
Effect: Allow
Action: # Notebook users should be able to start and stop training
- events:DescribeRule
- events:ListRules
- events:EnableRule
Resource:
- !Sub 'arn:aws:events:${AWS::Region}:${AWS::AccountId}:rule/RetailDemoStore-PersonalizePreCreateScheduledRule'

-
PolicyName: "3-Experimentation"
PolicyDocument:
Expand Down Expand Up @@ -196,7 +205,7 @@ Resources:
Effect: "Allow"
Action:
- lambda:GetFunction
Resource: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:RetailDemoStorePinpointRecommender'
Resource: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:RetailDemoStorePinpointRecommender'

Outputs:
NotebookInstanceId:
Expand Down
27 changes: 26 additions & 1 deletion aws/cloudformation-templates/base/ssm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ Resources:
Value: "NONE"
Description: "Retail Demo Store Personalized Ranking Campaign Arn Parameter"

ParameterPersonalizeTrainConfig:
Type: "AWS::SSM::Parameter"
Properties:
Name: "retaildemostore-training-config"
Type: "String"
Value: "NONE"
Description: "Retail Demo Store Personalize Train Config"

ParameterPersonalizeFilterPurchasedArn:
Type: "AWS::SSM::Parameter"
Properties:
Expand Down Expand Up @@ -108,6 +116,14 @@ Resources:
Value: !If [HasOptimizelySdkKey, !Ref OptimizelySdkKey, 'NONE']
Description: "Retail Demo Store Optimizely SDK key"

ParameterIVSVideoChannelMap:
Type: "AWS::SSM::Parameter"
Properties:
Name: "retaildemostore-ivs-video-channel-map"
Type: "String"
Value: "NONE"
Description: "Retail Demo Store video file to IVS channel mapping"

ParameterSegmentWriteKey:
Type: "AWS::SSM::Parameter"
Properties:
Expand All @@ -134,6 +150,10 @@ Outputs:
Description: Personalized Ranking Campaign Arn
Value: !Ref ParameterPersonalizedRankingCampaignArn

ParameterPersonalizeTrainConfig:
Description: Train config
Value: !Ref ParameterPersonalizeTrainConfig

ParameterPersonalizeFilterPurchasedArn:
Description: Personalize Filter Purchased Products Arn
Value: !Ref ParameterPersonalizeFilterPurchasedArn
Expand All @@ -154,6 +174,11 @@ Outputs:
Description: Optimizely SDK key
Value: !Ref ParameterOptimizelySdkKey

ParameterIVSVideoChannelMap:
Description: Retail Demo Store video file to IVS channel mapping
Value: !Ref ParameterIVSVideoChannelMap

ParameterSegmentWriteKey:
Description: Segment write key
Value: !Ref ParameterSegmentWriteKey
Value: !Ref ParameterSegmentWriteKey

Loading

0 comments on commit 6dab660

Please sign in to comment.