In this 9 part blog post series (link to all posts at bottom of this page), we revisit the Sentiment Analysis application we developed for Wholeschool as part of our Pluralsight course on IBM BlueMix now rebranded IBM Cloud (If you have a Pluralsight account be sure to check out the course!)
During the Pluralsight course we develop a NodeJS application that analyses the sentiment of Pluralsight author profiles using IBM Watson then leverages Node-Red to push the results to twitter and retrieve any responses to the tweets. The diagram below gives an overview of the application workflow and services.
At Wholeschool Software we now leverage the power of Azure and the Azure DevOps offering, along with Github and the latest ASP.NET Core development framework so thought it would be great to show how we use some of these technologies by re-developing some parts of the original demo on this new stack.
To demonstrate how some of these pieces fit together, we will create a Sentiment Analysis application similar to the orignal version on BlueMix, this time using ASP.NET Core, Blazor, xUnit.net, Azure DevOps (Pipelines and Artifacts), GitHub, Azure Cognitive Services, SonarCloud and finally Azure App Services for hosting our application.
One choice of technology above that may suprise you is Blazor as it is still ‘experimental’ and its not actually something we have used at Wholeschool. It is, however a technology I have been tinkering with in my spare time and I believe could be game changer in terms of full stack ASP.NET Core development with C# running in the browser. The alternative would have been using something like ASP.NET Core MVC with Razor, Razor Pages or a SPA application using ASP.NET Core WebAPI along with a client-side framework like Angular. All of these options would be more in line with what you would currently see at Wholeschool.
If you would like to see an additional blog post creating the Web Application using one of these more traditional approaches please get in contact, we would love to hear from you!
Note the application is not meant to be a production quality application but more to show how you can tie these different technologies and services together along with some opinionated choices for supporting packages and libraries that I like to use day-to-day.
All code covered in this blog post can be found on the following GitHub repository
Below you can see a screenshot of the final application we will develop that will allow you to enter a Twitter username and display the sentiment analysis for the last 20 tweets found.
We will be using the .NET Core command line tools and VS Code on a Windows machine, however you can do everything covered here using Visual Studio 2017 or using Mac or any supported Linux distro. First ensure you have the latest ASP.NET Core SDK installed from the following link https://dotnet.microsoft.com/download
I’m assuming you have some familiarity with C#, ASP.NET Core (including the CLI tools) and Azure however I have tried to provide as much detail and screenshots as I can to make it easy to follow along.
Our application will be composed of 3 projects, a class library, a test project and a web application. We will initially build the library along with our first CI/CD pipeline and deploy the package to a private Nuget feed using Azure Artifacts. We will then show how we can consume this package into our Web application then have a second CI/CD pipeline responsible for deploying our Web application to Azure App Services. We could have everything contained in one solution, however this approach gives a better understanding around how you can author and deploy a re-usable library that can be consumed via a package manager and how a standalone client can use this library and retrieve this during the CI/CD process.
A quick summary of the projects we will be building:
The class library responsible for authenticating with the Twitter API and reading tweets from a users timeline. It will also handle connecting to Azure Cognitive Services to analyse sentiment.
Unit tests using the popular xUnit.net to test our class library functionality. When we setup our CI/CD pipeline we will show how to run tests and generate code coverage.
Note that during this post series we will develop the Sentiment Analysis library and the Web Application entirely independently. My aim is to show how you would develop a re-usable package that could be distributed via a package manager such as NuGet then have another standalone application consume that package. You can of course, reference your library directly from your Web App as a project reference to make development and debugging a bit easier, however I will leave that choice up to you.
The remainder of this blog post content is available on Steven Knox’s personal blog, you can follow the link below to continue