<?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[Total Brainstorming - Medium]]></title>
        <description><![CDATA[Developers.wtf community’s official publication to brainstorm thoughts and ideas into influencing words. - Medium]]></description>
        <link>https://medium.com/total-brainstorming?source=rss----a4ab22c1174b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Total Brainstorming - Medium</title>
            <link>https://medium.com/total-brainstorming?source=rss----a4ab22c1174b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 13:17:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/total-brainstorming" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[SQL runner query to Dashboard | Looker | Visualization]]></title>
            <link>https://medium.com/total-brainstorming/sql-runner-query-to-dashboard-looker-visualization-888f8f978956?source=rss----a4ab22c1174b---4</link>
            <guid isPermaLink="false">https://medium.com/p/888f8f978956</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[looker]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[looker-training]]></category>
            <dc:creator><![CDATA[Tincy Thomas]]></dc:creator>
            <pubDate>Sat, 08 Jul 2023 18:49:55 GMT</pubDate>
            <atom:updated>2023-07-08T18:33:03.292Z</atom:updated>
            <content:encoded><![CDATA[<h3>SQL runner query to Dashboard | Looker</h3><p>If you are on Google’s Looker and are you stuck on how to work on SQL, don’t worry you are at right place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0T3Bq8hOhrwwI2yxDLhKtg.jpeg" /></figure><p>SQL Runner provides a great way to directly access your database and leverage that access in a variety of ways. Using SQL Runner, you can easily navigate the tables in your schema, use an ad hoc Explore from a SQL query, run prewritten descriptive queries on your data, see your SQL Runner history, download results, share queries, add to a LookML Project as a derived table, perform other useful tasks and thus create beautiful visuals out of it.</p><h3>Adding a SQL Runner query to a LookML project</h3><p>SQL Runner is a great place to test SQL to use as a derived table in your LookML project. You can test it in SQL Runner, and then add it to your LookML project.</p><p>Once you have created a SQL query in SQL Runner, you can create a derived table from the query by using the <strong>Add to Project</strong> option or the <strong>Get Derived Table LookML</strong> option. Both of these options allow you to take a query in SQL Runner and add them to your LookML project. See the following sections for more information.</p><h3>Add to Project</h3><p>Using the <strong>Add to Project</strong> option is the easiest way to add a SQL Runner query to your project. The <strong>Add to Project</strong> option lets you select a LookML project, and then Looker automatically creates a view file with the query in your selected project. Select the project you want to add this derived table to.</p><p>Let the steps be clear here:</p><ol><li>Enter a view name for the derived table.</li><li>Click <strong>Add</strong> to add the query as a derived table in your project. Looker will switch to Development Mode if not already in it, create a new view file with the LookML from the SQL Runner query, and then open the file browser to see the newly added view file.</li><li>Move the file to suit your project’s file organization have the view files.</li><li>Validate the LookML and deploy your changes to production.</li></ol><p>*If you would prefer instead to manually create the view file and add the query’s LookML yourself, you can use the <strong>Get Derived Table LookML</strong> option.</p><h3>Get Derived Table LookML</h3><p>Another way to create a derived table from your SQL Runner query is to use the <strong>Get Derived Table LookML</strong> option from the SQL Runner gear menu. Just like with the <strong>Add to Project</strong> option, Looker will provide the LookML needed to make your SQL query into a derived table. From there, you can copy the LookML to paste into your project yourself, which is useful if you want to replace an existing derived table.</p><h3>Explore</h3><p>explore adds an existing view to Looker&#39;s menu of Explores as described on the LookML terms and concepts documentation page. As a best practice, an Explore should be defined inside of a model file.</p><p>Explores are typically named after an existing view. However, if you want to have multiple Explores based on the same view, you can add a from parameter to the Explore. In that case, the Explore can be given any valid name, which includes only lowercase letters (a-z), digits (0-9), and underscores. Just be careful as the explore needs to reference an existing view name. In Looker, your users can see Explores listed in the <strong>Explore</strong> menu. Explores are listed below the names of the models they belong to.</p><p>It’s possible to use explore by itself, without additional parameters. In practice, you typically see explore used with additional options. For example, it&#39;s very common to join additional views into an Explore.</p><h3>View</h3><p>A view declaration defines a list of fields (dimensions or measures) and their linkage to an underlying table or derived table. In LookML a view typically references an underlying database table, but it can also represent a derived table.</p><p>A view may join to other views. The relationship between views is typically defined as part of an Explore declaration in a model file.</p><blockquote>Not all views are Explores, because not all views describe an entity of interest.</blockquote><h3>Create a Look report using the modelled query</h3><p>In this task, you will build a Look report using the modelled query.</p><ol><li>Open a new Looker window in a new tab.</li><li>On the left side navigation menu of the Looker User Interface, click <strong>Explore</strong>.</li><li>In the <strong>Data</strong> pane, click on the settings icon on column name.</li><li>Expand <strong>Visualization</strong> pane and choose a chart.</li><li>Click on the settings icon in the <strong>Visualization</strong> pane to play around with.</li><li>Click on settings icon next to Run (top right of page), and select <strong>Save as a Look</strong>.</li><li>Enter a title for the Look report. Chose the <strong>Shared</strong> folder to save the report.</li><li>Click <strong>Save</strong>.</li><li>Open a new Looker window in a new tab. Click <strong>Shared folders</strong>.</li><li>Click the Look report and review the data and visualization</li></ol><p>Cheers, you made it thus far!</p><p>And, we made it to a look which could now be saved to a new dashboard or an existing one.</p><p>Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=888f8f978956" width="1" height="1" alt=""><hr><p><a href="https://medium.com/total-brainstorming/sql-runner-query-to-dashboard-looker-visualization-888f8f978956">SQL runner query to Dashboard | Looker | Visualization</a> was originally published in <a href="https://medium.com/total-brainstorming">Total Brainstorming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting to know FastAPI]]></title>
            <link>https://medium.com/total-brainstorming/getting-to-know-fastapi-7fb4791d3e50?source=rss----a4ab22c1174b---4</link>
            <guid isPermaLink="false">https://medium.com/p/7fb4791d3e50</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[textblob]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <dc:creator><![CDATA[Aditya Vishnu]]></dc:creator>
            <pubDate>Thu, 17 Feb 2022 11:05:02 GMT</pubDate>
            <atom:updated>2022-02-17T11:01:59.912Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>In this article you will get to know a novel method of constructing APIs with Python using FastAPI. It is a powerful, high-performance, Python type hint based web framework.</p><p>If you ask why FastAPI, I would say it is very clean, well documented and easy to understand framework than its predecessors. It will improve your coding speed tremendously. Also you can access the automatic interactive API documentation either on Swagger UI or on ReDoc UI.</p><p>We will see the rest of the features on the go.</p><p>In the end we will also see how to build an application with FastAPI that can predict what people thinks about something based on sentiment analysis done on tweets from Twitter.</p><p>For this we are using Twitter API to extract tweets based on user input. Then we analyze each tweet using TextBlob (a library in Python for sentiment analysis). Bases on the analysis TextBlob returns a polarity for each tweet, which we can use to classify tweets as either positive, neutral or negative. Finally the total percentage of positive, neutral and negative tweets are returned and shown to the user through a web interface running on localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*bL9js5jKMJy9ghZYQS-fAQ.png" /><figcaption>The front-end of this application running on localhost. ‘Cyberpunk 2077’ was my keyword.</figcaption></figure><p>Now back to FastAPI, let’s start with installation:</p><pre>pip install fastapi[all]</pre><p>Running this command will include FastAPI as well as the ASGI server ‘Uvicorn’. After the installation is complete let’s take a look at this basic program.</p><pre>from fastapi import FastAPI</pre><pre>app = FastAPI()</pre><pre>@app.get(&quot;/&quot;)<br>async def my_function():<br>    return {&quot;message&quot;: &quot;Hello World&quot;}</pre><p>Save this to main.py file and run the server using:</p><pre>uvicorn main:app --reload</pre><p>This command will run the uvicorn server on our localhost on port number <em>8000. </em>And with the--reload, every time we make some change in our code the server automatically restarts. This is very useful at the time of development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*eza0m0jkuAJO9Snb38twLQ.png" /><figcaption>Anaconda Prompt running uvicorn server for a python file named test.py with FastAPI instance named ‘app’.</figcaption></figure><p>You can also start the server from within the python program using:</p><pre>from fastapi import FastAPI<br><strong>import uvicorn</strong></pre><pre>app = FastAPI()</pre><pre>@app.get(&quot;/&quot;)<br>async def my_function():<br>    return {&quot;message&quot;: &quot;Hello World&quot;}</pre><pre><strong>if __name__ == &quot;__main__&quot;:<br>    uvicorn.run(app, host=&quot;127.0.0.1&quot;, port=8000)</strong></pre><p><em>To stop the server press Ctrl + C on the terminal. Otherwise, you won’t be able to use the same port until the next restart. The port will stay engaged.</em></p><p>Now let’s see what the code does.</p><p>Obviously we need to import the FastAPI library. Then we create an object named <strong>app</strong> using the FastAPI() class. You can name it anything, not just app, it’s just an instance of the class. But remember to use the same name when you run uvicorn uvicorn main:<strong>app </strong>— reload or uvicorn.run(<strong>app</strong>, host=”127.0.0.1&quot;, port=8000).</p><p><strong>Creating a path operation</strong></p><p>The path refers to the last prat of the URL. That is whatever comes after https://domain-name.com.</p><p>For example, in the URL : https://domain-name.com/search/keyword the path is /search/keyword. We define a path inside a decorator in FastAPI.</p><p>Using different paths we can use the API to handle different purposes.</p><p>The @app.get<strong>(&quot;/&quot;)</strong> decorator before defining a function tell FastAPI that the function just below it is responsible for handling whatever requests that comes under this path.</p><p>Also there are different ‘methods’ for communicating over the HTTP protocol. Like, GET, POST, PUT, DELETE etc, to name a few. This ‘method’ is also specified in the decorator as@app.<strong>get</strong>(&quot;/&quot;) (here I used the get method). The first part of the decorator is the name of our FastAPI instance <strong>app</strong>.</p><p><strong>Defining the path operation function</strong></p><p>Once you specify the request method and the path, then you have to define the function that should work when a request is created on the path defined.</p><pre>async def my_function():<br>    return {&quot;message&quot;: &quot;Hello World&quot;}</pre><p>Here my_function() is the function that we created for the path (“/”) (i.e the root path). The async keyword tells the program to wait until some slow process finished its work. The program also works without the the async keyword.</p><p>Finally the output that the function my_function() generated is returned in JSON format. You can return an int, string, list , dictionary and some other complex data models too. Here return {“message”: “Hello World”} is returned with message as the key and “Hello World” as the value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*KgpriCsD1FOetb9R1OpYJQ.png" /><figcaption>This is what the response will look like when we load the server at http://127.0.0.1:8000/</figcaption></figure><h4><strong>Path Parameters</strong></h4><p>What if our path operation function needs to take in some arguments and returns some response after doing some operations on it. This is exactly what we need in our sentiment analysis program. So this is how we do it.</p><p>Consider a logic which returns the square of a number…</p><pre>from fastapi import FastAPI<br><br>app = FastAPI()<br><br><br>@app.get(&quot;/square/<strong>{number}</strong>&quot;)<br>async def my_function(<strong>number</strong>):<br>    number = int(number)<br>    square = number ** 2<br>    return {&quot;square&quot;: square}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*9QjXNnoq3OEZoyn_LvR_tA.png" /><figcaption>This is what the output will look like</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCTVF4Mm1yBeSxYapr_dLg.png" /><figcaption>This is what it looks like in the Swagger UI</figcaption></figure><p>We have to specify the parameter after the path like “/square/<strong>{number}</strong>”. The {<strong>number</strong>} is passed to the function as argument and square operations is performed on it and then returned.</p><p><strong>Data validation using Python type annotations</strong></p><p>Did you notice in the last code snippet that I had to convert the argument number to integer type before performing the square operation? This is because the number is passed as a string (“5” instead of just 5). This is where we can make use of explicit type annotations.</p><p>We can set the type of the parameters using Python type annotations like this def my_function(<strong>number: int</strong>). This will throw an error if we try to pass a string as the path variable. And this will also automatically parse the numbers as integers instead of numbers in the form of strings (eg: 5 instead of “5”).</p><p>The modified code with type validation will look like this:</p><pre>from fastapi import FastAPI<br><br>app = FastAPI()<br><br><br>@app.get(&quot;/square/{number}&quot;)<br>async def my_function(<strong>number: int</strong>):<br>    square = number ** 2<br>    return {&quot;square&quot;: square}</pre><p>If we try to pass as string instead of an integer, the error will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*S_0EekQKyLd9JTw886mzxg.png" /><figcaption>This error says that the value passed is not an integer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsYkH1dUQUrGH4zjN0l4MQ.png" /><figcaption>The documentation automatically marks the value to be an integer in the Swagger UI</figcaption></figure><h4><strong>Query Parameters</strong></h4><p>Path parameters are used to identify a specific resource while query parameters are used to sort or filter those resources. A sample URL with query parameters is as follows:</p><p>— http://127.0.0.1:8000/products/?max-price=5000&amp;free-delivery=True</p><p>They are key-value pairs that appears after ? and separated using &amp;.</p><p>Here is a code snippet that shows an example of query parameters in FastAPI:</p><pre>from fastapi import FastAPI<br><br>app = FastAPI()<br><br><br><strong>@app.get(&quot;/exponent/&quot;)</strong><br>async def my_function<strong>(number: int, power: int):</strong><br>    <strong>result = number ** power<br>    return {&quot;result&quot;: result}</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*eWT6lJmJLRtGYkRJSCXpMg.png" /><figcaption>Output for the above code snippet with query parameters</figcaption></figure><p><strong>Setting default values and optional parameters</strong></p><p>We can also set some <strong>default values </strong>to our parameters. That is, if we don’t explicitly pass a value the default value is taken for operations.</p><pre>from fastapi import FastAPI<br><br>app = FastAPI()<br><br><br>@app.get(&quot;/exponent/&quot;)<br>async def my_function(number: int, <strong>power: int = 2</strong>):<br>    result = number ** power<br>    return {&quot;result&quot;: result}</pre><p>Consider in this case, we want to set the default exponent to find the square of a number, if the user did not pass the exponent value. To do that, we just assign a default value for the argument as:</p><p>power: int = 2</p><p>The default value is assigned automatically if we don’t pass any value through our request URL like: http://127.0.0.1:8000/exponent/?number=6. So for this query the output should be: {“result”:36}.</p><p>Also note that, if we try to load http://127.0.0.1:8000/exponent/?number=6 without setting a default value, we will get an error, because FastAPI expects two parameters to be passed.</p><p><strong>Optional parameters</strong></p><p>We can also set some parameter to be optional. See for example, the below code:</p><pre><strong>from typing import Optional</strong><br><br>from fastapi import FastAPI<br><br>app = FastAPI()<br><br><br>@app.get(&quot;/exponent/&quot;)<br>async def my_function(number: int, <br>                      power: int = 2,<br>                      <strong>odd_number_check: Optional[bool] = None</strong>):<br>    result = number ** power<br>    <strong>if odd_number_check:<br>        if result % 2 != 0:<br>            return {&quot;result&quot;: result, &quot;is_odd&quot;: True}</strong><br>    return {&quot;result&quot;: result}</pre><p>The output for the above code for normal request would be like the previous outputs. But if we add an extra parameter like this:</p><p>http://127.0.0.1:8000/exponent/?number=7&amp;power=4<strong>&amp;odd_number_check=True</strong></p><p>Our output would be (i.e the parameter <strong>odd_number_check</strong> is optional here):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*jpe2WnapPI6caowgR6frUg.png" /><figcaption>Here odd_number_check is set to ‘True’ which will modify the response as above</figcaption></figure><p>Also keep in mind that the below given URLs are parsed to give the same result as above by the FastAPI:</p><p>http://127.0.0.1:8000/exponent/?number=7&amp;power=4&amp;odd_number_check=<strong>1</strong></p><p>http://127.0.0.1:8000/exponent/?number=7&amp;power=4&amp;odd_number_check=<strong>yes</strong></p><p>http://127.0.0.1:8000/exponent/?number=7&amp;power=4&amp;odd_number_check=<strong>on</strong></p><p>Make sure you assign the None value to optional parameters or else FastAPI will take other values assigned as the default values.</p><p>Let’s stop at this point for now. I think this is enough for you to play around with FastAPI before going to deeper features.</p><p><strong>Now let’s see the code for Tweet Analyzer using FastAPI.</strong></p><pre>import tweepy<br>import pandas as pd<br>from fastapi import FastAPI<br><strong>from fastapi.middleware.cors import CORSMiddleware</strong><br>import uvicorn<br>import re<br>from textblob import TextBlob<br><br>app = FastAPI()<br><br><strong>origins = [<br>    &quot;http://localhost&quot;<br>]</strong><br><br><strong>app.add_middleware(<br>    CORSMiddleware,<br>    allow_origins=origins<br>)</strong><br><br><br>@app.post(&quot;/analyse/{keyword}&quot;)<br>async def fetch_tweets(keyword: str):<br>    api_key = &#39;YOUR_API_KEY&#39;<br>    api_key_secret = &#39;YOUR_API_SECRET_KEY&#39;<br><br>    access_token = &#39;YOUR_ACCESS_TOKEN&#39;<br>    access_token_secret = &#39;YOUR_ACCESS_TOKEN_SECRET&#39;<br><br>    auth = tweepy.OAuthHandler(api_key, api_key_secret)<br>    auth.set_access_token(access_token, access_token_secret)<br><br>    api = tweepy.API(auth)<br><br>    no_of_tweets = 100<br><br>    tweets = api.search(q=keyword, lang=&quot;en&quot;, count=no_of_tweets)<br><br>    negative_tweets, positive_tweets = 0, 0<br><br>    for tweet in tweets:<br>        cleaned_tweet = &#39; &#39;.join(re.sub(&quot;(@[A-Za-z0-9]+)|([^0-9A-Za-z \t])|(\w+:\/\/\S+)&quot;, &quot; &quot;, tweet.text).split())<br><br>        analysis = TextBlob(cleaned_tweet)<br><br>        if analysis.sentiment.polarity &lt; 0:<br>            negative_tweets += 1<br>        elif analysis.sentiment.polarity &gt; 0:<br>            positive_tweets += 1<br><br>    positive_percent = (positive_tweets / no_of_tweets) * 100<br>    negative_percent = (negative_tweets / no_of_tweets) * 100<br><br>    print(&quot;Tweets Analyzed successfully!&quot;)<br><br>    return {&quot;positive&quot;: f&quot;{positive_percent}%&quot;,<br>            &quot;negative&quot;: f&quot;{negative_percent}%&quot;,<br>            &quot;neutral&quot;: f&quot;{float(100 - (positive_tweets + negative_tweets))}%&quot;}<br><br><br>if __name__ == &quot;__main__&quot;:<br>    uvicorn.run(app, host=&quot;127.0.0.1&quot;, port=8000)</pre><p>You may have noticed some alien codes in the above code like:</p><pre><strong>origins = [<br>    &quot;http://localhost&quot;<br>]</strong><br><br><strong>app.add_middleware(<br>    CORSMiddleware,<br>    allow_origins=origins<br>)</strong></pre><p>These are necessary to establish a successful connection between the front-end and the back-end when both are running on different servers. Here I am sending requests from my <em>localhost, </em>so I have to tell FastAPI that connections from this origin (http://localhost/) is safe to allow.</p><p>Now let’s see the request part running on our web browser:</p><pre>&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;section&gt;</pre><pre>&lt;div class=&quot;form-container&quot;&gt;</pre><pre>&lt;div&gt;</pre><pre>&lt;h1&gt;Enter the keyword&lt;/h1&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;hr&gt;</pre><pre>&lt;div&gt;</pre><pre>&lt;table&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td&gt;&lt;label for=&quot;keyword&quot;&gt;What do people think about:&lt;/label&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;keyword&quot; placeholder=&quot;Enter your keyword here&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;tr&gt;</pre><pre>&lt;td&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; id=&quot;submit-button&quot;&gt;&lt;/td&gt;</pre><pre>&lt;/tr&gt;</pre><pre>&lt;/table&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;div class=&quot;setiment-display&quot;&gt;</pre><pre>&lt;div&gt;</pre><pre>&lt;h2 style=&quot;color: green&quot;&gt;Percentage of positive tweets: &lt;span id=&quot;positive&quot;&gt;&lt;/span&gt;&lt;/h2&gt;</pre><pre>&lt;h2 style=&quot;color: red&quot;&gt;Percentage of negative tweets: &lt;span id=&quot;negative&quot;&gt;&lt;/span&gt;&lt;/h2&gt;</pre><pre>&lt;h2 style=&quot;color: rgb(214, 157, 1)&quot;&gt;Percentage of neutral tweets: &lt;span id=&quot;neutral&quot;&gt;&lt;/span&gt;&lt;/h2&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;script&gt;</pre><pre>$(&quot;#submit-button&quot;).click(function(){</pre><pre>var keyword = document.getElementById(&quot;keyword&quot;).value;</pre><pre>var url = &quot;http://127.0.0.1:8000/analyse/&quot; + keyword;</pre><pre>var request = new XMLHttpRequest()</pre><pre>request.open(&#39;POST&#39;, url, true)</pre><pre>request.onload = function () {</pre><pre>var data = JSON.parse(this.response)</pre><pre>var table = document.getElementById(&quot;myTable&quot;);</pre><pre>if (request.status &gt;= 200 &amp;&amp; request.status &lt; 400) {</pre><pre>var positive = document.getElementById(&quot;positive&quot;);</pre><pre>var negative = document.getElementById(&quot;negative&quot;);</pre><pre>var neutral = document.getElementById(&quot;neutral&quot;);</pre><pre>positive.innerHTML = data.positive;</pre><pre>negative.innerHTML = data.negative;</pre><pre>neutral.innerHTML = data.neutral;</pre><pre>} else {</pre><pre>console.log(&#39;error&#39;)</pre><pre>}</pre><pre>}</pre><pre>request.send()</pre><pre>})</pre><pre>&lt;/script&gt;</pre><pre>&lt;/section&gt;</pre><p>This is just an introduction to FastAPI. It has got even more features with the same simplicity. Have some fun with it. 😃</p><p>To find more about FastAPI go to: <a href="https://fastapi.tiangolo.com/tutorial/">https://fastapi.tiangolo.com/tutorial/</a></p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fb4791d3e50" width="1" height="1" alt=""><hr><p><a href="https://medium.com/total-brainstorming/getting-to-know-fastapi-7fb4791d3e50">Getting to know FastAPI</a> was originally published in <a href="https://medium.com/total-brainstorming">Total Brainstorming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zip It, If You Can?]]></title>
            <link>https://medium.com/total-brainstorming/zip-it-if-you-can-bf431390185f?source=rss----a4ab22c1174b---4</link>
            <guid isPermaLink="false">https://medium.com/p/bf431390185f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-list]]></category>
            <category><![CDATA[coding-for-kids]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[creative]]></category>
            <dc:creator><![CDATA[Tincy Thomas]]></dc:creator>
            <pubDate>Thu, 22 Jul 2021 07:51:44 GMT</pubDate>
            <atom:updated>2021-07-22T07:51:12.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*nUzQHijNgB3nFnryVMc3hw.jpeg" /><figcaption>Image by Zhifei Zhou</figcaption></figure><p>Given a list of women and a list of men, if the sizes of the two lists differ, Return “sizes don’t match.” Return a list of pairs if the sizes match, with the first woman paired with the first man, the second woman paired with the second man, and so on it goes …</p><p>Let the example list be: [&quot;Micky&quot;, &quot;Phineas&quot;], [&quot;Minnie&quot;, &quot;Isabella&quot;]</p><p>What we should get is, [(&quot;Micky&quot;, &quot;Minnie&quot;), (&quot;Phineas&quot;, &quot;Isabella&quot;)]</p><p>If input passed is a list like [&quot;Ana&quot;, &quot;Amy&quot;, &quot;Lisa&quot;], [&quot;Bob&quot;, &quot;Josh&quot;] , then output should be “Sizes don’t match”. As they could not be combined.</p><p>Note: Consider building a new function where high level of algorithmic computing is not required but please mind not using zip() which exists ;)</p><pre>def zip_it(women, men):<br>   lis = []<br>   main = []<br>   if len(women) == len(men):<br>      for w in women:<br>         for m in men:<br>            lis = lis + [(w, m)]<br>      for loop in range(0, len(lis), len(women) + 1):<br>         main = main+[lis[loop]]<br>      return main<br>   else:<br>      return &quot;Size does not match&quot;<br>print(zip_it([&quot;Ana&quot;, &quot;Amy&quot;, &quot;Lisa&quot;], [&quot;Bob&quot;, &quot;Josh&quot;, &quot;Tim&quot;]))</pre><p>Ta-Ted-dahh!! Done with the code part.</p><p>Now comes output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*eKDggK0QOUyeMmgSpa6Yzg.png" /></figure><h4>Rough Idea:</h4><p>Firstly, we checked length of lists of men and women whether the size matches or not.</p><p>Then we are looping in both lists, appending each pairs to list<em> lis</em>. Creating a new list main where elements are filled using a for loop to only take correct pairs.</p><h4>End Note:</h4><p>If you made here with me, let’s join hands and comment out if you have a different way of doing, coz I am sure there is so just fasten your mind and write it!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf431390185f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/total-brainstorming/zip-it-if-you-can-bf431390185f">Zip It, If You Can?</a> was originally published in <a href="https://medium.com/total-brainstorming">Total Brainstorming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting into Tableau]]></title>
            <link>https://medium.com/total-brainstorming/getting-into-tableau-e73812f5db8?source=rss----a4ab22c1174b---4</link>
            <guid isPermaLink="false">https://medium.com/p/e73812f5db8</guid>
            <category><![CDATA[decision-science]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Tincy Thomas]]></dc:creator>
            <pubDate>Fri, 31 Jul 2020 13:44:43 GMT</pubDate>
            <atom:updated>2020-07-31T13:43:07.509Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sO0RFZ59sl6zkwV9" /><figcaption>Photo by <a href="https://unsplash.com/@campaign_creators?utm_source=medium&amp;utm_medium=referral">Campaign Creators</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Let’s begin with a brief intro, as we know in this modern era it is #data that drives everything!!</p><p>Now without a means to interact with data, it is just worthless.</p><p>There, business intelligence can help by combining online analytical processing and offers an opportunity to connect with different data sources and will extract reports and dashboards as a result to take more effective decisions, while tracking the key performance indicators.</p><p>And, one such BI tool is Tableau, it helps in converting data into useful information while with a drag-and-drop feature.</p><p>So, let’s get started with it together.</p><p>Firstly, we will install Tableau Public using <a href="https://public.tableau.com/en-us/s/">this</a> link.</p><p>And we will work on a sample superstore’s data, which you could download using <a href="https://data.world/annjackson/2019-superstore">this</a> link.</p><p>While we see this whole data set it is just so confusing, right?</p><p>Now, if you are more comfortable with visual learning rather than reading then I’ll suggest to head bottom and go through that YouTube video, it is about a webinar session I took covering almost same topics.</p><p>Firstly let’s visualize the net sales around category using a pie chart,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBZnsuVB90QmwFUNq1SGtw.png" /></figure><p>Yah, it’s clear we could easily understand sales and category.</p><p>So nextly, let’s go with analyzing the various category in the data set and charting it into a bubble chart form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t-M7v3GbqseQwvtjcr9IBQ.png" /></figure><p>Here what we did is dragging the dimension value category into columns, profit into rows then also putting category into color and profit into size card. Thus it resulted into above form.</p><p>Now, going into second case like I have to analyse the growth rate from the day when the company started taking orders to the date of data we have, also to simultaneously forecast for some months ahead, what we will do is :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyHFwox_wwPgeTzUXQxlIg.png" /></figure><p>Here you could see, sales and profit is differentiated in terms of category wise and also forecast for 13 months which comes automatically with Tableau Interpreter. Or else we could change it to months or years we are comfortable with while going to analysis and forecast option in taskbar.</p><p>Third case, if superstore company is planning to expand it’s business to other city, then what would be the optimal choice? 🤔</p><p>Lets’s analyse it,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YsgeVteMK_0KRZXAO3DARw.png" /></figure><p>I tried dropping profit into color mark card and sales into size mark card. See, darkest blue and biggest circle is for New York City. Thus, it states NYC is the best place for next setup!!</p><p>Yuhu! We made the sheets!!</p><p>Now, let’s move to dashboard building, dashboard is simply a means of combining worksheets so that they convey some important message from it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GUoi3z1q3D3rBP7NL5eSiQ.png" /></figure><p>What I did is, I simply combined only the important worksheets. And, that’s it!!</p><p>Dashboard it ready for presentation.</p><p>Lets’s publish and share it with the world!</p><h3>Final words :</h3><p>I would like to see your dashboard too, if you reached this far with me. We could connect over if any doubts or for any help, on twitter. I could share mine dashboard, just use <a href="https://public.tableau.com/profile/tincythomas#!/vizhome/superstoresales_15959358112340/Dashboard1">this</a> link to view.</p><p>Link to my YouTube session : <a href="https://www.youtube.com/watch?v=Qql4U4snxtQ&amp;feature=youtu.be">Introduction to Data Science using Tableau</a></p><p><a href="https://www.youtube.com/watch?v=Qql4U4snxtQ&amp;feature=youtu.be">https://www.youtube.com/watch?v=Qql4U4snxtQ&amp;feature=youtu.be</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e73812f5db8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/total-brainstorming/getting-into-tableau-e73812f5db8">Getting into Tableau</a> was originally published in <a href="https://medium.com/total-brainstorming">Total Brainstorming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner friendly guide, for your First Python Project! ]]></title>
            <link>https://medium.com/total-brainstorming/beginner-friendly-guide-for-your-first-python-project-f833f05306b4?source=rss----a4ab22c1174b---4</link>
            <guid isPermaLink="false">https://medium.com/p/f833f05306b4</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[python-projects]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <dc:creator><![CDATA[Tincy Thomas]]></dc:creator>
            <pubDate>Fri, 31 Jul 2020 11:23:18 GMT</pubDate>
            <atom:updated>2020-06-01T17:38:06.066Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>Beginner friendly guide, for your</em><strong><em> First Python Project</em></strong><em>!🎯</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xT45I92qiFIr1nfKueCUtQ.jpeg" /><figcaption>Picture Source Credit : <a href="https://wall.alphacoders.com/">https://wall.alphacoders.com/</a></figcaption></figure><p>In the world of so many different types of MOOCs, I admit it isn’t easy for you to begin your journey. I’ll suggest, use those MOOCs or platforms as just a syllabus kind which you could complete, watching barely within two or three days. That will give you a good enough intro with syntax and semantics of language. Then, from the next day itself, spend more time and see tutorials on building projects, nothing high rather begin from basics itself.</p><blockquote>So, for now let’s get started with <strong>how to build a small and general word meaning dictionary using Python on Jupyter Notebooks</strong>.</blockquote><p><strong>Problem Statement</strong> : What you have to get as output is, when you run your code it should ask you — “Enter the word you want to search” and it should take you to the exact meaning of word, somewhat like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGJGX4doo4J3X4Xmhk8t0g.png" /><figcaption>Image above : output and our dictionary</figcaption></figure><p><strong>Where to get the Data </strong>: The first thing that came in your mind could be something like, Do I have to write all words and their meaning to form the dictionary? So the answer for that is NO! Here, we would be using a JSON file of informal and formal words and meanings. You can access it from my <a href="https://github.com/TincyThomas/Handy_Dict">GitHub</a> repo (original.json file).</p><p>Firstly, I assume you have <a href="https://www.anaconda.com/products/individual">Anaconda</a> installed on PC, otherwise you could, by directly going onto their official website from link mentioned because we would be following on Jupyter Notebooks (also not mandatory you could choose any Python editor of your choice) .</p><p>Next, or after installing go to Anaconda prompt and type Jupyter notebook and you will be redirected to a web page, where you have to choose “Python 3” under “new”.</p><p><em>Kudos! Now let’s begin, for what we are actually here!!</em> 😁</p><p><strong>Main Logic</strong> : I will ponder over some hints for help like, what all you have to consider and how to proceed, but not the whole code though you can access it for clearing doubts from my <a href="https://github.com/TincyThomas/Handy_Dict">GitHub</a> repo (by tapping on GitHub).</p><blockquote>Firstly, import json, as we have data in json format.</blockquote><blockquote>Then, use open function and load your data.</blockquote><blockquote>Print to take input of word, input accepted should be case insensitive.</blockquote><blockquote>In meantime, it could happen like words could be mistype , considering it you must import get_close_matches() from difflib.</blockquote><blockquote>There raises a question, are both words same (actual word and word matched), so that should be asked from user in “y” or “n” way (case-insensitive).</blockquote><blockquote>If it’s yes then display meaning.</blockquote><blockquote>Otherwise you could respond like “May be fingers on unknown letters, type again.”</blockquote><p>Now after successful run, Hurray!! Let’s upload it on GitHub too.</p><p>Not familiar with how to upload your Jupyter Notebook on GitHub? It’s OK, I’ll suggest take a look on <a href="https://reproducible-science-curriculum.github.io/sharing-RR-Jupyter/01-sharing-github/">clickme</a>. This helped me, I believe it’ll benefit you too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoV7uNRry6LVd2RfiDunQQ.jpeg" /><figcaption>Picture Source Credit : <a href="https://wall.alphacoders.com/">https://wall.alphacoders.com/</a></figcaption></figure><h3>Final Words:</h3><p>Hey everyone! So congratulations for building the dictionary. It’s important we start by developing these kind of software and programs in life. I hope you understood what we have done yet. And it’s pretty simple too. So thanks for getting along and see you with the next interesting project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f833f05306b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/total-brainstorming/beginner-friendly-guide-for-your-first-python-project-f833f05306b4">Beginner friendly guide, for your First Python Project! 🎯</a> was originally published in <a href="https://medium.com/total-brainstorming">Total Brainstorming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>