<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nathan Cheng on Medium]]></title>
        <description><![CDATA[Stories by Nathan Cheng on Medium]]></description>
        <link>https://medium.com/@nathancheng-tech?source=rss-9dbd159f0e0a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QwX5LXEimb8jfUy3mY9Mmw.jpeg</url>
            <title>Stories by Nathan Cheng on Medium</title>
            <link>https://medium.com/@nathancheng-tech?source=rss-9dbd159f0e0a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:46:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nathancheng-tech/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Hierarchy of ML tooling on the Public Cloud]]></title>
            <link>https://medium.com/data-science/the-hierarchy-of-ml-tooling-on-the-public-cloud-ed387cac3c27?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed387cac3c27</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[pre-trained-model]]></category>
            <category><![CDATA[automl]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 15:02:32 GMT</pubDate>
            <atom:updated>2023-03-21T15:02:32.109Z</atom:updated>
            <content:encoded><![CDATA[<h4>Not all ML services are built the same</h4><figure><img alt="Hidden technical debt in ML systems." src="https://cdn-images-1.medium.com/max/1024/1*a1rr1_3Crdzb6mLZ9ZTvdQ.png" /><figcaption>Hidden technical debt in ML systems. Image by <a href="https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning">Google Developers</a>.</figcaption></figure><h3># 1 ML Services on the Public Cloud</h3><p>Not all ML services are built the same. As a consultant working in the public cloud, I can tell you that you are spoilt for options for Artificial Intelligence (AI) / Machine Learning (ML) tooling on the 3 big public clouds — Azure, AWS, and GCP.</p><p>It can be overwhelming to process and synthesize the wave of information; especially when these services are constantly coming out with new features.</p><p>Just imagine how much of a nightmare it would be to explain to a layman which platform to choose, and why you chose to use this particular tool to solve your machine learning problem.</p><p>I’m writing this post to alleviate that problem statement for others, as well as for myself, so you walk away with a succinct and distilled understanding of what the public cloud has to offer. For the sake of simplicity, I will use the terms AI and ML interchangeably throughout this post.</p><h3># 2 Building a Custom ML System… should be a Last Resort</h3><p>Before we jump into tooling comparison, let’s understand why we should even use managed services on the public cloud. It’s a valid assumption to question — Why not build your own custom infrastructure and ML model from scratch? To answer this question, let’s take a quick look at the ML lifecycle.</p><p>The below diagram depicts a typical ML lifecycle (the cycle is iterative):</p><figure><img alt="Machine Learning lifecycle." src="https://cdn-images-1.medium.com/max/1024/0*0evMKGyr9UXhYU7l.png" /><figcaption>Machine Learning lifecycle. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>As you can see, there are many parts to the entire lifecycle that must be considered.</p><p>A <a href="https://papers.nips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems.pdf">famous paper published by Google</a> showed that a small fraction of the effort that goes into building maintainable ML models in production is writing the model training code.</p><p>This phenomenon is known as the hidden technical debt of ML systems in production, and also what has been termed by industry as Machine Learning Operations (MLOps), which has become an umbrella term to refer to the mentioned technical debt.</p><p>Below is a visual explanation to support the above statistics, <a href="https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning">adapted from Google’s paper</a>:</p><figure><img alt="Hidden technical debt in ML systems." src="https://cdn-images-1.medium.com/max/1024/0*e0fWO8hBdBJNfmn9.png" /><figcaption>Hidden technical debt in ML systems. Image by <a href="https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning">Google Developers</a>.</figcaption></figure><p>I won’t go into a detailed explanation of each stage in the lifecycle, but here’s a summarized list of definitions. If you’re interested in learning more, I would recommend reading <a href="https://www.oreilly.com/library/view/machine-learning-design/9781098115777/">Machine Learning Design Patterns</a> Chapter 9 on ML Lifecycle and AI Readiness for a detailed answer.</p><p><strong>ML lifecycle summarized definitions:</strong></p><ol><li><strong>Data pre-processing</strong> — prepare data for ML training; data pipeline engineering</li><li><strong>Feature engineering</strong> — transform input data into new features that are closely aligned with the ML model learning objective</li><li><strong>Model training </strong>— training and initial validation of ML model; iterate through algorithms, train / test splits, perform hyperparameter tuning</li><li><strong>Model evaluation</strong> — model performance assessed against predetermined evaluation metrics</li><li><strong>Model versioning</strong> — version control of model artifacts; model training parameters, model pipeline</li><li><strong>Model serving</strong> — serving model predictions via batch or real-time inference</li><li><strong>Model deployment</strong> — automated build, test, deployment to production, and model retraining</li><li><strong>Model monitoring</strong> — monitor infrastructure, input data quality, and model predictions</li></ol><h4><strong>Don’t forget about platform infrastructure and security!</strong></h4><p>The ML lifecycle does not consider the supporting platform infrastructure, which has to be secure from a encryption, networking, and identity and access management (IAM) perspective.</p><p>Cloud services provide managed compute infrastructure, development environments, centralized IAM, encryption features, and network protection services that can achieve security compliance with internal IT policies — hence you really should not be building these ML services yourself, and leverage the power of the cloud to add ML capabilities into your product roadmap.</p><p>This section illustrates that writing the model training code is a relatively tiny part of the entire ML lifecycle, and actual data prep, evaluation, deployment, and monitoring of ML models in production is difficult.</p><p>Naturally, the conclusion is that building your own custom infrastructure and ML model takes considerable time and effort, and the decision to do so should be a last resort.</p><h3># 3 Hierarchy of ML tooling</h3><p>Here is where leveraging public cloud services come in to fill the gap. There are broadly two offerings these hyperscalers package and provide to customers; <strong>ML Tooling Hierarchy:</strong></p><ul><li>🧰 <strong>AI services. EITHER:</strong></li></ul><ol><li>🔨 <strong>Pre-Trained Standard</strong> - Use base model only, No Option to customize by bringing your own training data.</li><li>⚒️ <strong>Pre-Trained Customizable</strong> - Can use base model, and Optional customization by bringing your own training data.</li><li>⚙️ <strong>Bring Your Own Data</strong> - Mandatory to bring your own training data.</li></ol><ul><li>🪛 <strong>ML Platform.</strong></li></ul><h4>Honorable AI service mentions</h4><p>For the sharper ones reading this post, I have purposefully omitted a few honorable AI service mentions in the hierarchy:</p><ul><li>Data Warehouse built-in ML models which enable ML development using SQL syntax. Further reading can be done on <a href="https://cloud.google.com/bigquery-ml/docs/introduction"><strong>BigQuery ML</strong></a>, <a href="https://docs.aws.amazon.com/redshift/latest/dg/machine_learning.html"><strong>Redshift ML</strong></a>, and <a href="https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-predict"><strong>Synapse dedicated SQL pool PREDICT function</strong></a>. These services are meant to be used by data analysts, given that your data is already inside the cloud data warehouse.</li><li><a href="https://learn.microsoft.com/en-us/ai-builder/overview"><strong>AI Builder</strong></a> for Microsoft Power Platform, and <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/canvas.html"><strong>Amazon SageMaker Canvas</strong></a>. These services are meant to be used by non-technical business users a.k.a. citizen data scientists.</li><li><a href="https://learn.microsoft.com/en-us/azure/cognitive-services/openai/overview"><strong>Azure OpenAI</strong></a> which is nascent service and regulated by Microsoft; you are required to request approval for a trial.</li></ul><h3># 3.1 ML Platform 🪛</h3><p>We will first discuss the ML Platform before discussing AI services. The platform provides auxiliary tooling required for MLOps.</p><p>Each public cloud has their own version of the ML Platform:</p><ul><li>Azure — <a href="https://learn.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-machine-learning">Azure Machine Learning</a></li><li>AWS — <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/whatis-features-alpha.html">Amazon SageMaker</a></li><li>GCP — <a href="https://cloud.google.com/vertex-ai/docs/start/introduction-unified-platform">Vertex AI</a></li></ul><h4>Who is it for?</h4><p>Persona-wise, this is for the team who has internal data scientist resources, want to build custom state-of-the-art (SOTA) models with their own training data, and develop frameworks to do custom management of MLOps across the ML lifecycle.</p><h4>How do I use it?</h4><p>Requirement-wise, the business use case would need them to engineer a custom ML model implementation that AI services in <strong>Section 3.2 </strong>do not have the capabilities to meet.</p><p>As much as possible, this should not be your first option when looking to leverage a service on the public cloud.</p><p>Even with the ML platform, considerable time and effort has to be invested into learning the features on the ML platform, and writing the code to build out a custom MLOps framework using the hyperscaler software development kits (SDKs).</p><p>Instead, first look for an AI service in the next <strong>Section 3.2 </strong>that could meet your need.</p><h4>What technology capabilities does the service provide?</h4><p>When you utilize a cloud platform, you gain access to a completely hyperscaler managed environment that you would otherwise be pulling your hair out trying to get right:</p><ol><li><strong>Managed Compute Infrastructure</strong> — these are clusters of machines with default environments, containing ubiquitous built-in ML libraries, and cloud-native SDKs. Compute can be used for distributed training, or to power model endpoints for serving batch and real-time predictions.</li><li><strong>Managed Development Environments</strong> — in the form of Notebooks, or through your choice of IDE given that there is integration with the ML platform.</li></ol><p>These host of utilities enable data scientists and ML engineers to fully focus on the ML lifecycle instead of infrastructure configuration and dependency management.</p><p>Built-in libraries and cloud-native SDKs facilitates data scientists writing custom code to do more seamless engineering throughout the ML lifecycle.</p><p><strong>The following table shows the technology features of each cloud ML platform:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13ae04fc09c4ce7a4c22353077d078a7/href">https://medium.com/media/13ae04fc09c4ce7a4c22353077d078a7/href</a></iframe><h3># 3.2 AI Services 🧰</h3><p>Next, we will discuss AI services.</p><p>They enable ML development using a low-code / no-code approach, and mitigate the overhead of managing MLOps.</p><p>The over-arching argument for these services is neatly put below by Jeff Atwood:</p><blockquote><strong>The best code is no code at all.</strong></blockquote><blockquote><strong>Every new line of code you willingly bring into the world is code that has to be debugged, code that has to be read and understood, code that has to be supported. Every time you write new code, you should do so reluctantly, under duress, because you completely exhausted all your other options.</strong></blockquote><h4>Who is it for?</h4><p>Persona-wise, these are for the teams who <strong>DO NOT HAVE EITHER:</strong></p><ol><li>Internal data scientist resources.</li><li>Own training data to train a custom ML model.</li><li>Investment of resources, effort, and time to engineer a custom ML model end-to-end.</li></ol><h4>How do I use it?</h4><p>Requirement-wise, the ML business use case would be met by cloud provider AI service capabilities.</p><p>The goal is to add ML features into the product by leveraging hyperscaler base models and training data; so the team can prioritize core application development, integrate with the AI service via retrieving predictions from API endpoints, and ultimately spend minimal effort on model training and MLOps.</p><h4>What technology capabilities does the service provide?</h4><p>We’re going to organize the following comparison table by the technology capabilities the AI service provides. This is closely interlinked with but should be differentiated from the ML business use case.</p><p>For example, Amazon Comprehend service gives you the <strong><em>capability</em></strong> to do text classification. That capability is used to build models for <strong><em>business use cases</em></strong> such as:</p><ol><li><strong>Sentiment analysis of customer reviews.</strong></li><li><strong>Content quality moderation.</strong></li><li><strong>Multi-class item classification into custom-defined categories.</strong></li></ol><p>For certain AI services, the technology capability and business use case is exactly the same; in that scenario the AI service was built to solve that exact ML business use case.</p><h4><strong>Industry specific version of AI services</strong></h4><p>Note that I have excluded or avoided mention of industry specific version of AI services. Just know that hyperscalers train models specifically to achieve higher model performance in these domains and you should use them over the generic version of the service for the particular industry or domain.</p><p>Notable mentions of these services include <a href="https://docs.aws.amazon.com/comprehend-medical/latest/dev/comprehendmedical-welcome.html"><strong>Amazon Comprehend Medical</strong></a>, <a href="https://docs.aws.amazon.com/healthlake/latest/devguide/what-is-amazon-health-lake.html"><strong>Amazon HealthLake</strong></a>, <strong>Amazon Lookout for</strong><strong>{domain}</strong>, <a href="https://docs.aws.amazon.com/transcribe/latest/dg/call-analytics.html"><strong>Amazon Transcribe Call Analytics</strong></a>, <a href="https://cloud.google.com/retail/docs/overview"><strong>Google Cloud Retail Search</strong></a> etc.</p><p><strong>The following legend and table shows the technology capabilities of each cloud AI service:</strong></p><ul><li>🔨 <strong>Pre-Trained Standard</strong> - Use base model only, No Option to customize by bringing your own training data.</li><li>⚒️ <strong>Pre-Trained Customizable</strong> - Can use base model, and Optional customization by bringing your own training data.</li><li>⚙️ <strong>Bring Your Own Data</strong> - Mandatory to bring your own training data.</li></ul><p><strong>--- Speech ---</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d18207e378181979aa12dc6e02977e8/href">https://medium.com/media/3d18207e378181979aa12dc6e02977e8/href</a></iframe><p><strong>--- Natural Language ---</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ce1d871c7468fa6b069a8b5b72f0a56/href">https://medium.com/media/1ce1d871c7468fa6b069a8b5b72f0a56/href</a></iframe><p><strong>--- Vision ---</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e74fb015f07d49a98efc913f3ef2adb5/href">https://medium.com/media/e74fb015f07d49a98efc913f3ef2adb5/href</a></iframe><p><strong>--- Decision ---</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc2ca9396f8664d22389e18ee161a0ab/href">https://medium.com/media/fc2ca9396f8664d22389e18ee161a0ab/href</a></iframe><p><strong>--- Search ---</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c21d23ceeafcaacc2be22443ea3338f4/href">https://medium.com/media/c21d23ceeafcaacc2be22443ea3338f4/href</a></iframe><h3># 4 Further Reading on Topics</h3><p>We have covered considerable ground in this post regarding the spectrum of ML services the public cloud offers, however there are still other concepts that we have to consider when building an ML system.</p><p>I would encourage you to explore and find your own answers to these concepts that were not discussed as AI / ML become more deeply embedded within the products we use.</p><p><strong>What ML tooling do the 3 public clouds offer to implement the following functionality?</strong></p><ul><li>Model data lineage and provenance</li><li>Model catalog</li><li>Human review for post-prediction ground truth labeling</li><li>Models that work on video data</li><li>Models that do generic regression and classification</li></ul><h3>Special Thanks / References</h3><blockquote><em>A special mention and thanks to the authors and creators of the following resources, that helped me to write this post:</em></blockquote><p><strong>ML Tooling</strong></p><ul><li>📚 <a href="https://cloud.google.com/blog/topics/developers-practitioners/pick-your-aiml-path-google-cloud">Pick your AI / ML path on Google Cloud</a></li></ul><p><strong>AI Services</strong></p><ul><li>📚 <a href="https://learn.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-machine-learning">What is Azure Machine Learning?</a></li><li>📚 <a href="https://learn.microsoft.com/en-us/azure/machine-learning/v1/concept-azure-machine-learning-architecture">How Azure Machine Learning works: Architecture and Concepts</a></li><li>📚 <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/whatis-features-alpha.html">Amazon SageMaker features</a></li><li>📚 <a href="https://cloud.google.com/vertex-ai">Vertex AI</a></li><li>📚 <a href="https://cloud.google.com/vertex-ai/docs/start/introduction-unified-platform">Vertex AI Documentation</a></li></ul><p><strong>ML Platform</strong></p><ul><li>📚 <a href="https://learn.microsoft.com/en-us/azure/architecture/data-guide/technology-choices/cognitive-services">Choose a Microsoft Cognitive Services Technology</a></li><li>📚 <a href="https://learn.microsoft.com/en-us/azure/cognitive-services">Azure Cognitive Services Documentation</a></li><li>📚 <a href="https://learn.microsoft.com/en-us/azure/machine-learning/concept-automated-ml">What is Azure AutoML?</a></li><li>🎦 <a href="https://www.youtube.com/watch?v=YKY0V42MCtk">Azure OpenAI Use Cases</a></li><li>📚 <a href="https://docs.aws.amazon.com/whitepapers/latest/aws-overview/machine-learning.html">AWS Machine Learning Services</a></li><li>📚 <a href="https://aws.amazon.com/machine-learning/automl">AWS AutoML Solutions</a></li><li>📚 <a href="https://cloud.google.com/products/ai">Google AI and Machine Learning Products</a></li><li>📚 <a href="https://cloud.google.com/solutions/ai">Google AI and Machine Learning Solutions</a></li><li>📚 <a href="https://cloud.google.com/automl/docs">Google Cloud AutoML</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed387cac3c27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/the-hierarchy-of-ml-tooling-on-the-public-cloud-ed387cac3c27">The Hierarchy of ML tooling on the Public Cloud</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi-Stage Approach to Building Recommender Systems]]></title>
            <link>https://medium.com/data-science/multi-stage-approach-to-building-recommender-systems-71a31e58ecb4?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/71a31e58ecb4</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[recommender-systems]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[information-retrieval]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Sun, 01 Jan 2023 02:24:24 GMT</pubDate>
            <atom:updated>2023-02-13T01:40:08.102Z</atom:updated>
            <content:encoded><![CDATA[<h4>Discover state-of-the-art approaches to building RecSys</h4><figure><img alt="Multi-stage Recommender System" src="https://cdn-images-1.medium.com/max/1024/1*oq3VcTbxDlD4YmWDzW5VFw.png" /><figcaption>Multi-stage Recommender System. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h3># 1 Problem of Information Overload</h3><p>All of us are no stranger to search engines and recommender systems. Without them, we would get overwhelmed with the sheer amount of information being created every second. This information could take different data formats —<strong><em>text</em></strong>, <strong><em>images</em></strong>, <strong><em>audio</em></strong>, <strong><em>video</em></strong> etc.</p><p>Fundamentally, these systems can, given a large catalog of information, surface, filter and rank the relevant items based on the user’s query or profile, enabling us to navigate a sea of items, where otherwise users would struggle with information overload.</p><p>As the title of this post has already mentioned, we will focus on recommender systems in this article. I might cover system design for search in a separate article in the future, stay tuned.</p><h3># 2 Industry Use Cases for RecSys</h3><h4>Do you need a recommender?</h4><p>To be fair, 80% of companies will not have the requirement to build a sophisticated recommender system. For small catalogs with a small number of product categories, you can get by just fine using dynamic SQL queries.</p><p>If you wanted to build for example, a <strong>“Similar Items to…”</strong> or <strong>“You might also like…”</strong> panel on the item description page, you would write a SQL query that retrieved the top xx items for the current category of item.</p><p>The same applies if you wanted to build a <strong>“Recommended for you…”</strong> panel on the home page of your website or list of recommended items to be sent in a marketing email. Simply retrieve the top item category the user has viewed over a historical time period, and write the same dynamic SQL query to retrieve the recommended items based on the user’s historical interaction data.</p><p>Users who are exploring your site would also be able to scan through your entire catalog to find what they are looking for without feeling overwhelmed.</p><h4>Factors that influence whether you need a recommender system</h4><p><strong>Item catalog size:</strong></p><ul><li>As catalog size increases, it becomes more tedious and expensive to label each item’s metadata through a manual process.</li><li>In business models such as marketplaces, where item listings are completely crowdsourced to users, it is impossible to ensure high quality item metadata labels.</li><li>We have to look at alternative methods of generating recommendations outside of simple SQL queries.</li></ul><p><strong>Lack of structured data:</strong></p><ul><li>For certain companies, structured data in a tabular format may not even be collected. Instead, they might have a repository of videos, images, free text, articles that could be mined for generating recommendations.</li><li>Using unstructured data as the basis of that idea requires use of deep neural network approaches that encode unstructured data into structured numerical data to learn meaningful representations.</li><li><strong>structured</strong> — data in tabular format with well-defined schema.</li><li><strong>unstructured — <em>text</em></strong>, <strong><em>images</em></strong>, <strong><em>audio</em></strong>, <strong><em>video</em></strong></li></ul><p><strong>Repeatable process for improving business metrics:</strong></p><ul><li>Without a repeatable experimentation process, there is no way to test new techniques to improve your recommendations for your users. In addition, there is no way to monitor whether the changes to the system has a tangible impact on key business metrics.</li><li>Recommender systems have been shown to improve business metrics e.g. click-through rates, conversion rates, add-to-cart purchase, new item add-to-cart, listen / watch time, etc.</li><li>Putting in place your first recommender system does not necessarily guarantee you a repeatable experimentation process to start, but rather is the first step to moving towards that.</li></ul><h4>RecSys Case Studies</h4><p><strong>Below are some example use cases of recommender systems that are prevalent in society, broken down by industry:</strong></p><p><strong>Example RecSys Use Cases in Industry:</strong></p><ul><li>Online Commerce: <a href="https://tech.ebayinc.com/engineering/building-a-deep-learning-based-retrieval-system-for-personalized-recommendations">eBay — Building a Deep Learning Based Retrieval System for Personalized Recommendations</a></li><li>Fashion: <a href="https://www.youtube.com/watch?v=kGuaEqEsxKM">ASOS — Fashion Recommendations at ASOS</a></li><li>Music: <a href="https://research.atspotify.com/publications/recsys-challenge-2018-automatic-music-playlist-continuation">Spotify — Automatic Music Playlist Continuation</a></li><li>Videos: <a href="https://research.google/pubs/pub45530/">YouTube — Deep Neural Networks for Recommendations</a></li><li>Images: <a href="https://medium.com/pinterest-engineering/unifying-visual-embeddings-for-visual-search-at-pinterest-74ea7ea103f0">Pinterest — Unifying Visual Embeddings for Visual Search</a></li><li>Written Content: <a href="https://archive.nytimes.com/open.blogs.nytimes.com/2015/08/11/building-the-next-new-york-times-recommendation-engine">New York Times — Building the Next Recommendation Engine</a></li><li>Online Dating: <a href="https://www.youtube.com/watch?v=j2rfLFYYdfM">Tinder — Personlized Recommendations using TinVec</a></li><li>Online Gaming: <a href="https://www.researchgate.net/publication/333072035_Recommender_Systems_for_Online_Video_Game_Platforms_the_Case_of_STEAM">Steam — Recommender Systems for Online Video Game Platforms</a></li><li>Travel Accommodation: <a href="https://medium.com/expedia-group-tech/expedia-group-recsys-2021-ff791f42ba07">Expedia — Recommendations using Hotel2Vec</a></li><li>Healthcare Procurement: <a href="https://aws.amazon.com/blogs/industries/novartis-ag-uses-amazon-elasticsearch-k-nearest-neighbor-knn-and-amazon-sagemaker-to-power-search-and-recommendation">Novartis AG — Powering Search and Recommendation with Amazon OpenSearch KNN and SageMaker</a></li><li>Food Delivery: <a href="https://www.instacart.com/company/how-its-made/personalizing-recommendations-for-a-learning-user">Instacart — Personalizing Recommendations of a Learning User</a></li><li>Housing and Apartments: <a href="https://www.zillow.com/tech/embedding-similar-home-recommendation/">Zillow — Home Embeddings for Similar Home Recommendations</a></li><li>Leasing and Office Rental: <a href="https://www.youtube.com/watch?v=-R1loUK_EdA">WeWork — Recommendation Systems</a></li><li>Recruitment and Candidate Search: <a href="https://engineering.linkedin.com/blog/2020/quality-matches-via-personalized-ai">LinkedIn — Quality Matches via Personalized AI for hirer and seeker preferences</a></li></ul><p><strong>Online Education, Online Banking, Insurance were also the industries where I expected to find examples of successful case studies, however information was scarce.</strong></p><h4>Architecting and Building a RecSys</h4><p>Often in the real world, IT systems are a collection of services working together. Architecting and building a recommender system is a layered, multi-stage process that uses the right type of model for each stage in the layer.</p><p>Let’s take a look at the stages a machine learning engineer goes through when building a recommender system.</p><h3># 3 Recommender System Design</h3><figure><img alt="Multi-stage Recommender System" src="https://cdn-images-1.medium.com/max/1024/1*YOn84sIfCCXDQpUf_7BlNg.png" /><figcaption>Multi-stage Recommender System. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>The above diagram shows the de-facto standard for building recommender systems. State-of-the-art (SOTA) recommender systems separate the engineering of such a system into this 3-stage process.</p><p><strong>Note on Model Serving: </strong>At each stage of the process, we also need to think about how to expose or serve the ML model that has been built for downstream consumers to utilize.</p><p>We will explore this in the subsequent sections as we explain each of the stages.</p><h4>Candidate Generation; Retrieval</h4><p>Candidate generation is also known as the <strong>Retrieval</strong> stage in some recommender system literature. Item catalogs can potentially grow into the hundred thousands, millions or billions of items.</p><p>Candidate generation methods are able to select the top hundred most relevant items through efficiently comparing the similarity between items using a distance metric.</p><p>The first big idea here is to learn a numerical vector representation of users and item, the input data. These vectors, called embeddings can be written to a database or a nearest neighbors index where they are later retrieved by downstream systems.</p><p>Once we have the user and item embeddings, we can calculate their similarity in the embedding space using distance metrics such as euclidean distance, dot product, cosine similarity etc.</p><p>Candidate Generation aims to whittle down the number of potential candidates using an efficient approach that returns hundreds of candidate results that are ranked in the next stage. Usually, multiple candidate generators are built, that are trained using different approaches, each utilizing its own specific set of training data.</p><p><strong>Why not just go straight to the Scoring stage?</strong></p><p>A common and valid question to ask here is why not just go straight to the scoring stage? Why go through the process of generating embeddings for candidate generation?</p><p>There are several points to consider here:</p><ol><li>Generating embeddings are a key feature engineering step. The vector values can be re-used downstream as input feature values to further increase the accuracy of the downstream scoring model.</li><li>Candidate generation models can train on unstructured data, and represent unstructured data attributes of the item or user using a multi-dimensional vector. This useful information, such as <strong><em>text</em></strong>, <strong><em>images</em></strong>, <strong><em>audio</em></strong>, <strong><em>video</em></strong>, would otherwise remain untapped.</li><li>Semantic visual understanding of each item or user in the embedding space. You can visualize high-dimensional vectors in a 2-D space using tools such as <a href="https://www.tensorflow.org/tensorboard/tensorboard_projector_plugin">TensorBoard Embedding Projector</a>. By doing so, you also gain the ability to observe, and apply clustering algorithms to discover clusters of similar objects.</li><li>The output of a candidate generation model aims to establish similarity between items or users. This idea is fundamental in most recommender system products. Examples such as <strong>“Similar Items to…”</strong> or <strong>“Users similar to you also liked…”</strong> spring to mind.</li><li>Serve model results efficiently. Serving a candidate generation model is also efficient using an Approximate Nearest Neighbors (ANN) engine. For more information about the ANN algorithm, please refer to the video: <a href="https://www.youtube.com/watch?v=DRbjpuqOsjk">Approximate Nearest Neighbors: Data Science Concepts</a>. <strong>Contrast this with the Scoring stage — where you have the added overhead of computing all the engineered features that went into training the Scoring model, before the API is able to return you the model results.</strong></li></ol><p>As mentioned earlier, serving these embeddings is done via exposing an ANN engine. There are a lot of choices on the market for this, both open source and on public clouds, below are just some of your options:</p><ul><li>Open-Source: <a href="https://github.com/facebookresearch/faiss">Facebook faiss library</a></li><li>AWS: <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/knn.html">Amazon OpenSearch</a></li><li>GCP: <a href="https://cloud.google.com/vertex-ai/docs/matching-engine/ann-service-overview">Vertex AI Matching Engine</a></li></ul><p>Simply use one of these services, select your distance similarity metric, and downstream consumers can call the API to retrieve object embeddings.</p><p>An alternative approach is to write the object embeddings to a database, and downstream systems query the database to retrieve them. This is essentially what <a href="https://www.youtube.com/watch?v=807uHC0Ia10">Spotify does using Cloud Bigtable</a>.</p><h3>Scoring; Ranking</h3><p>Scoring is also known as the <strong>Ranking</strong> stage in some recommender system literature. It is stage that happens after candidate generation. A visual representation of this is shown in the diagram below:</p><figure><img alt="Multiple Candidate Generation Models" src="https://cdn-images-1.medium.com/max/1024/1*A7UR5hfyUI30mAyMXs467Q.png" /><figcaption>Multiple Candidate Generation Models. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>After retrieving top hundred candidates from multiple candidate generator models, each candidate’s embeddings can be organized into a structured tabular format along with other input data about the item and user such as datetime, category, device type etc. Scoring is a supervised learning problem, so we have to ensure that we pass it labeled training data relevant to the business metric we are optimizing for.</p><p><strong>Scoring is an optional stage</strong></p><p>Depending on whether you have labeled training data or not, your company may not have a Scoring stage. This is perfectly fine, and some companies get by with just Candidate Generation stage powering their recommender system products. <strong>It may take more time and effort for your internal data engineering process to put in place the right telemetry to produce labeled training datasets.</strong></p><p>Scoring is a classification problem. The output of the classification model is a probability score that enables you to rank the candidates from most likely to increase the business metric to least likely to do so. Examples of such business metrics include click-through rate, video watch time, item add-to-cart etc.</p><p>To serve the output of a Scoring model, you can publish an API endpoint with the model version you would like to deploy. The downstream system would have to call the API with the base input features (we must be careful here to not introduce data leakage), and the Scoring model would calculate the engineered features, before returning a ranked list of items, each with their own probability score.</p><p>There are easy options for deploying such an endpoint on all 3 public cloud providers:</p><p>Similarly, the ranked list of results, if retrieved via a batch endpoint can be cached into a database, for retrieval later by the downstream application.</p><h3>Re-Ranking</h3><p>After ranking your items by assigning them probability scores, systems can also re-rank the ordered list of items. There are several benefits to re-ranking, namely:</p><ol><li>Item quality — removal of malicious items such as fake / pirated / scam products, poor quality item listings, clickbait etc that could negatively affect user confidence and discourage them from using the platform.</li><li>Item diversity — Instead of recommending items that users have seen before, we can recommend lesser known item listings, or different categories of items that a user usually looks at to encourage discovery and exploration on the platform.</li></ol><p>When you optimize for a business metric, you are prone to <a href="https://www.nngroup.com/articles/campbells-law/">metric corruption</a> — you encourage certain malicious behaviours from bad actors. The re-ranking stage serves to mitigate that, by considering other metrics that are complimentary to the primary one that was optimized for during the Scoring stage.</p><p>The process of Re-Ranking could be simple business rules to ensure mandatory fields for an item is filled in, or you could train a separate model that learns characteristics of the bad actors or items with malicious intent. Serving these models would be similar to the approach described in the Scoring stage.</p><p>To promote new item discovery on your platform, and encourage diversity, companies also utilize variants of multi-armed bandit algorithms when serving the ranked item list to end users, to strike a balance between exploration vs. exploitation of items, but that’s a topic that warrants a dedicated blog post for another time.</p><h3># 4 Special Thanks / References</h3><blockquote><em>A special mention and thanks to the authors and creators of the following resources, that helped me to write this post:</em></blockquote><ul><li>📚 <a href="https://developers.google.com/machine-learning/recommendation">Google Developers Recommendation Systems Course</a></li><li>🎦 <a href="https://www.youtube.com/watch?v=DRbjpuqOsjk">Approximate Nearest Neighbors: Data Science Concepts</a></li><li>🎦 <a href="https://www.youtube.com/watch?v=807uHC0Ia10">Spotify Music Recommendations at Scale with Cloud Bigtable</a></li></ul><p><em>Originally published at </em><a href="https://natworkeffects.com/posts/multi-stage-approach-to-building-recommender-systems"><em>https://natworkeffects.com</em></a><em> on February 10, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71a31e58ecb4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/multi-stage-approach-to-building-recommender-systems-71a31e58ecb4">Multi-Stage Approach to Building Recommender Systems</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform: Provision Azure Data Platform with IaC]]></title>
            <link>https://nathancheng-tech.medium.com/terraform-provision-azure-data-platform-with-iac-28cfddac0234?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/28cfddac0234</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[azure-synapse-analytics]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Sat, 23 Apr 2022 13:16:50 GMT</pubDate>
            <atom:updated>2022-04-23T13:16:50.622Z</atom:updated>
            <content:encoded><![CDATA[<h4>Full video tutorial showing how to spin up a data platform on Azure with Terraform</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DF3G4gkwiJWprmt3UTJnVg.jpeg" /><figcaption>Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h3>Terraform</h3><p>In this tutorial, we’ll look at how to spin up an Azure Data Platform using an infrastructure-as-code (IaC) tool called Terraform, complete with deployment pipelines on Azure DevOps.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQ3C3Qz123lw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQ3C3Qz123lw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQ3C3Qz123lw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9df738b714ac5d13b65a1f38c3ff1dcd/href">https://medium.com/media/9df738b714ac5d13b65a1f38c3ff1dcd/href</a></iframe><h3>Resources</h3><p>All code in the video can be found at the Github repo:</p><p><a href="https://github.com/natworkeffects/terraform-iac">GitHub - natworkeffects/terraform-iac</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28cfddac0234" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy FastAPI on Azure with Github Actions]]></title>
            <link>https://medium.com/data-science/deploy-fastapi-on-azure-with-github-actions-32c5ab248ce3?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/32c5ab248ce3</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Fri, 06 Aug 2021 19:52:48 GMT</pubDate>
            <atom:updated>2022-09-11T09:46:59.677Z</atom:updated>
            <content:encoded><![CDATA[<h4>Automate your deployment workflow with Github Actions</h4><h3>Github Actions</h3><p>Github Actions is a new workflow automation tool for building, testing, and deploying your code directly from Github.</p><p>If you’re already using Github for your code repository, there’s no need to integrate a third-party tool to automate common developer workflows.</p><p>Simply place a Github Actions .yml file in your repository, designed to run in response to specific events. (push, pull requests, etc)</p><h3>Workflow diagram</h3><p>Today we’re going to go through an example workflow using Python to build a barebones API, with FastAPI as the framework of choice.</p><figure><img alt="Github Actions workflow diagram." src="https://cdn-images-1.medium.com/max/1024/1*Yt0Kj6X4F1sMwf_itBBd7g.png" /><figcaption>Github Actions workflow diagram. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>We will build and push a container image to Azure Container Registry, and pull the image into an Azure Web App for deployment.</p><p>Note that this article assumes prior knowledge of the technologies listed below.</p><p>The shell command examples given are on macOS. But you should be able to find equivalent commands if you’re developing on Windows.</p><p>The full list of packages and technologies we’ll be utilizing include:</p><ul><li><a href="https://code.visualstudio.com/">VS Code</a> — as the IDE of choice.</li><li>pipenv — to handle package dependencies, create virtual environments, and load environment variables.</li><li>FastAPI— Python API development framework.</li><li>Uvicorn — ASGI server for FastAPI app.</li><li><a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a>— build and run Docker container images on our local machine.</li><li>Azure Container Registry — repository for storing our container image in Azure cloud.</li><li>Azure App Service — PaaS service to host our FastAPI app server.</li><li>Github Actions — automate continuous deployment workflow of FastAPI app.</li></ul><p>Go ahead and download VS Code and Docker Desktop from the links above, as we will be needing those two programs throughout this guide.</p><h3>Project setup on local machine</h3><h4>Create your project folder</h4><p>In your terminal, navigate to a folder where you want to create your project, and run the following commands.</p><pre>mkdir fastapi-cd<br>cd fastapi-cd</pre><pre>code .</pre><figure><img alt="Create project folder." src="https://cdn-images-1.medium.com/max/480/1*_-Cbke295BjaciVUDWzk7w.gif" /><figcaption>Create project folder. Gif by <a href="https://natworkeffects.medium.com/">author.</a></figcaption></figure><p>VS Code should start up with the project folder you created.</p><h4>Install pipenv</h4><p>pipenv is a versatile package that removes the need for a requirements.txt file usually found in Python apps.</p><p>Hit Ctrl + ~ to open a VS Code terminal, and enter the commands:</p><pre>sudo -H pip install -U pipenv<br>pipenv install fastapi uvicorn</pre><figure><img alt="pipenv install packages." src="https://cdn-images-1.medium.com/max/480/1*jnq187acSUA3Z-joxvZ5NA.gif" /><figcaption>pipenv install packages. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>pipenv will proceed to install the libraries in a virtual environment and manage the dependencies for you in a Pipfile.</p><figure><img alt="Pipfile package management." src="https://cdn-images-1.medium.com/max/940/1*d0cSX5aAgD0h_ei-AXVAkg.png" /><figcaption>Pipfile package management. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Because pipenv creates a virtual environment for your project, you don’t need to use the regular venv / virtualenv command either.</p><p>Simply use pipenv shell to activate the virtual environment.</p><pre>pipenv shell<br>uvicorn --version</pre><pre>exit<br>uvicorn --version</pre><p>Use the exit command to exit the virtual environment.</p><p>Note that uvicorn is no longer accessible outside of the environment. It was only installed in the virtual environment accessible using pipenv shell.</p><figure><img alt="Activate virtual environment with pipenv shell." src="https://cdn-images-1.medium.com/max/480/1*2MzMcCIAsw6tOI6LGQq-Ew.gif" /><figcaption>Activate virtual environment with pipenv shell. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Create project files</h4><p>Create the following files in the project directory.</p><pre>touch main.py .env .gitignore .dockerignore Dockerfile</pre><p>In the .gitignore and .dockerignore files, list .env as a file to ignore in your project folder.</p><h4>Github</h4><p>Create a bare Github repo without any files and copy the repo URL.</p><p>Start tracking the changes from your local repo. In the VS Code terminal, run:</p><pre>git init<br>git add .<br>git commit -m &quot;first commit&quot;</pre><pre>git remote add origin &lt;github repo url&gt;<br>git push -u origin main</pre><h4>Docker</h4><p>Head over to <a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a> and install the program.</p><p>This allows you to run Docker commands on your local machine.</p><p><a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a></p><h3>Code</h3><p>We’re finally done with the setup. Time to code. Head back to VS Code. In .env, set PORT=8000.</p><p>In main.py, enter the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c50368ca3f73a4bfbcb1dc162cfcbb25/href">https://medium.com/media/c50368ca3f73a4bfbcb1dc162cfcbb25/href</a></iframe><p>The default address route will now return you a success message.</p><p>Run pipenv run python main.py in the VS code terminal to start the uvicorn server:</p><p>Then go to <a href="http://localhost:8000/docs">http://localhost:8000/docs</a> to see if FastAPI is running.</p><figure><img alt="FastAPI swagger docs." src="https://cdn-images-1.medium.com/max/1024/1*zUPvWKajKFHJm396ObhTng.png" /><figcaption>FastAPI swagger docs. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Note that pipenv loads your environment variables, PORT=8000, for you, before running main.py.</p><h4>Build and Run Container Image</h4><p>Instead of deploying our app as a package, let’s build our app as a Docker image, so that the build process is outlined in a Dockerfile.</p><p>Dockerfile makes the build process seamless and reproducible.</p><p>In the Dockerfile, write the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad70428a8b3571d07deee80b32c9f46a/href">https://medium.com/media/ad70428a8b3571d07deee80b32c9f46a/href</a></iframe><p>Build your container and check that the image has been created with the docker images command.</p><pre>docker build . -t fastapi-cd:1.0<br>docker images</pre><p>Run your container with the image tag you specified earlier, on port 8000.</p><pre>docker run -p 8000:8000 -t fastapi-cd:1.0</pre><p>Check your containerized application by going to <a href="http://localhost:8000/docs">http://localhost:8000/docs</a>.</p><p>You should see the same FastAPI application running.</p><p>Congratulations! You just built a simple FastAPI application, and containerized it using a Docker container on your local machine.</p><h3>Infrastructure setup</h3><h4>Azure Container Registry</h4><p>Time to deploy our application in Azure. First off, create an Azure Container Registry.</p><figure><img alt="Create Azure Container Registry." src="https://cdn-images-1.medium.com/max/1024/1*rmcOpMK9GdZYaIETjnSMBQ.png" /><figcaption>Create Azure Container Registry. Image by <a href="https://natworkeffects.medium.com/">author.</a></figcaption></figure><p>Enable the admin user option in the Access keys pane.</p><figure><img alt="Enable admin user." src="https://cdn-images-1.medium.com/max/1024/1*NMwxPhkeimOjoxL9X2sPkw.png" /><figcaption>Enable admin user. Image by <a href="https://natworkeffects.medium.com/">author.</a></figcaption></figure><p>Going back to your VS Code terminal, log in to Azure with your account.</p><pre>az login<br>az acr login --name fastapicd</pre><p>Build and push your Docker image to the registry server.</p><pre>docker build . -t fastapicd.azurecr.io/fastapi-cd:1.0</pre><pre>docker images<br>docker push fastapicd.azurecr.io/fastapi-cd:1.0</pre><figure><img alt="Push container image to Azure Container Registry server." src="https://cdn-images-1.medium.com/max/480/1*81Zy4qg6S-3O9OUSoPpH2g.gif" /><figcaption>Push container image to Azure Container Registry server. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Check that your Docker image has been successfully pushed to a repo in the registry.</p><figure><img alt="Verify container image in Azure Container Registry repo." src="https://cdn-images-1.medium.com/max/1024/1*D5R1EBYJug9Aci8gm4yBnw.png" /><figcaption>Verify container image in Azure Container Registry repo. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Azure App Service</h4><p>Next, create an App Service resource.</p><figure><img alt="Create App Service." src="https://cdn-images-1.medium.com/max/1024/1*RZ4IVc1bonSWYCFYMEJxHQ.png" /><figcaption>Create App Service. Image by <a href="https://natworkeffects.medium.com/">author.</a></figcaption></figure><p>For the App Service Plan, change the size to Standard S1 SKU under the Production Workloads tab.</p><figure><img alt="Standard S1 App Service Plan." src="https://cdn-images-1.medium.com/max/1024/1*5vvUqs7jOyqGWpHskT_IZA.png" /><figcaption>Standard S1 App Service Plan. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>On the Docker configuration tab, make sure the container image you pushed earlier is selected.</p><figure><img alt="Configure App Service to use container image." src="https://cdn-images-1.medium.com/max/1024/1*gAGMoFrJpPtF-n3vLqsbXQ.png" /><figcaption>Configure App Service to use container image. Image by <a href="https://natworkeffects.medium.com/">author.</a></figcaption></figure><p>Once resource deployment is complete, check that your web app is running by going to <a href="https://&lt;your-webapp-name&gt;.azurewebsites.net/docs">https://&lt;your-webapp-name&gt;.azurewebsites.net/docs</a>.</p><p>You should see the FastAPI swagger docs page render.</p><h3>Github Actions</h3><p>Now we’re ready to create our Github Actions .yml file that will automate deployment of our FastAPI application.</p><p>In VS Code, create a .github/workflows<em> directory </em>and a prod.workflow.yml file within.</p><pre>mkdir .github<br>cd .github</pre><pre>mkdir workflows<br>cd ..</pre><pre>touch .github/workflows/prod.workflow.yml</pre><p>Build your prod.workflow.yml file like below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9583d2c4c841f0f6d123f1b30ecf3e2/href">https://medium.com/media/e9583d2c4c841f0f6d123f1b30ecf3e2/href</a></iframe><p>Now, whenever we do a git push to the main branch, Github Actions will run a deployment job that consists of the 5 steps above, each with its own name.</p><p>Push this new file to Github using the git commands:</p><pre>git add .<br>git commit -m &quot;github actions deployment workflow&quot;<br>git push</pre><h4>Service Principal</h4><p>To automate our deployment workflow with Github Actions, we need to give the actions runner a service principal to authenticate to Azure, and perform the app deployment.</p><p>In VS Code terminal, run:</p><pre>az ad sp create-for-rbac --name &quot;github-actions&quot; --role contributor --scopes /subscriptions/&lt;GUID&gt;/resourceGroups/fastapi-cd --sdk-auth</pre><p>You can get the subscription GUID from the subscription you used to create the resource group.</p><p>You will get a response like below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5478fef1e551419be892e5e2bf6040a/href">https://medium.com/media/b5478fef1e551419be892e5e2bf6040a/href</a></iframe><p>Copy the response and save it. You won’t be able to see it again.</p><p>Head over to Github settings, and create 3 Github Secrets:</p><ul><li>AZURE CREDENTIALS: Entire JSON response from above.</li><li>REGISTRY_USERNAME: clientId value from JSON response.</li><li>REGISTRY_PASSWORD: clientSecret value from JSON response.</li></ul><figure><img alt="Create Github secret." src="https://cdn-images-1.medium.com/max/1024/1*2_sKM9mtWrMo_iqYY5biYg.png" /><figcaption>Create Github secret. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Configure App Service to use Github Actions for continuous deployment</h4><p>In the Deployment Center pane of the App Service, link your Github repo main branch, and configure deployment to use Github Actions.</p><figure><img alt="Configure app to continuously deploy with Github Actions." src="https://cdn-images-1.medium.com/max/1024/1*sgST5ztOr6QyUqJDl7SNvw.png" /><figcaption>Configure app to continuously deploy with Github Actions. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Create staging deployment slot</h4><p>The current app is running in a production slot. To guarantee higher-quality deployments, we will create a staging slot.</p><figure><img alt="Create staging deployment slot." src="https://cdn-images-1.medium.com/max/1024/1*pHSaYUXY_f6dF1tX3TS99w.png" /><figcaption>Create staging deployment slot. Image by <a href="https://natworkeffects.medium.com/">author.</a></figcaption></figure><p>Slots are useful for multiple reasons:</p><ul><li>Changes can be released to a smaller % of users in a staging slot, to validate new releases before swapping the staging slot with production.</li><li>Staging slot app instances are warmed up before being swapped into production, guaranteeing that the app is responsive to requests.</li><li>If something goes wrong with the new release, swaps can be performed again to roll back the changes.</li></ul><p>Check that the staging app is running like the production app by going to <a href="https://&lt;your-webapp-name&gt;-staging.azurewebsites.net/docs">https://&lt;your-webapp-name&gt;-staging.azurewebsites.net/docs</a>.</p><p>Configure the same deployment center settings for the staging slot as you did for production.</p><h4>Push new releases to the staging slot.</h4><p>In your <em>main.py</em> file, make a change to the return message.</p><pre>return {&quot;data&quot;: &quot;Application ran successfully - FastAPI release v2.0&quot;}</pre><p>Do a git push to main branch to trigger the Github Actions workflow.</p><pre>git add .<br>git commit -m &quot;FastAPI v2.0 release&quot;<br>git push</pre><p>Github Actions will build and deploy the new version of your application to the staging slot automatically.</p><figure><img alt="Github Actions deployment job." src="https://cdn-images-1.medium.com/max/1024/1*NSMC9KOSoGrJDppSpRFU3w.png" /><figcaption>Github Actions deployment job. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Check the new version of your application by going to <a href="https://&lt;your-webapp-name&gt;-staging.azurewebsites.net/docs">https://&lt;your-webapp-name&gt;-staging.azurewebsites.net/docs</a>.</p><p>Send a request to the default route to check the response. You should see v2.0 in the return message.</p><figure><img alt="Verify new app release to staging slot." src="https://cdn-images-1.medium.com/max/1024/1*aRKy-B-nWpyg0nLfSOoJMg.png" /><figcaption>Verify new app release to staging slot. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>When you’re comfortable swapping the staging app over to production, simply click on Swap in the Deployment Slots pane of the App Service.</p><figure><img alt="Swap staging app into production." src="https://cdn-images-1.medium.com/max/1024/1*GK6KbLMVZVyuSHA_SEOg5A.png" /><figcaption>Swap staging app into production. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Do the same verification of the new app version as above by going to the production URL <a href="https://&lt;your-webapp-name&gt;.azurewebsites.net/docs">https://&lt;your-webapp-name&gt;.azurewebsites.net/docs</a>.</p><h3>Conclusion</h3><p>Velocity matters when you’re developing software applications.</p><p>As developers, there’s a lot of things we have to keep up with — provisioning infrastructure, spinning up new environments, application testing, etc.</p><p>If we automate the boring stuff, we can focus our time on the most key tasks — building new features.</p><p>In this article, we automated the release and deploy phase of the DevOps lifecycle with Github Actions. This gives us confidence to release often into production without deployment failures.</p><figure><img alt="DevOps lifecycle." src="https://cdn-images-1.medium.com/max/330/1*8Ftlk2oNew3AjqCvZfkXzQ.png" /><figcaption>DevOps lifecycle.</figcaption></figure><h3>Resources</h3><p>All code written in this article can be found at the Github repo:</p><p><a href="https://github.com/natworkeffects/fastapi-cd">GitHub - natworkeffects/fastapi-cd</a></p><p>I would like to give a big shoutout to all the extensive documentation and YouTube videos that helped to complete this article:</p><ul><li><a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-container-github-action?tabs=service-principal">Deploy a custom container to App Service using Github Actions</a></li><li><a href="https://github.com/Azure/webapps-deploy">Github Action repo — deploy to App Service</a></li><li><a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots">Set up staging slots in App Service</a></li><li><a href="https://www.youtube.com/watch?v=gAkwW2tuIqE&amp;ab_channel=Fireship">Learn Docker in 7 Easy Steps — Full Beginner’s Tutorial</a></li><li><a href="https://www.youtube.com/watch?v=2a5414BsYqw&amp;t=146s&amp;ab_channel=incompetent_ian">Containerize FastAPI app with Docker</a></li><li><a href="https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-docker-cli?tabs=azure-cli">Push Docker image to Azure Container Registry</a></li><li><a href="https://www.youtube.com/watch?v=zDYL22QNiWk&amp;t=1320s&amp;ab_channel=CoreySchafer">pipenv tutorial video</a></li><li><a href="https://stackoverflow.com/questions/46503947/how-to-get-pipenv-running-in-docker">How to run pipenv in Docker container</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32c5ab248ce3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/deploy-fastapi-on-azure-with-github-actions-32c5ab248ce3">Deploy FastAPI on Azure with Github Actions</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minimum Viable Streaming Dashboard in Power BI: Part 3]]></title>
            <link>https://medium.com/data-science/minimum-viable-streaming-dashboard-in-power-bi-part-3-9d0b29f4f6a2?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d0b29f4f6a2</guid>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[event-hub]]></category>
            <category><![CDATA[azure-stream-analytics]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Sat, 10 Apr 2021 17:00:08 GMT</pubDate>
            <atom:updated>2022-09-11T09:52:53.595Z</atom:updated>
            <content:encoded><![CDATA[<h4>Featuring report development in Power BI Desktop and publishing reports to Power BI Service</h4><figure><img alt="Final Power BI Report using Push dataset." src="https://cdn-images-1.medium.com/max/1024/1*9Y2CZ4ZskoKhpys6vKFXYg.jpeg" /><figcaption>Final Power BI Report using Push dataset. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Welcome back to the final part of the Minimum Viable Streaming Dashboard series.</p><p>In this post we’ll cover how to build a Power BI report, using the Push dataset we created back in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a>.</p><p>To refresh your memory, we currently have an Azure Stream Analytics (ASA) job running in Azure cloud that is writing events to a Power BI Push dataset.</p><figure><img alt="Application architecture diagram." src="https://cdn-images-1.medium.com/max/1024/1*oiEhFxnJyMUTfVgNxvg8mA.jpeg" /><figcaption>Application architecture diagram. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Now, all we have left to do is to develop our Power BI report by connecting to that dataset.</p><h3>Build a report in Power BI Desktop</h3><p>Before we start, go ahead and download <a href="https://www.microsoft.com/en-us/download/details.aspx?id=58494">Power BI Desktop</a> from Microsoft’s website.</p><p>Download the 64-bit version shown below.</p><figure><img alt="Download Power BI Desktop." src="https://cdn-images-1.medium.com/max/1024/1*udzK7ZBxVELSPG59lDHV4w.png" /><figcaption>Download Power BI Desktop. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Once you’ve finished the installation, search for Power BI Desktop in the Windows search bar, right-click on the app icon, and pin the app shortcut to your taskbar.</p><p>You should see a yellow chart icon on your taskbar like the one below:</p><figure><img alt="Pin Power BI Desktop app shortcut to taskbar." src="https://cdn-images-1.medium.com/max/743/1*b8YuhIESvnzrulqlPqqKlQ.jpeg" /><figcaption>Pin Power BI Desktop app shortcut to taskbar. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Connect to the Push dataset</h4><p>Open Power BI Desktop by clicking on the app icon you pinned on the taskbar.</p><figure><img alt="Open Power BI Desktop app." src="https://cdn-images-1.medium.com/max/1024/1*X3_l9-jscH7RKcR4G0H4bg.jpeg" /><figcaption>Open Power BI Desktop app. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Click on <strong>Get Data</strong>, and log in using your Power BI account.</p><p>In the search bar for the various connectors, search for <strong>Power BI datasets</strong>.</p><figure><img alt="Power BI datasets connector." src="https://cdn-images-1.medium.com/max/744/1*dU1xDP_sWH9yMskq_BvsjQ.jpeg" /><figcaption>Power BI datasets connector. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Click on the yellow <strong>Connect </strong>button in the bottom right.</p><p>Search for the name of the Push dataset you created back in Part 2. Mine is called <strong><em>event-hub-dataset</em></strong>.</p><figure><img alt="Connect to Push dataset created in Part 2." src="https://cdn-images-1.medium.com/max/1024/1*_LevQsqKWvAel4Q9-AJXvw.jpeg" /><figcaption>Connect to Push dataset created in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a>. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Click the <strong>Create</strong> button to establish a live connection to the dataset.</p><p>In the Fields pane in the far right, you will see all the columns created by the ASA job.</p><p>And near the bottom of the page, you will see a message that says you are connected live to the Power BI Push dataset.</p><figure><img alt="Establish live connection to Power BI Push dataset." src="https://cdn-images-1.medium.com/max/722/1*XG3wNrWWxeQSWOd8kuRgKw.jpeg" /><figcaption>Establish live connection to Power BI Push dataset. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Introduction to Power BI Desktop</h4><p>I will take a minute here to explain the elements we’ll be using on the main <strong>Report</strong> tab.</p><figure><img alt="Main Report tab for report development." src="https://cdn-images-1.medium.com/max/1024/1*ZVUqx15HoCpfOdQbdaKeDA.jpeg" /><figcaption>Main Report tab for report development. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>This is the <strong>Report</strong> tab, where you can design visualizations, add interactive filters, and configure your report for the end user.</p><p>The big whitespace in the middle is termed the <strong>Canvas</strong>, and is the main interface your users will use to interact with the published report.</p><p>On the far right is the <strong>Fields </strong>pane mentioned earlier. This is where all the tables and their respective columns show up.</p><p>You can see that for some of the columns, there is a <strong>Summation </strong>symbol beside the column name.</p><figure><img alt="Summation symbol indicating default summarization of values." src="https://cdn-images-1.medium.com/max/220/1*D2TNUkyNTpvokO-BzBPJrQ.jpeg" /><figcaption>Summation symbol indicating default summarization of values. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Whenever you see this, Power BI is applying default summarization on that column whenever it is used as a value in a visual.</p><p>To better control how the column is summarized, it is considered best practice in Power BI to create explicit measures that define how we want to summarize the column.</p><p>We can do so, by clicking the ellipsis beside the <strong><em>event_count</em></strong> column name, and clicking on <strong>New Measure</strong>.</p><figure><img alt="Create new explicit measure in Power BI." src="https://cdn-images-1.medium.com/max/307/1*J41Jz5IuIR6ZavhGBtoP6g.jpeg" /><figcaption>Create new explicit measure in Power BI. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Enter the following DAX expression into the formula bar that pops up at the top of the report canvas:</p><pre># of Page Views = SUM(&#39;&lt;dataset-name&gt;&#39;[event_count])</pre><p>Press the <strong>Enter</strong> key on your keyboard.</p><p>Now, whenever we use the <strong><em># of Page Views</em></strong> measure in one of our visuals, Power BI knows to give us the total number of page views.</p><p>With <strong><em># of Page Views</em></strong> measure selected, change the <strong>Format</strong> option in the <strong>Measure Tools</strong> Ribbon to <strong>Whole number</strong>.</p><p>Also, proceed to select the <strong>Comma</strong> icon in the <strong>Formatting</strong> section.</p><p>This will format our page view metrics to be more pleasing to the human eye.</p><figure><img alt="Format measures in Power BI Measure Tools ribbon." src="https://cdn-images-1.medium.com/max/1024/1*fvJlId1GGdXKSh9WAOyPvA.jpeg" /><figcaption>Format measures in Power BI Measure Tools ribbon. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Design the Visuals</h4><p>Let’s get started creating some visuals for our users to interact with.</p><p>We are going to create a summary page that shows the overall number of events that happened on our website.</p><p>And we are also going to allow users to drill down into the details of each event.</p><p><strong>1. Summary page</strong></p><p>In the <strong>Visualizations</strong> pane, find and select the <strong>Card</strong> visual.</p><p>Tick the checkbox next to the <strong><em># of Page Views</em></strong><em> </em>measure we created to add the explicit measure to the card.</p><p>This will display the total number of page views to date.</p><figure><img alt="Card visual displaying total number of Page Views in Millions." src="https://cdn-images-1.medium.com/max/814/1*kYvSjFO-oicy4DGB2gl-Aw.jpeg" /><figcaption>Card visual displaying total number of Page Views in Millions. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>With the <strong>Card</strong> visual selected, go over to the <strong>Format</strong> tab (paint roller icon) in the <strong>Visualizations</strong> pane.</p><p>Expand the <strong>Data label</strong> dropdown, and change <strong>Display units </strong>to <strong>None</strong>.</p><figure><img alt="Change display units of Card visual to show total number of Page Views." src="https://cdn-images-1.medium.com/max/585/1*vq0sHMQENpxddvKqp1InTg.jpeg" /><figcaption>Change display units of Card visual to show total number of Page Views. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Next, select the <strong>Map </strong>visual from the <strong>Visualizations</strong> pane, drag <strong><em>geo_country</em></strong> to the <strong>Location</strong> field box, and then drag <strong><em>geo_region_name</em></strong> below <strong><em>geo_country</em></strong>.</p><p>This will effectively create a hierarchy that allows you to drill down from the country level to the regional level.</p><p>Add <strong><em># of Page Views</em></strong> to the <strong>Size </strong>field box, and you will see the global spread of where our visitors are coming from.</p><figure><img alt="Map visual with geo hierarchy showing global spread of website visitors." src="https://cdn-images-1.medium.com/max/1024/1*RWhO9N1RA7cm_drogfCTNA.jpeg" /><figcaption>Map visual with geo hierarchy showing global spread of website visitors. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Select the <strong>Click to turn on Drill down</strong> arrow to activate <strong>Drill down</strong> mode for the Map visual.</p><figure><img alt="Activate Drill down mode for Map visual." src="https://cdn-images-1.medium.com/max/522/1*rLNvYRBVXoicNaNyMJehAQ.jpeg" /><figcaption>Activate Drill down mode for Map visual. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Then, click the <strong>US </strong>bubble near the North America section of the map.</p><p>This will allow you to drill down to the regional level and be able to see the different regions of the <strong>US</strong>.</p><figure><img alt="Drill down to US regional level on Map visual." src="https://cdn-images-1.medium.com/max/810/1*rSEsa7I-wGl841e9QH9zRA.jpeg" /><figcaption>Drill down to US regional level on Map visual. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>The region names won’t totally make sense here as our events are programmatically generated.</p><p>Notice how the <strong>Card </strong>visual metric changes as we interact with the <strong>Map</strong> visual on the same canvas.</p><p>Power BI enables the visuals on the same canvas page to interact with each other as a default setting.</p><p>This is really convenient, because it saves the report developer an additional step of configuring the interactions themselves.</p><p>Click the <strong>Drill up</strong> arrow to go back up one level to the country level, and deactivate <strong>Drill down </strong>mode on the <strong>Map</strong> visual.</p><figure><img alt="Deactivate Drill down mode on the Map visual." src="https://cdn-images-1.medium.com/max/517/1*YOkS8UEE4tlw-YOtRtvv3w.jpeg" /><figcaption>Deactivate Drill down mode on the Map visual. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Now that we know where most of our traffic is coming from, we can also analyze how users ended up on our website.</p><p>To do so, add a <strong>Donut chart</strong> visual to the canvas, and check <strong><em># of Page Views </em></strong>and <strong><em>utm_source </em></strong>column.</p><p>Make sure <strong><em># of Page Views</em></strong> is added to the <strong>Values</strong> field box, and <strong><em>utm_source </em></strong>is in the <strong>Legend </strong>field box.</p><figure><img alt="Donut chart visual showing ad platform performance." src="https://cdn-images-1.medium.com/max/1024/1*8e3ZeSpan-ipzw2qfhJnUw.jpeg" /><figcaption>Donut chart visual showing ad platform performance. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Now we can see the number of Page Views by the website source. This tells us which ad platforms our marketing campaigns are performing better.</p><p>With the <strong>Donut chart</strong> visual selected, go over to the <strong>Format</strong> tab in the <strong>Visualizations</strong> pane.</p><p>Expand the <strong>Detail labels</strong> dropdown, and change <strong>Display units </strong>to <strong>Thousands</strong>.</p><figure><img alt="Change display units of Donut chart visual to show total number of Page Views in Thousands." src="https://cdn-images-1.medium.com/max/822/1*GRsjkMyByQTWuPUoS-mxEg.jpeg" /><figcaption>Change display units of Donut chart visual to show total number of Page Views in Thousands. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Click the<strong> US</strong> bubble in the map chart, and then <strong>Ctrl+Click</strong> on the <strong>google</strong> section of the <strong>Donut chart </strong>visual.</p><figure><img alt="Filter Card visual using multiple visuals on the same canvas." src="https://cdn-images-1.medium.com/max/1024/1*YmMT4NLSISTooCRkbsyoTA.jpeg" /><figcaption>Filter Card visual using multiple visuals on the same canvas. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>The number in the <strong>Card </strong>visual shows the total number of users in the US who reached our website from marketing campaigns we launched on Google.</p><p>Finally, let’s add a date slicer to the canvas.</p><p>Click on the <strong>Slicer </strong>visual, and check <strong><em>event_timestamp </em></strong>from the <strong>Fields</strong> pane.</p><p>You should see a slicer appear like the one below, that allows users to view information across a specific time period.</p><figure><img alt="Date slicer that allows users to specify the time period filter." src="https://cdn-images-1.medium.com/max/1024/1*o9iq_K5dGJ68uqPIdHnxGQ.jpeg" /><figcaption>Date slicer that allows users to specify the time period filter. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>With the <strong>Slicer</strong> visual selected, go over to the <strong>Format</strong> tab in the <strong>Visualizations</strong> pane.</p><p>Turn off the <strong>Slicer header</strong>.</p><p>Next, expand the <strong>Date inputs</strong> dropdown, and change <strong>Text size </strong>to <strong>12</strong>.</p><p>Arrange your visuals as shown below:</p><figure><img alt="Final dashboard design layout with Date slicer text size formatted." src="https://cdn-images-1.medium.com/max/1024/1*Wbkzy_zC9c1rxx5klgAOKw.jpeg" /><figcaption>Final dashboard design layout with Date slicer text size formatted. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Rename this page to <strong>Campaign</strong> <strong>Overview</strong>.</p><p><strong>2. Detail Page</strong></p><p>Add a new blank report page, and rename it to <strong>Campaign Details</strong>.</p><figure><img alt="Create new Campaign Details report page." src="https://cdn-images-1.medium.com/max/457/1*unOemcvA4nJiRCkInVMxWA.jpeg" /><figcaption>Create new Campaign Details report page. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Insert a <strong>Table</strong> visual into the canvas, and add these columns to the table in the following order:</p><ul><li>event_timestamp</li><li># of Page Views</li><li>utm_source</li><li>utm_campaign</li><li>utm_content</li><li>user_custom_id</li><li>geo_country</li><li>geo_region_name</li></ul><figure><img alt="Table visual displaying campaign details." src="https://cdn-images-1.medium.com/max/1024/1*ZFIXpEVbj5gum31HCfEfAg.jpeg" /><figcaption>Table visual displaying campaign details. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>With the <strong>Table </strong>visual selected, go over to the <strong>Format</strong> tab in the <strong>Visualizations</strong> pane, and expand the <strong>Style</strong> section.</p><p>Change the style of the visual to <strong>Minimal</strong> for better readability.</p><figure><img alt="Change Table visual style for better readability." src="https://cdn-images-1.medium.com/max/1024/1*VEiUheNYHDfsp4yi8RdEBg.jpeg" /><figcaption>Change Table visual style for better readability. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Let’s change some other Format settings in the <strong>Table</strong> visual.</p><p>Expand <strong>Column headers</strong> section, set <strong>Font family</strong> to <strong>Segoe UI Semibold</strong>, and <strong>Text size</strong> to <strong>11</strong>.</p><p>For <strong>Values</strong>, leave <strong>Font family</strong> as <strong>Segoe UI</strong>, and set <strong>Text size</strong> to <strong>11</strong>.</p><p>Your final table result should look like this:</p><figure><img alt="Final Table visual after changing font options." src="https://cdn-images-1.medium.com/max/1024/1*1RYJRUT1V1ktCciGvCRDDw.jpeg" /><figcaption>Final Table visual after changing font options. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Now go back to the <strong>Fields</strong> tab under the <strong>Visualizations</strong> pane.</p><p>Scroll down till you see a box that says <strong>Add Drill through fields here</strong>.</p><p>Drag the following fields to the section:</p><ul><li>geo_country</li><li>geo_region_name</li><li>utm_source</li></ul><p>This will tell Power BI to listen for any users who want to drill through into the detail page from other pages in the report using the fields you added.</p><figure><img alt="Add Drill through fields to Campaign Details report page." src="https://cdn-images-1.medium.com/max/226/1*fjM-6CAChbMUxukRfdQM1g.jpeg" /><figcaption>Add Drill through fields to Campaign Details page. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>If you go back to the <strong>Campaign Overview</strong> page now, and right-click on <strong>US </strong>in the <strong>Map</strong> visual, you should see an option titled <strong>Drill through</strong>.</p><figure><img alt="Drill through into details page from Campaign Overview page." src="https://cdn-images-1.medium.com/max/729/1*FH9PiIeV_-4W2Mj_7Fd8OA.jpeg" /><figcaption>Drill through into details page from Campaign Overview page. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Mouse over that option, and click on <strong>Campaign Details</strong> to drill into that detail page.</p><p>Notice how all the filters present in the <strong>Campaign Overview</strong> page will carry over to the detail page i.e. only US page views are displayed to the user.</p><figure><img alt="Campaign Details page with filters applied from overview page." src="https://cdn-images-1.medium.com/max/1024/1*udRk31SzoRBxe-txyIe5pg.jpeg" /><figcaption>Campaign Details page with filters applied from overview page. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p><strong>Ctrl+Click </strong>the arrow in the top left to go back to the summary page.</p><p>Save your Power BI Report by clicking on the <strong>Save </strong>icon in the top left corner of the UI.</p><h3>Publish your report to Power BI Service</h3><p>Now we have our report, click on<strong> Publish</strong> in the <strong>Home</strong> ribbon, and publish the report to a workspace.</p><p>I’m just going to use the same one back in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a> where the <strong><em>event-hub-dataset </em></strong>is located.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0QE2U5jZEGkzdp-H0V0S3Q.jpeg" /><figcaption>Publish final report to Power BI Service. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Sign in to <a href="http://app.powerbi.com/">Power BI Service</a> and take a look at your report in the workspace which you published it to.</p><p>Now functionality such as filtering, drill-throughs, and tooltips are available to us!</p><p>This is the benefit of using a Push dataset that can analyze historical data.</p><figure><img alt="View published report in Power BI Service." src="https://cdn-images-1.medium.com/max/1024/1*ei-qBYfVZchhBZKOQSYxow.jpeg" /><figcaption>View published report in Power BI Service. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><h4>Send events to Event Hub</h4><p>Let’s send some events to Event Hub again using the <strong><em>send_events.py</em></strong> file we created back in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a>.</p><p>Give some time for the ASA job to finish processing the events, and refresh the report.</p><p>You should see your metrics get updated instantly, albeit without the smooth animations that were previously seen in a Streaming dataset.</p><figure><img alt="Test functionality of published report in Power BI Service." src="https://cdn-images-1.medium.com/max/480/1*L3_K98PblSSw0T_UNcF57w.gif" /><figcaption>Test functionality of published report in Power BI Service. <a href="https://gph.is/g/aQnpvwV">Gif</a> by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Power BI Push datasets only store a maximum of 200k rows.</p><p>If you see your <strong><em># of Page Views</em></strong> decrease, it is because you’ve already hit that limit, and the older rows in the dataset have been pushed out in a first-in-first-out (FIFO) fashion.</p><h3>Conclusion</h3><p>We’ve finally come to the end of the Minimum Viable Streaming Dashboard in Power BI series.</p><p>In this part we covered how to develop a Power BI report using a Push dataset, and published it to Power BI Service to expose curated data and insights back to our end users.</p><p>If you learned something new that was useful to you in these posts, feel free to follow me for more content about building modern data management platforms.</p><h4>Stream Analytics Cost Model: Per Hour billing based on no. of Streaming Units</h4><p>At $0.127/hr, with 3 Streaming units running 24/7 throughout the day, you only pay $283 per month.</p><p>There are no servers to manage, so you can just focus on the output of your code.</p><h4>Clean up resources in Azure Portal</h4><p>Since we are not sending events any more, you can go ahead and stop your ASA job in the portal.</p><p>Otherwise, unnecessary cost will be incurred.</p><figure><img alt="Stop Azure Stream Analytics job." src="https://cdn-images-1.medium.com/max/1024/1*UadHaA-pCFcxh7-4W2VyqQ.png" /><figcaption>Stop Azure Stream Analytics job. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>You can leave the stopped ASA job, and the Event Hub if you think you might still need them in the future, as they incur no cost if the ASA job isn’t running / processing events, and the Event Hub isn’t ingesting any new events respectively.</p><h3>Resources</h3><p>Once again, I’ll include links to Part 1 and Part 2 if you came directly to this article without going through those first.</p><p>All Microsoft documentation used for research purposes are also linked below.</p><ol><li><a href="https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-streaming-unit-consumption">Streaming Units in Azure Stream Analytics</a></li><li><a href="https://azure.microsoft.com/en-us/pricing/details/stream-analytics/">Azure Stream Analytics | Pricing</a></li><li><a href="https://azure.microsoft.com/en-us/pricing/details/event-hubs/">Event Hubs | Pricing</a></li><li><a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-1-56e00a82c22f">Minimum Viable Streaming Dashboard in Power BI: Part 1</a></li><li><a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Minimum Viable Streaming Dashboard in Power BI: Part 2</a></li></ol><p>All of the Python code snippets used today can be found in the <br>Github repo:</p><p><a href="https://github.com/natworkeffects/power-bi-streaming">GitHub - natworkeffects/power-bi-streaming</a></p><p>Thank you for reading through this series, and see you again in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d0b29f4f6a2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/minimum-viable-streaming-dashboard-in-power-bi-part-3-9d0b29f4f6a2">Minimum Viable Streaming Dashboard in Power BI: Part 3</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minimum Viable Streaming Dashboard in Power BI: Part 2]]></title>
            <link>https://medium.com/data-science/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b902cd25c8</guid>
            <category><![CDATA[azure-stream-analytics]]></category>
            <category><![CDATA[events-hub]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Mon, 29 Mar 2021 03:43:11 GMT</pubDate>
            <atom:updated>2022-03-16T23:54:57.424Z</atom:updated>
            <content:encoded><![CDATA[<h4>Featuring Push datasets and the Power BI REST API</h4><p>Welcome back to Part 2 of the Minimum Viable Streaming Dashboard series, where we continue our discussion on real-time dashboards and how to configure them in Power BI.</p><p>Back in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-1-56e00a82c22f">Part 1</a>, we talked about Streaming datasets and how they utilize a temporary cache to store data. The data expires quickly, causing historical data analysis to be impossible.</p><p>In this post, however, we’ll be exploring how to configure a Push dataset instead. And you’ll see that a lot more functionality becomes available to us — the report consumer, including filtering, tooltips, drill-throughs, and more.</p><h3>Pushing Data to the Power BI REST API</h3><h4>Power BI Rest API</h4><p>Pushing data to a Power BI dataset is accomplished using the <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/">Power BI REST API</a>.</p><p>The API contains a set of service endpoints that enable developers and Azure services to build applications on top of. Although we won’t be calling these endpoints explicitly today, it is worthwhile to understand that you can utilize this particular <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets">set of operations</a> to create your very own Push/Streaming dataset in Power BI.</p><p>And this is how Azure services, such as Azure Stream Analytics, interacts with Power BI datasets.</p><h4>Configuration Methods for Pushing Data</h4><p><strong>1. API</strong></p><p>There are 2 ways to push data from your data source to Power BI’s REST API.</p><p>The first is using the <strong>API option provided in Power BI Service</strong>.</p><figure><img alt="API option in Power BI Service." src="https://cdn-images-1.medium.com/max/1024/1*An0SPbZCUbbKLTUwYVoHWw.png" /><figcaption>API option in Power BI Service. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>When you click on API, you will encounter a screen where you can name your Power BI dataset, and design its JSON schema.</p><figure><img alt="Designing your dataset." src="https://cdn-images-1.medium.com/max/679/1*YmjtSte6ClSFnn0aF2ZaFQ.jpeg" /><figcaption>Designing your dataset. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Note that <strong>Historic data analysis</strong> <strong>defaults to</strong> <strong>Off</strong>.</p><p>This is the toggle that you use to switch between just creating a Streaming dataset, and a <strong>Push + Streaming dataset </strong>that can take advantage of features offered in both modes.</p><p>Turning the toggle off will only create a Streaming dataset, and works similar to the PubNub stream we were reading data from, back in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-1-56e00a82c22f">Part 1</a>.</p><p>The only difference is that for PubNub, Power BI is merely reading a stream of data from PubNub’s API.</p><figure><img alt="Push URL endpoint created by Power BI." src="https://cdn-images-1.medium.com/max/674/1*F9S4qG2FOFgLgGQNvijsXw.jpeg" /><figcaption>Push URL endpoint created by Power BI. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>You can push data to the REST API without going through Power BI Service’s UI. But do remember that you will have to <strong>authorize your application with permissions </strong>to make changes to the Power BI workspace where you want to create your dataset.</p><p>That is a topic deserving of its own dedicated blog post.</p><p>Today, we will mainly be focusing on the second method of pushing data to the Power BI REST API, using Azure Stream Analytics.</p><p><strong>2. Azure Stream Analytics (ASA)</strong></p><figure><img alt="Azure Stream Analytics logo." src="https://cdn-images-1.medium.com/max/600/1*rWj82pgfuKda5s4CqCKtIg.png" /><figcaption>Azure Stream Analytics logo. Image by <a href="https://azure.microsoft.com/en-us/services/stream-analytics/">Microsoft</a>.</figcaption></figure><p>Azure Stream Analytics is a managed PaaS service running on Microsoft’s Azure platform. If you’ve worked with Spark’s Structured Streaming engine before, then the ASA engine is very similar.</p><p>ASA jobs are written in a SQL-like query language, which is a common language understood by any developer who has worked with a database.</p><p>The design philosophy of this service is highly similar to <a href="https://www.youtube.com/watch?v=wQfm4P23Hew&amp;ab_channel=DataCouncil">Spark’s Structured Streaming project</a>, which is that you, as the consumer of the service, should not have to worry about the complexities of event stream processing i.e. late data arrival times, data out-of-order, event delivery guarantees.</p><p>You should just be able to tell ASA the output you want, writing your query in SQL as if you’re running a batch query, and the service figures out how to convert that query into a version that can run on streams.</p><h3>Demo: Event Streaming</h3><p>So this is a diagram of the application we’ll be building today.</p><figure><img alt="Demo application architecture diagram." src="https://cdn-images-1.medium.com/max/1024/1*Ycy6eX9Vjc093vAmb1OPtw.jpeg" /><figcaption>Demo application architecture diagram. Image by <a href="https://nathancheng-data.medium.com/"><em>author</em></a>.</figcaption></figure><p>For our event data source, we will be using a simple Python script to send events to an Event Hub.</p><p>So without further ado, let’s get started creating the resources we need for our application, starting with Event Hub.</p><h4>Creating an Event Hub Namespace for Event Ingestion</h4><p>The first resource we have to create is an Event Hub namespace to ingest all our events.</p><p>Before we do that, head over to Azure and sign up for a <a href="https://azure.microsoft.com/en-us/free/">free trial</a>. You get <strong>$200 credit free </strong>to explore Azure services for<strong> 30 days</strong>.</p><figure><img alt="Azure free trial signup screen." src="https://cdn-images-1.medium.com/max/1024/1*G2N0ipMO_W8wJhC2zix8uA.png" /><figcaption>Azure free trial signup screen. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>If you’re currently a student, you can access <strong>additional Azure credit worth $100</strong>.</p><p><strong>1. Create the Event Hub Namespace</strong></p><p>Once signup is complete, search for Event Hub in the portal’s search bar, click on Event Hubs, and fill in the following properties:</p><ul><li>Subscription: Select your default subscription</li><li>Resource group: <strong>Create new</strong>, and choose a name for your resource group</li><li>Namespace name: Choose a name for your Event Hub namespace</li><li>Location: Select the closest region to you</li><li>Pricing tier: <strong>Standard</strong></li><li>Throughput Units: <strong>1</strong></li><li>Enable Availability Zones: <strong>Unchecked</strong></li><li>Enable Auto-Inflate: <strong>Unchecked</strong></li></ul><figure><img alt="Create Event Hub Namespace." src="https://cdn-images-1.medium.com/max/1024/1*g-uFR4nfOznAeD8i45gMug.jpeg" /><figcaption>Create Event Hub Namespace. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>An Event Hub Namespace serves as a management container for multiple Event Hub instances, or topics in Kafka terminology.</p><p>Event publishers can push events to each topic either using Azure Active Directory based authentication and authorization, or by using a Shared Access Signature (SAS).</p><p><strong>2. Add a SAS Policy</strong></p><p>We will need a SAS token to authorize our Python application to send events to Event Hub.</p><p>So go over to the Shared Access Policies pane in your Event Hub namespace, and add a new policy with the following details:</p><ul><li>Policy name: Choose a policy name</li><li>Manage: <strong>Checked</strong></li></ul><figure><img alt="Add Event Hub Namespace SAS policy." src="https://cdn-images-1.medium.com/max/321/1*AKPSxGlTdlZTJY3eUqWRKw.jpeg" /><figcaption>Add Event Hub Namespace SAS policy. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Copy the <strong>Connection string-primary key</strong> that is created for you and keep it handy somewhere, we’ll use it later in our Python script to send web events to Event Hub.</p><p><strong>3. Create an Event Hub</strong></p><p>Mouse over to the Event Hubs pane, and create an Event Hub instance with the following attributes:</p><ul><li>Name: Choose a name for your Event Hub instance</li><li>Partition Count: <strong>1</strong></li><li>Message Retention: <strong>1 </strong>(Feel free to set a longer retention period if you will take more than one day to finish trying out the steps in this article)</li><li>Capture: <strong>Off</strong></li></ul><figure><img alt="Create Event Hub instance." src="https://cdn-images-1.medium.com/max/705/1*NcUN6wBo2w88rGYqhOOxsg.jpeg" /><figcaption>Create Event Hub instance. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><h4>Writing an Event Generator in Python</h4><p>The code we’ll be using today can be found in this <a href="https://github.com/natworkeffects/power-bi-streaming">Github repo</a>.</p><p><strong>1. Install Python 3</strong></p><p>Install <a href="https://www.python.org/downloads/release/python-379/">Python 3</a> on your system. Make sure the version you’re using is at least 3.6 and above. I use version 3.7.9.</p><p><strong>2. Install Visual Studio (VS) Code editor</strong></p><p>Install your Linux / Windows / MacOS distribution of <a href="https://code.visualstudio.com/download">Visual Studio Code</a>.</p><p>Then, create a project folder in your directory. I named mine <strong><em>event-streaming</em></strong>, but you can name yours whatever you want.</p><p><strong>3. List the Required Python Packages</strong></p><p>Go ahead and open the folder you just created in VS Code. Create a <strong><em>requirements.txt</em></strong> file. Copy and paste the code from the Github repo into your file.</p><figure><img alt="Required Python packages." src="https://cdn-images-1.medium.com/max/495/1*kX3K4SvxpXQluz38PT5yUQ.jpeg" /><figcaption>Required Python packages. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p><strong>4. Write Python code that simulates random web events</strong></p><p>Once you’re done, create a <strong><em>send_events.py</em></strong> file. Copy and paste the code from the repo into the file.</p><p>In your terminal, run the following command:</p><pre>pip3 install -r requirements.txt</pre><p>This will install packages we specified in the <strong><em>requirements.txt</em></strong> file earlier.</p><p>If the pip3 command fails, <strong><em>cd</em></strong> to the exact pip3 file path in the <strong><em>Python/Python37/Scripts</em></strong> folder on your computer in the VS Code terminal.</p><figure><img alt="Python script to simulate random web events." src="https://cdn-images-1.medium.com/max/1024/1*8ysLNfheuG_76czE3DJoLA.jpeg" /><figcaption>Python script to simulate random web events. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p><strong>5. Run the Python file to send events to Event Hub</strong></p><p>Before you can run the file to push events to Event Hub, paste the <strong>Connection string-primary key </strong>into the <strong><em>&lt;connection-string&gt;</em></strong> parameter.</p><p>Also, fill in your event hub topic name in the <strong><em>&lt;event-hub&gt; </em></strong>parameter.</p><p>Once you’re finished with those steps, right-click anywhere in the code editor, and select <strong>Run Python File in Terminal</strong>.</p><h4>Creating an Azure Stream Analytics job from VS Code editor</h4><p><strong>1. Install Azure Stream Analytics Tools extension</strong></p><p>In VS Code, click on the <strong>Extensions</strong> tab, and search for <strong>Azure Stream Analytics</strong>.</p><p>Install the <strong>Azure Stream Analytics Tools</strong> extension.</p><p>As a dependency, the <strong>Azure Account</strong> extension is also installed for us. This extension enables us to retrieve data from Azure Portal, and also publish our ASA job to the portal.</p><figure><img alt="Install Azure Stream Analytics extension in VS Code." src="https://cdn-images-1.medium.com/max/1024/1*HY7W5AeMq47w3WvJNSJxCg.jpeg" /><figcaption>Install Azure Stream Analytics extension in VS Code. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p><strong>2. Create a new Stream Analytics project</strong></p><p>In Visual Studio Code, navigate back to the <strong>Explorer</strong> tab.</p><p>Use <strong>Ctrl+Shift+P / Cmd+Shift+P </strong>to open the command palette.</p><p>Then, enter ASA in the search bar.</p><p>Select <strong>ASA: Create New Project</strong>, and enter your project name. I named mine <strong><em>stream-job</em></strong>.</p><p><strong>3. Define the Input Data</strong></p><p>Expand the <strong>Inputs</strong> folder, and open the <strong><em>input.json </em></strong>file. We’ll use this file to specify an input data stream that our ASA job can read from.</p><p>At the top left-hand corner of the editor window, click the <strong>Add live input</strong> button. Select <strong>Event Hub</strong>, and then <strong>Select from your Azure Subscriptions</strong>.</p><p>Give your input stream a name, I named mine <strong><em>event-hub-stream</em></strong>.</p><figure><img alt="Add live input stream to Stream Analytics job." src="https://cdn-images-1.medium.com/max/736/1*--djZ_c4kCvWnfgMZ-_BQQ.jpeg" /><figcaption>Add live input stream to Stream Analytics job. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>You can then use the new <strong><em>.json</em></strong> file created for you in the <strong>Inputs</strong> folder to fill in your Event Hub connection settings, by clicking the interactive buttons.</p><figure><img alt="Configure Event Hub live input stream." src="https://cdn-images-1.medium.com/max/1000/1*j1MEJEIGlOn3bhmBmON0bQ.jpeg" /><figcaption>Configure Event Hub live input stream. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Click on <strong>Preview Data </strong>located at the top left corner of the <strong><em>.json </em></strong>file to get a glimpse of the data we sent to Event Hub using our Python script earlier.</p><figure><img alt="Preview Event Hub data." src="https://cdn-images-1.medium.com/max/1024/1*zxBIM67G7KM8KQRNCwuyvg.jpeg" /><figcaption>Preview Event Hub data. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Note that all data in the input stream are treated as strings. For some of these columns, such as <strong><em>event_timestamp</em></strong>, we will change their data type to <strong><em>datetime</em></strong> using an ASA query in the next step.</p><p><strong>4. Write the Stream Analytics query</strong></p><p>In the <strong><em>.asaql</em></strong> file, insert the SQL query from the Github repo.</p><p>A comprehensive reference to the functions offered by the Stream Analytics query language can be found <a href="https://docs.microsoft.com/en-us/stream-analytics-query/stream-analytics-query-language-reference">here</a>, if you wish to modify the query.</p><figure><img alt="Stream Analytics SQL query." src="https://cdn-images-1.medium.com/max/891/1*yENEVDEp-JbsDr6BF2j6yA.jpeg" /><figcaption>Stream Analytics SQL query. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p><strong>5. Define the Output Sink</strong></p><p>Go through the same process we did in step 3 to create an output sink for the ASA job to write to.</p><p>Expand the <strong>Outputs</strong> folder, and open the <strong><em>output.json </em></strong>file.</p><p>Click on <strong>Add Output, </strong>select<strong> Power BI</strong>, and then <strong>Select from your Azure Subscriptions</strong>.</p><p>Give your output a name, mine is <strong><em>event-hub-dataset</em></strong>.</p><p>You can then use the new <strong><em>.json</em></strong> file created for you in the <strong>Outputs</strong> folder to fill in your Power BI workspace and dataset information.</p><p>Note down the <strong><em>GroupId </em></strong>uuid value. This value uniquely identifies the Power BI workspace you selected. We’ll use it later to give the ASA job permission to write to that workspace.</p><figure><img alt="Configure Power BI output sink for Stream Analytics job." src="https://cdn-images-1.medium.com/max/936/1*CkzfX4PNTZMOsMBG9CE6HQ.jpeg" /><figcaption>Configure Power BI output dataset for Stream Analytics job. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Note that <strong>My Workspace</strong> option is not available for selection in VS Code (although it is available when creating a Power BI output sink in Azure Portal).</p><p>So you have to create a workspace in Power BI Service first, before selecting the workspace in VS Code’s dropdown.</p><p>This requires you to have a <strong>Pro account</strong>, or be on the free trial of the Pro version.</p><p>If you don’t have a Pro license, you will have to set your output dataset workspace to be in <strong>My Workspace</strong>, which is accomplished by editing your ASA job in Azure Portal.</p><p><strong>6. Edit your SQL query to reference your newly created input stream and output sink</strong></p><p>Go back to your <strong><em>.asaql </em></strong>file, and change <strong>Output</strong> to reflect your Power BI output sink, and <strong>Input</strong> to reflect your Event Hub stream.</p><p>They will be the names of the respective <strong><em>.json </em></strong>files that were created.</p><figure><img alt="Specify the SQL query to target Event Hub input stream and write data to Power BI dataset." src="https://cdn-images-1.medium.com/max/950/1*wXkhVG8NyU2tY-s0_2AHmQ.jpeg" /><figcaption>Specify the SQL query to target the Event Hub input stream and write data to Power BI dataset. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><h4>Publish the ASA job to Azure Portal</h4><p><strong>1. Submit the ASA job and create a Service Principal</strong></p><p>In your <strong><em>.asaql </em></strong>file, and submit your job to the Azure Portal by clicking on <strong>Submit to Azure</strong> at the top left.</p><p>Give Azure a few minutes to finish deployment of the job.</p><p>You can monitor the ASA deployment logs in the <strong>Azure Stream Analytics</strong> terminal window.</p><p>Once deployment is complete, go over to Azure Portal to see your new ASA job.</p><p>Click the Managed Identity pane, and make sure <strong>Use System-assigned Managed Identity</strong> is set to <strong>On</strong>.</p><figure><img alt="Service Principal ID for Stream Analytics application." src="https://cdn-images-1.medium.com/max/1024/1*o_0-GVcqUsJLvz7_ufFQYQ.jpeg" /><figcaption>Service Principal ID for Stream Analytics application. Image by <a href="https://nathancheng-data.medium.com/">author</a>.</figcaption></figure><p>Azure has automatically created a service principal for your ASA application, along with an <strong>associated Principal ID</strong> used for authentication when writing data to a Power BI workspace.</p><p>Copy the Principal ID, we’ll use it in the next step.</p><p><strong>2. Grant the ASA job Contributor access to your Power BI workspace.</strong></p><p>Now all we have to do is grant the ASA job write access to the Power BI workspace.</p><p>We can do this using by using the <strong><em>MicrosoftPowerBIMgmt</em></strong> PowerShell cmdlets.</p><p>Open Windows PowerShell on your computer, and type in the following command to install the cmdlet:</p><pre>Install-Module -Name MicrosoftPowerBIMgmt</pre><p>Then, go ahead and log in to Power BI with your credentials:</p><pre>Login-PowerBI</pre><p>Enter the following command to give the ASA service principal <strong>Contributor</strong> access to the output workspace you specified.</p><p>Replace <strong><em>&lt;group-id&gt;</em></strong> with the <strong><em>GroupId </em></strong>you copied from<strong><em> </em></strong>your <strong><em>output.json</em></strong> file, and <strong><em>&lt;principal-id&gt;</em></strong> with the <strong><em>Principal ID </em></strong>of the ASA job.</p><pre>Add-PowerBIWorkspaceUser -WorkspaceId &lt;group-id&gt; -PrincipalId &lt;principal-id&gt; -PrincipalType App -AccessRight Contributor</pre><p><strong>3. Start the job, and check your output dataset in the Power BI workspace</strong></p><p>In the Azure Portal, on the Overview pane of your ASA job, press <strong>Start </strong>to run the job.</p><p>Navigate to your Power BI workspace, and verify that your dataset has been created successfully.</p><p>If there is no dataset created, your events have probably expired because we only set the retention period for events in Event Hub to 1 day.</p><p>In the case that happens, send web events using the <strong><em>send_events.py </em></strong>file again, and then verify that the events have been written to the Power BI dataset.</p><h3>Conclusion</h3><p>In this article, we’ve explored how to create a Push dataset in Power BI.</p><p>We started by ingesting web events from a simple Python script into an Event Hub. The data input stream was then transformed, using Azure Stream Analytics as the processing engine.</p><p>In <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-3-9d0b29f4f6a2">Part 3</a>, we will finish off the series by talking a bit more about Stream Analytics and its cost model, and publish our very first Power BI report with the dataset we built in this post.</p><p>Before we end off, there are just some brief points I’d like to cover about the service components used in today’s architecture.</p><h4>Event Delivery Guarantees</h4><p>There are some caveats you should be aware of when working with streaming technologies, the most important one being event delivery guarantees.</p><p>ASA guarantees at-least-once delivery to output sinks, which guarantees that all records are delivered to Power BI, but duplicate records may occur in the dataset.</p><p>In situations where you need exactly-once delivery of records, modify your Stream Analytics query to handle deduplication of records using a unique identifier / primary key.</p><h4>Default parameters in Stream Analytics created Power BI datasets</h4><p>ASA creates a Power BI Push Dataset with its <strong><em>defaultMode</em></strong> parameter set to <strong><em>pushStreaming </em></strong>using <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_postdatasetingroup">Push Dataset service endpoints</a>, resulting in a dataset that can take advantage of both report functionality and smooth-animation streaming tiles we saw back in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-1-56e00a82c22f">Part 1</a>.</p><p>ASA also automatically sets the <strong><em>retentionPolicy</em></strong> parameter of the dataset to <strong><em>basicFIFO</em></strong>. With that setting, the database in Power BI supporting the Push dataset stores 200,000 rows, and the rows are dropped in a first-in-first-out (FIFO) fashion.</p><p>Therefore, even with a Push dataset, we can’t analyze historical data that spans too far back into the business. It is, however, an improvement upon the Streaming dataset which only utilizes a temporary cache to store data.</p><h3>Resources</h3><p>I would like to thank the contributors at Microsoft who have written great documentation on the technologies we’ve used in this blog post.</p><p>If you need more information, start your research with the articles listed below:</p><ol><li><a href="https://docs.microsoft.com/en-us/power-bi/connect-data/service-real-time-streaming">Real-time streaming in Power BI</a></li><li><a href="https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-python-get-started-send">Send or receive events from Azure Event Hubs using Python</a></li><li><a href="https://docs.microsoft.com/en-us/stream-analytics-query/stream-analytics-query-language-reference">Stream Analytics Query Language Reference</a></li><li><a href="https://docs.microsoft.com/en-us/stream-analytics-query/event-delivery-guarantees-azure-stream-analytics">Event Delivery Guarantees (Azure Stream Analytics)</a></li><li><a href="https://docs.microsoft.com/en-us/rest/api/power-bi/">Power BI REST API</a></li><li><a href="https://docs.microsoft.com/en-us/azure/stream-analytics/powerbi-output-managed-identity">Use Managed Identity to authenticate your Azure Stream Analytics job to Power BI output</a></li><li><a href="https://pypi.org/project/fake-web-events/">fake-web-events | PyPI</a></li></ol><p>Once again, all of the code snippets we used today, can be found at the Github repository provided. Until then, I’ll see you in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-3-9d0b29f4f6a2">Part 3</a>.</p><p><a href="https://github.com/natworkeffects/power-bi-streaming">GitHub - natworkeffects/power-bi-streaming</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b902cd25c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Minimum Viable Streaming Dashboard in Power BI: Part 2</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minimum Viable Streaming Dashboard in Power BI: Part 1]]></title>
            <link>https://medium.com/data-science/minimum-viable-streaming-dashboard-in-power-bi-part-1-56e00a82c22f?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/56e00a82c22f</guid>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[pubnub]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[streaming-analytics]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Sun, 31 Jan 2021 00:10:15 GMT</pubDate>
            <atom:updated>2022-09-11T09:51:17.814Z</atom:updated>
            <content:encoded><![CDATA[<h4>A trilogy about developing real-time streaming dashboards and their use cases in Power BI.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Uu9HnpYP0uAx04Dz7X5PQ.png" /><figcaption>Traditional dashboard. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Most of us are familiar with the idea of a traditional dashboard, a compilation of key metrics and charts, displayed to provide useful information for decision-making.</p><p>Majority of these dashboards are powered by underlying datasets that refresh at scheduled intervals (weekly, daily, or hourly).</p><p>At any given point, the dashboard is providing you with a snapshot of static information that will be refreshed sometime in the future. And this design pattern is proven and ubiquitous.</p><p>From time to time, however, there comes a demand from stakeholders for dashboards with the capability to display data generated a few minutes, or even seconds ago.</p><p>An example scenario would be a field engineer who is monitoring critical healthcare machines. To capture machine downtime, and react instantly to minimize disruption to healthcare services, the engineers require the capability to see a real-time data feed.</p><p>Enter Power BI. Power BI has simplified the process for us to achieve this solution using a no-code / low-code approach.</p><p>In this three-part series, I will cover how exactly to set up streaming dashboards in Power BI so that you can implement your own streaming dashboard.</p><h3>Configuring The Dataset</h3><p>To display streaming data, the first thing you need to consider is the dataset that will power the dashboard.</p><p>There are 2 distinct types of datasets that Power BI can utilize, which are designed for display on real-time dashboards — Streaming datasets, and Push datasets.</p><p>At its core, the method to configure these two datasets are almost identical, the key difference being that Streaming datasets store data in a temporary cache, which expires quickly, whereas Push datasets store historical data in a database created by Power BI.</p><p>In this article, we’ll focus primarily on Streaming datasets and go through a short demo tutorial. Then we’ll take a look at some use cases and examples where such a solution would come into play.</p><p>In <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a> of this series, we’ll move forward and explore the close cousin of Streaming datasets — Push datasets.</p><h4>Streaming Dataset: Pros and Cons</h4><p>As mentioned before, for Streaming datasets, data is stored in a temporary cache that quickly expires. The dataset can only store information generated in the past hour.</p><p>Without an underlying database to store your data, you cannot create reports with a Streaming dataset in Power BI. You only have the ability to create dashboard tiles.</p><p>Because of this reason, functionality in Power BI reports such as filtering is unavailable.</p><p>The pros of such a design is that dashboard tiles update with smooth animations, compared to using a Push dataset. Latency between when data is generated, and when it is visualized is also minimized, making it useful to display information generated by critical applications or devices that you want to monitor.</p><figure><img alt="Smooth animations in dashboard tiles." src="https://cdn-images-1.medium.com/max/480/1*BGRcud4X7KLvWWBkpCsXsQ.gif" /><figcaption>Smooth animations in dashboard tiles. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>You can perform simple aggregations, such as averages, before data streams into Power BI, so you’re not just limited to raw data generated by your data source.</p><p>The downside is that historical data analysis is not possible. Report functionality, such as filtering for a specific time range or dimension, DAX expressions, drill-through, or tooltip capabilities are unavailable.</p><p>The types of aggregations you can perform on your data is also limited. Complex aggregations with multiple table joins and filters will introduce latency to your dashboard. Displaying complex metrics comes at the cost of a dashboard with sub-optimal performance.</p><p>If complex aggregations are required, you can consider Push datasets or dashboards that refresh hourly as other options.</p><h3>Demo: PubNub Data Streams</h3><p>There are 2 approaches to connect a Power BI dashboard to a Streaming dataset:</p><ol><li>Reading data from an existing PubNub data stream.</li><li>Pushing data to the Power BI REST API.</li></ol><p>We’ll be utilizing data from a PubNub data stream in this article, and in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a>, you will see a demo of the latter approach.</p><h4>Create a Power BI account</h4><p>Before we create our dataset for the demo, head over to the Power BI website using the link below, and sign up for a Power BI account using your work or school email address:</p><p><a href="https://powerbi.microsoft.com/en-us/get-started/">How to Get Started | Microsoft Power BI</a></p><p>There is no need to download Power BI Desktop as we cannot create reports with a Streaming dataset. Hence, we are only utilizing Power BI Service for this tutorial.</p><h4>Add a Streaming Dataset</h4><p>Now we can go ahead and create our Streaming dataset. First, click on <strong>My Workspace</strong> on the Home page, and create a new <strong>Dashboard</strong>.</p><p>Name your new dashboard <strong>PubNub Sensor Cluster</strong>.</p><figure><img alt="Create a new dashboard in Power BI." src="https://cdn-images-1.medium.com/max/1024/1*cPPobv4hvEwz16IlEfU3OQ.png" /><figcaption>Create a new dashboard in Power BI. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>After your dashboard has been created successfully, you should see an empty canvas where we can design our streaming dashboard. So let’s add a tile.</p><p>Go ahead and click on the <strong>Edit button </strong>in the toolbar and <strong>add a tile</strong>.</p><p>On the right pane that appears, we can choose the source of our streaming data. Select <strong>Custom Streaming Data </strong>and click <strong>Next</strong>.</p><p>Proceed to <strong>add a Streaming dataset</strong>.</p><figure><img alt="Select Custom Streaming Data source." src="https://cdn-images-1.medium.com/max/1024/1*pY1LA0obXG-8bCwLRIoAQA.png" /><figcaption>Select Custom Streaming Data source. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Select <strong>PubNub </strong>as our data source and click <strong>Next</strong>.</p><p>This will tell Power BI you want to read data from an existing PubNub stream.</p><p>Note that PubNub is not pushing data to the Power BI service — We are merely reading data from PubNub’s API.</p><figure><img alt="PubNub streaming data sources." src="https://cdn-images-1.medium.com/max/1024/1*ltsbfxDlWQ3936yH1Ekfkw.png" /><figcaption>PubNub streaming data sources. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Fill in the following fields:</p><ol><li>Dataset name: <strong>PubNub Sensor Network</strong></li><li>Sub-key: <strong>mspowerbi</strong></li><li>Channel name: <strong>sensor-network</strong></li><li>You can leave the PAM Auth Key field blank.</li></ol><p>After clicking Next, you will see the schema and column names of the PubNub Sensor Network dataset, followed by the data structure in a JSON format. This contains the data that will be processed by Power BI.</p><p>Go ahead and click on the <strong>Create button </strong>to finish creating your first Streaming dataset.</p><p>Now you will be taken back to the dashboard canvas.</p><p>Click on the <strong>Edit button</strong> again and <strong>add a tile</strong>.</p><p>Select <strong>Custom Streaming Data</strong>, and you will see the dataset you just created available as an option for creating dashboard tiles.</p><figure><img alt="PubNub data structure in JSON format." src="https://cdn-images-1.medium.com/max/1024/1*bpY2-biNSp2id5bMwLO1HQ.png" /><figcaption>PubNub Sensor Network data structure in JSON format. Image by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h4>Design the Streaming Dashboard</h4><p>That was easy, now all that’s left to do is to design our dashboard by adding tiles.</p><p>Use the dataset you created earlier to create a <strong>Card visual </strong>with the following information:</p><ul><li>Fields: <strong>Chennai.noise</strong></li><li>Value Decimal Places: <strong>1</strong></li><li>Title: <strong>Noise in Chennai</strong></li><li>Subtitle: <strong>in Decibels</strong></li></ul><p>You should end up with a data card like the one below, where data is streaming in real-time to your dashboard from the PubNub API.</p><figure><img alt="Noise in Chennai (Card visual)." src="https://cdn-images-1.medium.com/max/480/1*GB_UtqovXfrZSStYx4sx3A.gif" /><figcaption>Noise in Chennai (Card visual). Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Repeat the above steps, for Novato, Redmond, and San Francisco.</p><p>When you’re done, your dashboard should have separate cards displaying noise volumes from 4 different countries.</p><figure><img alt="Noise levels in different countries." src="https://cdn-images-1.medium.com/max/480/1*aHeZF1AGrDeW79_xUAaAQg.gif" /><figcaption>Noise levels in different countries. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Next, create a <strong>Gauge visual</strong> with the following information:</p><ul><li>Value: <strong>Honolulu.noise</strong></li><li>Minimum Value: <strong>Novato.noise</strong></li><li>Maximum Value: <strong>Chennai.noise</strong></li><li>Title: <strong>Honolulu Noise</strong></li><li>Subtitle: <strong>Relative to Novato and Chennai</strong></li></ul><p>Then, proceed to create a <strong>Clustered</strong> <strong>Column Chart visual</strong>.</p><ul><li>Values: Select all the columns suffixed with <strong>temperature.C</strong>. This will add each country’s temperature in celsius to the visual.</li><li>Title: <strong>Temperature by Country</strong></li><li>Subtitle: <strong>in Celsius</strong></li></ul><p>Mouse over to the little arrow located at the bottom right of the clustered column chart.</p><p>Click and drag the arrow to control the size of the clustered column chart visual.</p><p>Resize the visual such that the entire legend is visible.</p><figure><img alt="Dashboard with Gauge and Clustered Column Chart visual." src="https://cdn-images-1.medium.com/max/480/1*L-OyCnEUxWrCL9pxEeac8Q.gif" /><figcaption>Dashboard with Gauge and Clustered Column Chart visual. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><p>Lastly, create a <strong>Line Chart visual</strong>.</p><ul><li>Axis: <strong>timestamp</strong></li><li>Values: Select Redmond and San Francisco columns suffixed with <strong>humidity</strong></li><li>Title: <strong>Redmond vs. San Francisco</strong></li><li>Subtitle: <strong>Humidity %</strong></li></ul><p>Resize the visual as shown below:</p><figure><img alt="Final Dashboard with Line Chart visual." src="https://cdn-images-1.medium.com/max/480/1*3dLIyHOuvXkwnMbzz52udQ.gif" /><figcaption>Final Dashboard with Line Chart visual. Gif by <a href="https://natworkeffects.medium.com/">author</a>.</figcaption></figure><h3>Use Cases and Real-Life Scenarios</h3><p>The most powerful advantage of having a Streaming dataset is its extremely low latency.</p><p>However, because of the limitations of a Streaming dataset, i.e. lack of filters, tooltips, drill-through etc, you should only consider implementing such a solution if your business wants to track critical events that need to be resolved as soon as it is detected, without performing complex calculations on the data.</p><p>Examples of real-life scenarios include, but are not limited to:</p><ol><li>Site Reliability Engineering — Deliver a smooth user experience by monitoring response times and fixing slow-loading pages. Also, prevent downtime for web and mobile apps by responding to an overload of requests on the server.</li><li>IoT Sensor Ingestion — Measuring number of people in a given area to facilitate resource planning, and come up with measures to prevent overcrowding, such as on public transport.</li><li>Fleet Maintenance — Reacting quickly to autonomous vehicle breakdowns, e.g. delivery vehicles, electric cars etc, to build a robust supply chain, and ensure high quality of customer service.</li><li>Critical Machines — Servicing machine faults with speed, e.g. factory machines, to ensure high production quality.</li><li>Data Centre Operations — Maintenance of data centre machines, to ensure they deliver on-demand provisioning of IaaS and PaaS services, and that they meet pre-defined customer SLAs.</li><li>Financial Trading — View securities data in real-time for finance professionals to make buy / sell decisions.</li></ol><h3>Conclusion</h3><h4>Streaming Technology Services</h4><p>Streaming technologies have evolved significantly over the course of the past decade. A dashboard like this would have been difficult to build and maintain a few years ago without the help of an experienced developer.</p><p>However, there are now many emerging services that empower everyone to build streaming applications with ease.</p><p>As you can see, business users are now empowered to build streaming dashboards on their own with a few simple clicks of a button, without much system administration and maintenance.</p><p>The demo used in this article was originally written by PubNub on their official website, so I strongly encourage you to check out their article as well for reference.</p><p><a href="https://www.pubnub.com/blog/microsoft-power-bi-streaming-business-data-to-dashboards/">Create Realtime Dashboards with Microsoft Power BI | PubNub</a></p><h4>PubNub Sample Data Streams</h4><p>We have just explored one of the many data streams PubNub provides. If you’re excited by the prospect of building more applications with streaming technology, explore PubNub’s APIs on their website today.</p><p><a href="https://www.pubnub.com/developers/realtime-data-streams/">Realtime Data Streams Examples | PubNub</a></p><p>Datasets range from Twitter interactions to Stock Market data, to Wikipedia articles, so feel free to get your hands dirty and build your next project with one of PubNub’s data streams.</p><p>Until then, I’ll see you in <a href="https://towardsdatascience.com/minimum-viable-streaming-dashboard-in-power-bi-part-2-b902cd25c8">Part 2</a> where we discuss Push datasets, how to push data to the Power BI REST API.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56e00a82c22f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/minimum-viable-streaming-dashboard-in-power-bi-part-1-56e00a82c22f">Minimum Viable Streaming Dashboard in Power BI: Part 1</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Analyst Graveyard — The Valley of Death and Despair]]></title>
            <link>https://medium.com/data-science/data-analyst-graveyard-the-valley-of-death-and-despair-8eaaf520f574?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eaaf520f574</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[business]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Sun, 04 Oct 2020 05:03:42 GMT</pubDate>
            <atom:updated>2022-09-11T09:48:27.475Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Analyst Graveyard — The Valley of Death and Despair</h3><h4>A piece featuring why work as a data analyst can lose its meaning.</h4><figure><img alt="Grave of Data Analysts." src="https://cdn-images-1.medium.com/max/1024/1*UiuNiNmFPMiV8a-e-f4PRQ.jpeg" /><figcaption>Grave of Data Analysts. Photo by <a href="https://unsplash.com/@greyharpoon?utm_source=medium&amp;utm_medium=referral">Kenny Orr </a>from <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><p>In my recent post, <a href="https://medium.com/swlh/data-analyst-primer-the-essential-guide-26bd7e9c2297"><em>Data Analyst Primer</em></a>, I elaborated on how demand for data analysts is growing and highlighted the steps you can take to get a foot in the door, and land that first entry-level job.</p><p>The purpose of today’s article is to offer a different perspective, a pessimistic view discussing why work as a data analyst can feel meaningless.</p><p>Often, expectations of a dream job deceive us. There are plenty of unpleasant responsibilities analysts have to carry on their backs, that separate what appears to be an ideal career, from the actual reality of the situation.</p><h3>The Dunning-Kruger Effect for Data Analysts</h3><blockquote>Unskilled and unaware: Difficulties in recognizing one’s own incompetence lead to inflated self-assessments.</blockquote><figure><img alt="Graph of Dunning-Kruger Effect." src="https://cdn-images-1.medium.com/max/1024/1*tcMJx2anYVGsBM6GXQij1Q.png" /><figcaption>Graph of Dunning-Kruger Effect. Image by <a href="https://natworkeffects.medium.com/">Author</a>.</figcaption></figure><p>As with any shiny new skill or passion that excites you, it proves easy to feel confident about a topic by Googling and doing extensive research online. New analysts run into this problem where they have sky-high expectations of the value they can contribute within the organization.</p><p>This is but another instance of the Dunning-Kruger effect; <strong>Lack of work experience leads to overconfidence in one’s own ability to make an impact.</strong></p><h4>The Valley of Despair</h4><p>After diving headfirst and gaining on-the-job experience, do they begin to understand it’s not all rainbows and sunshine. Countless obstacles arise; Endless data requests, lack of analytical rigor, non-technical managers, you name it.</p><p>New analysts fall into the valley of despair due to crushed expectations, unable to climb the slope of enlightenment. A feeling of dread starts to set in. And then you wonder whether this is the right career for you after all.</p><figure><img alt="Descending into the Valley of Despair." src="https://cdn-images-1.medium.com/max/1024/1*1kLNcSoJfjQBOtHJ3ftoPA.jpeg" /><figcaption>Descending into the Valley of Despair. Photo by <a href="https://unsplash.com/@jaibanez?utm_source=medium&amp;utm_medium=referral">Jorge Ibanez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><p>You’re not alone. Being an analyst can be a hard and unfulfilling job, often a junior role without much autonomy where you work for 1–2 years before moving on to something better.</p><p>No job is without its ups and downs, and being a data analyst is no different. <strong>There will be things you love, and things that make you wonder… Why am I here?</strong></p><h3>Organization Hierarchy</h3><p>First things first, you have to understand your place in the world to get a handle of why these issues occur.</p><p>The root cause of unfulfilling work in technology is often, <strong>a case of misaligned career goals.</strong> Join the wrong team that doesn’t provide the growth you desire, and you will feel your career stagnating, with the loss of purpose coming soon after.</p><p>Your responsibilities as an analyst will vary depending on, <strong><em>(a)</em></strong> whether the data team is centralized/decentralized <em>&lt;y-axis&gt;</em>, and<em> </em><strong><em>(b)</em></strong> what competencies your team/manager prioritizes <em>&lt;x-axis&gt;.</em></p><figure><img alt="Data Analysts — Four Quadrants." src="https://cdn-images-1.medium.com/max/1024/1*3R3Nio56oIXqD_J4V06sIA.jpeg" /><figcaption>Data Analysts — Four Quadrants. Image by <a href="https://natworkeffects.medium.com/">Author</a>.</figcaption></figure><p>The segments are not mutually exclusive, so you may find yourself, for example, holding responsibilities of both an analytics engineer and an XFN support analyst. Choosing a position that is a bad fit for your career aspirations and skill development, means extra pain in your time at the company.</p><h4>Cross-Functional (XFN) Support Analysts — Centralized Support Staff</h4><p>Centralized data teams hire analysts to act as centralized resources. Analysts work cross-functionally across functional departments or product teams as support staff.</p><p>This is by far the most common hire in companies looking to invest in data analytics. Not surprising given that it is the most cost-effective option, especially if the data team has yet to prove its value at discovering insights for the business.</p><p>The idea is to hire one or more analysts to take requests from multiple teams simultaneously, illustrated below:</p><figure><img alt="Cross-Functional (XNF) Support Analysts." src="https://cdn-images-1.medium.com/max/1024/1*FWSA0AzPPGs9yKEbxgvHWA.jpeg" /><figcaption>Cross-Functional (XFN) Support Analysts. Image by <a href="https://natworkeffects.medium.com/">Author</a>.</figcaption></figure><p>Centralized data teams have full control and governance over their analysts, but distribute them to other teams within the organization. Therefore, these analysts report directly to an analytics manager, and at the same time, have dotted reporting lines to members of other teams they support.</p><p>Some companies rotate their analysts between teams so work doesn’t get stale, while bigger companies with more analyst resources will offer less mobility between business functions.</p><p>Competencies prioritized comprise soft skills such as <strong><em>Influence, Storytelling, Communication, and Data Visualization.</em></strong></p><p>Technical skills such as statistical knowledge and programming are important, in so far that they help to achieve specific business goals, for example, finding levers to pull to increase revenue by xx%.</p><p><strong>Analysts who Excel as XFN Support Analysts:</strong></p><p>Have a blend of business and technical skills but not sure where to take your career? This is the perfect role for you to find out. XFN support analysts get to satiate their curiosity analyzing data for various teams.</p><p>Crunching data for business leaders and soaking up their knowledge of a specific domain, is a good stepping stone for you to figure out which areas of the business you want to specialize in.</p><p>On the flipside, you may decide after exploring you prefer to develop your technical skills instead. Because you report directly to an analytics manager, there is opportunity to obtain exposure to develop technical skills and become a senior data analyst, mentoring other juniors.</p><p>In terms of flexibility, this role is the best bet for your career. It allows the freedom of exploration without pigeonholing yourself into a certain career track too soon.</p><p><strong>Scenarios that Cause XFN Support Analysts to Lose Sense of Purpose:</strong></p><ol><li><strong>Weak domain knowledge.</strong> Analyst intuition about a problem helps one find the signal in a messy sea of data. However, chances are your intuition is likely less developed than functional leaders and any recommendations or insights will be questioned and rejected. The analyst ultimately ends up answering questions posed by the business user. And the analyst ends up becoming a reporting monkey <strong><em>(See point 2)</em></strong>.</li><li><strong>Reporting Monkey.</strong> Reporting monkeys respond to data requests, write queries, and build dashboards for less technical business users. They hold zero ownership over KPIs and how parts of the business are run, and simply change SQL or programming logic to answer the questions that another department has thrown at them, on-demand.</li><li><strong>Lack of analytical rigor.</strong> Businesses prioritize moving fast and taking action. As a result, you will have to inevitably, simplify statistical concepts for business users to understand and accept your analysis. The more complex the analysis, even if perfectly sound and scientifically accurate, will likely get tossed aside as an archived recommendation, which can be painful to accept for some.</li><li><strong>Non-Technical Stakeholders.</strong> When business leaders demand dashboards to be refreshed, or a number is incorrect because of a change in business logic, analysts have to fight fires, manually force refreshes that were automated, and serve as IT support, completely at the whim of the business leader. The exception is product managers who are often more adept with technology and understand the limitations of batch and real-time data pipelines.</li><li><strong>Technical skill stagnation.</strong> XFN support analysts who want to grow in technical leadership care about doing things efficiently with technology. Examples include writing performant SQL, version control, and working with various tools and databases. As a young analyst, you may or may not get the chance to do so if you work for an analytics manager that has no regard for your technical skill development.</li></ol><h4>Functional Analysts — Working Directly Under Business Leaders</h4><p>Data analysts not hired on a centralized data team report directly to functional department heads. Functional department heads or product managers have free reign to hire their own analysts and assume full responsibility for their development, visualized below:</p><figure><img alt="Functional Analyst Organizational Diagram." src="https://cdn-images-1.medium.com/max/1024/1*bgpyYXskoLs3hyHuqBjqXw.jpeg" /><figcaption>Functional Analyst Organizational Diagram. Image by <a href="https://natworkeffects.medium.com/">Author.</a></figcaption></figure><p>If you find yourself wanting to develop technical skills, and work with new tools and technologies often, <strong>LEAVE. IMMEDIATELY.</strong> An analyst in a role like this who has the desire to grow their technical skills will experience all the pain of XFN support analysts, and more.</p><p>Technical expertise is not emphasized in these roles, rather the motto is to move fast and find insights that create the biggest wins for the business.</p><p>Competencies prioritized in roles like these are soft skills similar to XFN support analysts, but technical knowledge can take a back seat.</p><p>As a result, the technical skill bar for hiring is lower than that of an XFN support analyst. Functional analysts are expected to be subject matter experts in the respective business function or product team that has hired them.</p><p><strong>Analysts who Excel as Functional Analysts:</strong></p><p>Functional analysts are experts in their domain. They hail from a variety of backgrounds, and have honed their intuition in their domain of choice, knowing where to look for insight in a messy sea of data.</p><p>If you are skilled in the art of persuasion and simplifying complex problems using common structured frameworks <strong><em>(80/20 Principle, Four Quadrants, Formulas, Venn Diagrams)</em></strong>, you will feel right at home in this role.</p><p>Functional analysts are more akin to artists than scientists. They have a knack for predicting what their respective managers will find interesting in the data, and will take action on. They can be very persuasive, making complicated concepts digestible to the everyday business leader.</p><p>They also have a set of skills specific to their domain that makes them more effective at getting up to speed and driving business impact. For example, marketing analysts would have a niche understanding of SEM, the Google Analytics platform, and knowledge of the common KPIs tracked by marketing teams.</p><p><strong>Scenarios that Cause Functional Analysts to Lose Sense of Purpose:</strong></p><p>For the sake of not repeating myself, I’m going to assume that if you land this position, you are looking to hone your skills in thinking about business and have a sharp commercial mindset.</p><p>Again, if you have the ambition to grow your technical skills, leave immediately.</p><ol><li><strong>Centralized Functional Analysts</strong>. To be cost-effective, organizations have the option to hire analysts for one business function <strong><em>(such as operations)</em></strong> and operate like a centralized data team described in the previous section. The functional analysts then take on the responsibility of supporting other business functions simultaneously. In these scenarios, functional analysts will experience <strong>points 1, 3, 4 that XFN support analysts experience.</strong></li><li><strong>Analysis Paralysis</strong>. To functional analysts, data is not a way to fully explore a problem space, but simply a way to tell a story and check their intuition. This is not necessarily a bad thing. Due to time constraints, it is not practical to check every single column for insights and confounding effects. The problem arises when the analyst’s intuition veers so far away from their manager’s intuition such that the entire analysis needs to be revisited, leading to multiple rounds of rework. This can lead to analysis paralysis, especially if the analyst is doing research for long-term strategic planning.</li></ol><h4>Analytics Engineer — Centralized Technical Experts</h4><p>Data analysts working on a centralized team focused on technical expertise come in when there is a need for a more controlled environment for doing data analytics.</p><p>Analytics engineers introduce tools, technologies, and code practices <strong><em>(Data Pipeline Testing, Table Naming Conventions, Code Reviews)</em></strong> that make other analysts more efficient, and their output trustworthy. These roles are few and far between, however, only recently emerging as a result of Fishtown Analytics’ revolutionary open source tool <a href="https://blog.getdbt.com/what-is-an-analytics-engineer/"><strong>dbt</strong></a>.</p><p>Competencies prioritized include <strong><em>dbt, Gitlab, advanced SQL knowledge, Python, Airflow, Fivetran, Stitch, ETL.</em></strong></p><p>If you find yourself bored in such a role, and want to work more closely with the business, you can move to become an analytics manager or going back to being an analyst supporting business functions.</p><p><strong>Analysts who Excel as Analytics Engineers:</strong></p><p>If you have a knack for seeing ways to make analyst workflows more efficient and care about concepts like automation, version control, and good documentation, you will excel in such a role.</p><p>Analytics engineers usually desire to grow into strong technical leaders and enjoy working with new innovative tools and technologies, without as much focus on the bottom line of the business.</p><p><strong>Scenarios that Cause Analytics Engineers to Lose Sense of Purpose:</strong></p><ol><li><strong>Lack of business impact.</strong> The value of analytics engineers in an organization is that they make other analysts around them better and more efficient at their job. This can result in them getting so far removed from the business, that their work can lack purpose and meaning on business KPIs.</li><li><strong>No recognition from business stakeholders.</strong> Business leaders often don’t see the direct output of analytics engineers, as they are not the ones doing analysis deep dives into business problems. This can make it seem like analytics engineers don’t add any value to the company, where other analysts get all the credit, while analytics engineers work quietly in the background.</li></ol><h3>Data Analysts don’t have any autonomy within the organization.</h3><figure><img alt="Data Analyst Lack of Autonomy" src="https://cdn-images-1.medium.com/max/1024/1*3HVku8ChIv-KLJWcDcpRYw.jpeg" /><figcaption>Data Analyst Lack of Autonomy. Photo by <a href="https://unsplash.com/@noahbuscher?utm_source=medium&amp;utm_medium=referral">Noah Buscher</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><p>There is one similarity that is common between all the roles described above, a lack of autonomy.</p><p>Data analysts rarely get to lead data-driven change, and are merely building analysis and dashboards that someone else decided was compulsory.</p><blockquote><em>The most soul-sucking act a data analyst can commit, is building analysis and reporting completely at the whim of a higher authority.</em></blockquote><p>Analysts are basically direct support staff to someone in a higher position of power. As a result, they have no decision-making authority or ownership over KPIs of the business functions they support, endlessly responding to user or managerial requests.</p><p>Furthermore, you have no say as to whether your analysis gets used or acted on. Researching answers to questions someone else has asked for simply to satisfy another person’s curiosity, is probably the most soulless act an analyst can commit.</p><p>This is the reason why analysts are usually hired in junior positions, requiring <strong>only 1–2 years of experience. </strong>It is easier to mold someone fresh out of school and groom them into your version of an ideal analyst.</p><h3>Avoiding Scenarios That Cause Loss of Purpose</h3><figure><img alt="Data Analyst Loss of Purpose." src="https://cdn-images-1.medium.com/max/1024/0*pobxxYX--erUFnp-" /><figcaption>Data Analyst Loss of Purpose. Photo by <a href="https://unsplash.com/@roadtripwithraj?utm_source=medium&amp;utm_medium=referral">Road Trip with Raj</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><p>Despite being armed with this knowledge, we cannot avoid all the scenarios described above. What we can do is <strong>minimize nightmare scenarios </strong>by not taking on a role that is misaligned with our career growth expectations.</p><p>If you are not sure where to go, work cross-functionally under an experienced analytics leader that cares about your success.</p><p>Interested in a particular function of the business? Look for business leaders you respect and shadow them as a functional analyst.</p><p>Or if you simply love technology, then analytics engineering is the career path for you.</p><p>Before you join any organization, do some research, and ask key questions during the interview stage that give you insight into the managers and colleagues you will be working with/supporting, and the skills you can pick up along the way. Make sure they align with your career growth expectations.</p><ul><li><em>What skills are prioritized in this role?</em></li><li><em>Which functional teams will I be working with / supporting?</em></li><li><em>What does the data team structure look like?</em></li><li><em>Who are my managers and stakeholders?</em></li></ul><p>You will find that companies utilize a mix of the structures we have discussed when looking to implement a data strategy.</p><p>Know who you report to, the stakeholders you serve, and who you can learn from before saying yes to a company. If the company cannot provide the growth you desire, you will be miserable and the nightmares will never seem to end.</p><h3>The Light at the End of the Tunnel</h3><p>All hope is not lost, however. If you stick it out for a few years, you can move into a more senior position, where you have the responsibility to oversee other analysts, own entire parts of the data platform, or be in charge of specific business KPIs if you become a business manager/leader.</p><p>In these roles, there is room for you to champion your ideas and hold leverage in the organization to change things for the better, how you see fit.</p><p>After working for a few years, junior analysts come to terms with reality, learn to compromise, and just like Dunning-Kruger, can rise up from the valley of despair and stand on the beautiful plateau overlooking the horizon.</p><figure><img alt="Plateau Overlooking the Horizon." src="https://cdn-images-1.medium.com/max/800/1*d7hsCyIx9l3POg6Vnz2etQ.jpeg" /><figcaption>Plateau Overlooking the Horizon. Photo by <a href="https://unsplash.com/@pascale_amez?utm_source=medium&amp;utm_medium=referral">Pascale Amez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eaaf520f574" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/data-analyst-graveyard-the-valley-of-death-and-despair-8eaaf520f574">Data Analyst Graveyard — The Valley of Death and Despair</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Analyst Primer: The Essential Guide]]></title>
            <link>https://medium.com/swlh/data-analyst-primer-the-essential-guide-26bd7e9c2297?source=rss-9dbd159f0e0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/26bd7e9c2297</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <dc:creator><![CDATA[Nathan Cheng]]></dc:creator>
            <pubDate>Thu, 27 Aug 2020 15:33:30 GMT</pubDate>
            <atom:updated>2021-01-27T09:33:42.697Z</atom:updated>
            <content:encoded><![CDATA[<h4>An essentials guide for aspiring data analysts, priming you with the key skills you need to know to become one.</h4><figure><img alt="Data Analyst Summer Internship" src="https://cdn-images-1.medium.com/max/1024/0*63LhRCC0xf9JbgTH" /><figcaption>Data Analyst Summer Internship. Photo by <a href="https://unsplash.com/@ethanrobertson?utm_source=medium&amp;utm_medium=referral">Ethan Robertson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><p>Back in the summer of 2018, I was just starting my first internship as a <strong>Data Analyst</strong>.</p><p>Data science was all the rage back then, with the data scientist being heralded the sexiest job of the 21st century. I remember reading articles featuring the famous Venn diagram that described what a data scientist was.</p><p>In hindsight, the Venn Diagram wasn’t very descriptive, but it provided a starting point to pick up the tools and knowledge that would eventually help me launch my career as a data analyst.</p><figure><img alt="Data Science Venn Diagram." src="https://cdn-images-1.medium.com/max/993/1*jd_xgOzAFw7rBklREtgOTQ.png" /><figcaption>Data Science Venn Diagram.</figcaption></figure><p>After fumbling around with a bunch of different tools, working multiple stints in MNCs and startups over the years, I’ve developed a pretty good idea of the key skills and competencies companies look out for in data analysts. And so, this guide is designed to prime you with the bare essentials, and hopefully allow you to get your foot into the world of data, and land that first entry-level data analyst job.</p><p>Before that, let’s first cover some major shifts in computing that are important for an aspiring data analyst to know if they plan on jumping into the field.</p><h3><strong>The Rise of Cloud Services and Serverless Computing</strong></h3><p>With the advent of cloud services and growth of new support and tooling for data practitioners, the barriers to entry to access data have reduced significantly.</p><p>Collecting, storing, and disseminating data to others within the organization is now cheap and frictionless.</p><figure><img alt="Big 3 Cloud Computing Providers." src="https://cdn-images-1.medium.com/max/1024/1*PEN4-vG-hZdMqMS9deT8HA.png" /><figcaption>Big 3 Cloud Computing Providers.</figcaption></figure><p>Companies are hosting computing workloads on GCP, AWS and Azure, so their data engineers can focus on building data pipelines that pipe data into a centralized data warehouse, instead of worrying about maintaining servers and hardware upgrades.</p><p>In today’s age, it is trivial to spin up a cluster of nodes in a remote data centre, and let your cloud provider manage the allocation of machine resources.</p><p>We call this shift towards a new model of building applications <strong>Serverless Computing</strong>, rendering the days of building an on-premise data centre feel like a distant dream.</p><h3><strong>Democratizing Data Access for Data Analysts</strong></h3><p>Frictionless data access means that now more than ever, organizations are finding it easy to build data science departments to take advantage of data assets, and are hiring analysts to crunch data, in the hopes that they will discover insights.</p><p>With this in mind, the goal of this article is to help you take advantage of this rising demand, and start your journey as an aspiring data analyst.</p><p>So what exactly do data analysts do? And what are the most important skills to start learning right now to get started on your journey?</p><h3><strong>What to Expect as a Data Analyst</strong></h3><p>Among the different roles in data science, the data analyst has by far the simplest learning curve.</p><p>You don’t have to code as much as a data engineer, nor do you have to know statistics well enough to the point of being a data scientist or machine learning engineer.</p><p>Referring to the data science hierarchy of needs below, you can see the data engineer is usually the person responsible for building data pipelines that move data from databases into a centralized data store called a data warehouse.</p><p>This is essentially the collect and move / store layers in the pyramid.</p><figure><img alt="Data Science Hierarchy of Needs." src="https://cdn-images-1.medium.com/max/1024/1*ELqY7hHjMpOPPiS2SqsmwA.png" /><figcaption>Data Science Hierarchy of Needs.</figcaption></figure><p>The data is then further transformed by data analysts to discover insights that are used by business users to influence decision-making.</p><p>Analysis can be presented in the form of a dashboard, a slide deck, or whatever tool is best suited to present insights and recommendations.</p><p>To illustrate this further, here are common descriptions curated from data analyst job descriptions on Linkedin:</p><ol><li>Strong analytical skills with the ability to collect, organize, analyze, and disseminate significant amounts of information with attention to detail and accuracy.</li><li>Experience partnering with business and using data to influence stakeholders and provide actionable recommendations.</li><li>Ability to conduct rigorous analysis and communicate conclusions to both technical and non-technical audiences.</li><li>Proficiency in SQL with experience in querying large, complex data sets. Strong Excel skills, Python and R.</li><li>Proficiency in Tableau, or similar data visualization tools is a plus.</li></ol><p>In summary, data analysts work closely with business users to make sure they are satisfied with the insights generated from the data.</p><p>They are also the ones responsible for ensuring the analysis is accurate, communicated clearly, and stored in an accessible place business users can refer to.</p><h3>Essential Skills and The Learning Journey</h3><p>So now, knowing what value a data analyst brings to an organization, let us move on to the required skills necessary to become one.</p><p><strong>I have condensed this down to 5 key points</strong>, and will not cover Microsoft Excel as I am assuming anyone who is interested to become a data analyst will already have the basic knowledge to crunch data using standard Excel functions.</p><p>I will also not be covering soft skills like stakeholder management and communication, although do note <strong>the</strong> <strong>effectiveness of a data analyst’s output is highly correlated with your stakeholder’s ability to understand it.</strong></p><p>Therefore, data analysts have to be clear communicators, presenting their thoughts in a persuasive manner, in order to effectively influence stakeholders to take the correct course of action.</p><h4><strong>1. Master SQL</strong></h4><p>SQL will be the most helpful language you learn in your journey as a data analyst.</p><p>SQL is human-readable, and <strong>declarative</strong>, meaning that you do not have to tell the SQL query engine the exact steps to execute the query to pull data. The engine has free reign to explore and figure out the most efficient method to return the output back to you.</p><p>Contrast this with a procedural programming language like Python, where you, the programmer, will have to tell the program in what order to execute the data transformation steps to get the output you want. This is why SQL is not considered a traditional programming language by many.</p><p>Aside from its declarative nature, there is also increasing support for SQL in big data tools. SQL abstraction layers have been built on top of Big Data processing frameworks such as HiveQL and SparkSQL.</p><figure><img alt="SparkSQL." src="https://cdn-images-1.medium.com/max/1024/1*P4TX_a4PL1VtLTH5WZZaFg.jpeg" /><figcaption>SparkSQL.</figcaption></figure><p>This means you can utilize the same SQL knowledge and tap on powerful big data processing frameworks at your disposal, in the event you run into limitations with your current data processing engine, which eliminates the need to learn a new language from scratch.</p><p>The SQL language has been relevant for over 40 years, and will continue to be the primary way data analysts query data for the foreseeable future. In that regard, it provides the best return on investment in your career.</p><h4><strong>2. Pick up a programming language. (I recommend Python)</strong></h4><p>Although not compulsory for entry-level data analyst jobs, I highly recommend data analysts to pick up a programming language and learn the basics of data structures and algorithms.</p><p>It is inevitable at some point in your career, you will reach the limits of what you can do with SQL and need a programing language to help you interact with APIs to pull data, automate A/B tests, or conduct sentiment analysis.</p><p>A programming language adds an essential tool in your arsenal that provides flexible options for manipulating and creating value with data.</p><p>If you are language agnostic, Python is a great language to start with. Many popular data science libraries such as numpy and pandas are written in Python, and there is increasing support for Python in big data processing frameworks such as PySpark.</p><p>Python also has a syntax that is easy to comprehend for someone new to programming.</p><figure><img alt="Python Data Science Libraries 2020." src="https://cdn-images-1.medium.com/max/980/1*bKrQtp_q8HSwTMazxsmgfg.png" /><figcaption>Python Data Science Libraries 2020.</figcaption></figure><h4><strong>3. Learn a tool for data visualization.</strong></h4><p>Visualization tools enable data analysts to disseminate their findings in the form of automated dashboards to business users, with an intuitive drag-and-drop interface that allows less technical folks slice and dice data.</p><p>Tools like Tableau, PowerBI, and Looker are ubiquitous in organizations.</p><p>While these tools provide similar features across the board, there are minor nuances when comparing different tools. The good news is that learning one will allow you to transfer the knowledge you have obtained to other tools.</p><p>Visualization tools are relatively intuitive to learn compared to SQL or Python, so pick one and roll with it. Tableau and Looker are both good choices with widespread adoption in many organizations.</p><figure><img alt="Popular Data Visualization Tools." src="https://cdn-images-1.medium.com/max/1024/1*ISNPLjmjTWBAN1tnaLkCBg.png" /><figcaption>Popular Data Visualization Tools.</figcaption></figure><h4><strong>4. Pick a problem space you are passionate about.</strong></h4><p>A lot of a data analyst’s day-to-day involves breaking down the business problem into a set of questions that can be answered using data.</p><p>The kinds of problems you face at an eCommerce company will be vastly different from those faced by a manufacturing company for example. <strong>In other words, being a good data analyst in an eCommerce company does not mean you’ll be able to come in and excel as a data analyst in a bank.</strong></p><p>Domain knowledge and expertise matters. I would argue it is just as important as your technical abilities because it allows you to narrow down the scope of data to analyze. Your experience will guide you to the best areas in the data to mine for insights, enabling you to be more efficient at your job.</p><p>If there is a certain problem space that compels you to explore the underlying dataset, go ahead and build an <strong>awesome personal project</strong> showing the insights and actionable recommendations you found for that particular domain.</p><p>You can then host your project on Github. Alternatively, Tableau also allows users to post their own data visualization project on their <a href="https://public.tableau.com/en-us/gallery/?tab=viz-of-the-day&amp;type=viz-of-the-day"><strong>site gallery</strong></a>.</p><figure><img alt="Github Logo." src="https://cdn-images-1.medium.com/max/807/1*O9pYXOq8roaoJsVzBdH_OQ.jpeg" /><figcaption>Github Logo.</figcaption></figure><p>This is the most effective way to land a job if you have no prior working experience, as it demonstrates initiative and skill to hiring managers and recruiters, and shows that you are passionate to make an impact in that particular industry or domain.</p><h4><strong>5. Revise basic statistical knowledge</strong></h4><p>Finally, a data analyst should have basic understanding of statistics, A/B testing, and online experiments.</p><p>Any company with a web or mobile app will definitely design experiments to validate whether new product features have improved metrics for the company, for example ARPU.</p><figure><img alt="Hypothesis Testing Visualization." src="https://cdn-images-1.medium.com/max/1024/1*vOZMC_MA9Vl-KnPP-1V4Xg.jpeg" /><figcaption>Hypothesis Testing Visualization.</figcaption></figure><p>Often, product managers will look to data analysts to help design such experiments. To do so, understanding hypothesis testing, significance levels, p-values, sample size, Type I / Type II errors, and the various factors that could invalidate your test results are essential.</p><p><a href="https://cxl.com/blog/ab-testing-guide/"><strong>Peep Laja</strong></a> has done an excellent primer on A/B testing that covers these topics in depth.</p><h3>Final Thoughts and Advice</h3><p>Phew, and that’s it! That was a lot to take in. With some tenacity and a bit of luck, you are well-equipped on your way to landing that first data analyst job in no time.</p><p>It must be mentioned that the world of data changes rapidly, with new tools coming out every few months. If you relish a challenge, data is an extremely dynamic field to build your career and I’m sure you won’t regret your decision.</p><p>Just remember, no one had it easy, and learning these things take time, so don’t try to learn everything at once, otherwise you’ll find yourself getting overwhelmed. Instead, focus on reaching proficiency with one or two tools first and build an awesome project with what you’ve learned.</p><p>Practice makes perfect, it is crucial to apply the skills you have learned to real-world problems to internalize how they work. Once you’ve reached proficiency with a programming language or a visualization tool, the next one becomes much easier to learn.</p><p>A piece of parting advice is to be flexible, keep an open mind, and experiment with new tools often to keep up with the pace of change in the data world. With that, I wish you all the best in your journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26bd7e9c2297" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/data-analyst-primer-the-essential-guide-26bd7e9c2297">Data Analyst Primer: The Essential Guide</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>