Challenge Overview
Challenge Objectives
-
Using Azure Logic Apps, automate task of copying data from Azure Blob to Cosmos DB
-
Create an Azure Function triggered by http events to interface with Cosmos DB (Mongodb API).
-
Replace an existing DialogFlow FulFillment with a webhook that invokes the earlier created Azure Function
Project Background
-
This project aims at creating an Action in Google Assistant with Fulfillment through Azure based services.
-
The Action will allow users to register themselves with a service
-
Primarily, the service will notify the user when their printer is low on ink. The user would have shared their printer details with the service earlier (out of scope for this project)
-
The user can also use our Action to shop for new ink and toner cartridges.
Technology Stack
-
Actions on Google (Conversational workflow / DialogFlow)
-
Nodejs
-
Azure (Functions, Cosmos DB, Logic Apps, Azure Blob)
Code access
We will share the assets for an Action on Google that we created in the first contest. This currently uses Firebase for Fulfillment. We will share this in the contest forum.
Individual requirements
Create an Azure Logic App based task (Major Requirement)
-
We will be storing a file in Azure File. The file will be in excel format and contain only one worksheet. There will only be one file, that gets replaced with a new file (containing new data) periodically (or think of it as the data in the same file keeps getting updated periodically).
-
The Azure Logic App will invoke an Azure Function that reads the new file, processes it, and uploads the data to Cosmos DB using Mongodb API. The invocation will happen at an interval that needs to be configurable.
-
We will only have one model named Users. Each column in the excel file will represent an attribute of the model in Cosmos DB. Additionally, there will be an attribute named “isRegistered” for each document in the database. This attribute will make sense later below, when we describe the DialogFlow Fulfillment.
-
Note that there could already be data in the database (from earlier executions). The Azure Function is expected to perform an upsert operation using the email address (the first column in the excel) as the key field. No existing data will be deleted.
-
Also note that during the update operation, the value of isRegistered attribute will not be touched. That is, for documents that are being updated, the update operation will NEVER update the isRegistered attribute. For new documents being inserted, the isRegistered column will be false.
-
The only constant fields will be the email address and isRegistered. Other columns in the excel may or may not exist. Accordingly define the schema for the User model.
Create an Azure Function for DialogFlow Fulfillment (Major Requirement)
-
Currently, we have an Action on Google using the DialogFlow based workflow, where the Fulfillment is hosted on Firebase.
-
Replace this with a webhook, that invokes an Azure Function. This means you will need to update the deployment guide of the Action on Google module to instruct the steps to carry this out.
-
The Fulfillment code that exists currently needs to be migrated over to the Azure Function.
-
Currently, the Fulfillment code uses a variable (named users), that holds a bunch of users, to act as the mock “database”. Replace this to instead interface with Cosmos DB that will hold the data. Use Mongodb API with Cosmos DB. You don’t have to copy the data over - that will be done through the earlier requirement.
-
The Cosmos DB used here, is the same database that is used in the earlier requirement, where we update the database periodically with new data. The data structure of the mock database contains email address and isRegistered fields, just like the data structure of the data stored in Cosmos DB.
-
So, essentially, what is happening here is that we are migrating the code from Firebase over to Azure Function and using a real database instead of a mock one. And finally, we are using this for the webhook based Fulfillment. Everything else should work as before.
Deployment guide
Treat the Azure based services as a separate module, with its own deployment guide. The deployment guide should be detailed - the assumption that you can make here are:
-
That we have an active Azure account
-
That we know how to use a command line interface
-
That we know how to use the Azure portal
Thus, your deployment guide should be really detailed in describing how to set up the various services, either through the CLI or through the GUI. Screenshots are optional, but highly recommended.
You can submit either a markdown file or a Word document file. Kindly do not submit only PDF files, because we cannot edit them later.
Important Notes
-
You need to update the Fulfillment code to ensure that it executes inside an Azure Function. That is acceptable as long as you do not modify the conversation workflow and as long as the updates are only to ensure that the Fulfillment code executes correctly inside Azure Functions.
-
No updates are expected to the Action on Google module, besides updates to the Deployment Guide, where you will mention that we need to use the webhook, and also mention that we need to specify the Azure function’s endpoint for use in the webhook. (Describe how to retrieve the endpoint details)
-
The source code that you will migrate to Azure Function - lint the code using standard lint.
-
Treat the assets relevant for this contest (other the deployment guide for Action on Google) as an independent module. Thus, we will end up with two modules - one for the Action on Google and one for the Azure Services. Although they are related, we intend to treat them as modules of their own.
-
Your Fulfillment code will NOT make any use of Firebase functions.
Final Submission Guidelines
Zip the assets for the Azure Services along with the deployment guide. Take this zip file and along with the Deployment Guide for the Action on Google, create another zip file and upload this one to Topcoder. You are not required to upload the Action on Google module.