This azure function will get triggered when attendance data is uploaded from the Takmil Android Application. The azure function uses cognitive Services API to process the picture and group the students presents in a class.
Process Attendance contains the implementation of Azure Function.
To process the image from Attendance Application, the following resources has to be created in an Azure Account. It is always recommended to create a new resource group for the following resources:
- Storage Account
- Cognitive Service
- App Service Plan
- Azure Function
Every user of this project, has to create these resources. Manually creating these entries is very tedious and error-prone. The deployment folder is an automation for resource deployment. There are scripts and template files that enables the automation
Usage: install.ps1
This powershell scripts installs and imports the AZ module, which has all the useful commandlets for resource deployment.
Usage: deploy.ps1
Example: deploy.ps1 88888888-3333-2222-1111-000000000000 wslp1 "West US 2" $true
This powershell script, prompts the user to login with his Azure Account. After login, the script will validate the input subscription ID. If this is a valid subscription ID, set the same as active subscription. Start to create the resource group, if it does not exist. Invokes the deployment process. The deployment process creates the storage account, app service plan and then the azure function. After the resources are created, the azure function code deployment is configured, which pulls the source from github, builds and deploys the code. This script automatically uses the template_takmil.json. The json file should be in the same directory as the script.
This is the template file that encapsulates all the resources that has to be created for the end to end solution. This template creates an app service plan that would cost roughly 50 USD. There is also a azure function setting to allow always on. This results in instantaneous triggers for the azure function.
This deployment handles Continuous Integration. Everytime a change is made to the repository, the new changes will be compiled and deployed to the Azure Function. To monitor the progress:
- Navigate to the Resource Group in Azure Portal
- Click on the Function Name
- Go to Deployment Section on the Left Side
- Click on Deployment Center
- This should show all the deployments happened so far with the timestamp.
- If recent change is not picked up, click on "Sync" button to deploy the latest changes
If there are some manual changes done to the resource group and if it looks like the azure function is not getting triggered, the following should help to troubleshoot this issue.
- Navigate to Azure Function
- Click Functions->Functions
- Click the Function Name "ProcessAttendance"
- Click Code + Test
- Click Logs in the Bottom of the Screen
- The logs panel will display a message when the trigger happens.
- Click Clear to start a new tracing session.
- Go to Azure Storage in this resource group
- Navigate to takmil container
- Upload a sample json file. This can be a simple text file too for troubleshooting.
The logs panel will display an event if the trigger was successful.