Create smart data dashboards with Azgar, Taipei and Google Sheets

by SkillAiNest

Create smart data dashboards with Azgar, Taipei and Google SheetsCreate smart data dashboards with Azgar, Taipei and Google Sheets
Photo by Author | Ideogram

. Introduction

Data has become an important source for any business, as it gives companies a means of gaining valuable insights, especially when decisions. Without data, decisions completely rely on fate and fate, which is not the most effective approach.

However, it is difficult to understand a large amount of raw data. It does not provide direct insights and requires more processing. This is why many people rely on the use of data dashboards to summarize, imagine and navigate the raw data we have. By producing a sleek dashboard, we can provide non -technical users with a straight path to easily gain insights from data.

This is why this article will find out how to make a bureaucracy how to make a sleek data dashboard. DearFor, for, for,. ThypepieAnd Google Sheets.

Let’s enter it.

. Developing smart data dashboard

We will start the tutorial with all the necessary credentials to get the Google Sheets through Azigar. First, create a Google Account and go to it Google Cloud Console. Then, go to APIS & Services> Library, where you need to enable Google Sheets API and Google Drive API.

After activating the APIS, return to APIS & Services> Certificates and visit the credentials> Service account. Follow the instructions and assign this role, such as the editor or owner, so that we can read and write Google Sheets. We just choose the service account, then add the keys> key> Create a new key. Select JSON and download credentials.json Store it somewhere and open the file. Then, copy under the email value client_email.

Datasit L. Wee, we’ll use Cardiac Datasit By Cogl As an instance. Store the file in Google Drive and open it as Google Sheets. In the Google Sheets File, go to the File> Share button and add to the email you have just copied. Finally, copy the URL for the Google Sheets file, as we will later access data through the URL.

Open your favorite IDE, and then we will make our project the following:

taipy_gsheet/
│
├── config/
│   └── credentials.json         
├── app.py                   
└── requirements.txt

Create all the necessary files, and then we will start producing our dashboards. We will use Taipei for the application framework, Pandas For data manipulation, gspread And OAUTH2CLIient To interact with Google Sheets API, and From the plot To create concepts. I requirements.txt File, Following Put the following:

taipy
pandas
gspread
oauth2client
plotly

These are the necessary libraries for our tutorial, and we will install them in our environment. Don’t forget to use the virtual environment to avoid breaking your main environment. We will also use the 3.12. As long as this article was written, it is a version of Azgar that currently works for the aforementioned libraries.

Install libraries using the following command:

pip install -r requirements.txt

If the installation is successful, we will prepare our application. I app.pyWe will prepare a code to configure our dashboard.

First, we will import all the necessary libraries we will use to prepare the application.

import pandas as pd
import gspread
import plotly.express as px
import taipy as tp
from taipy import Config
from taipy.gui import Gui
import taipy.gui.builder as tgb

Next, we will load data from Google Sheets using the following code. Change SHEET_URL Appreciate your original data with URL. In addition, we will already prepare the data to make sure.

SHEET_URL = "
client = gspread.service_account(filename="config/credentials.json")
df_raw = pd.DataFrame(client.open_by_url(SHEET_URL).get_worksheet(0).get_all_records())
df_raw("sex") = pd.to_numeric(df_raw("sex"), errors="coerce").fillna(0).astype(int)
df_raw("sex_label") = df_raw("sex").map({0: "Female", 1: "Male"})

Then, we will prepare with the dashboard Thypepie. There is an open source library for TAP data -driven applications, covering both Front End and Back and Development. Let’s use the library to create a data dashboard with basic features we can use with Taipy.

In the code below, we will create a scenario, which is a pipeline that the user can process for analysis. This is basically a framework for experimenting with different parameters that we can move into the pipeline. For example, here we create a scenario for the average age with gender filter input.

def compute_avg_age(filtered_df: pd.DataFrame, gender_filter: str) -> float:
    data = (
        filtered_df
        if gender_filter == "All"
        else filtered_df(filtered_df("sex_label") == gender_filter)
    )
    return round(data("age").mean(), 1) if not data.empty else 0

filtered_df_cfg = Config.configure_data_node("filtered_df")
gender_filter_cfg = Config.configure_data_node("gender_filter")
avg_age_cfg = Config.configure_data_node("avg_age")

task_cfg = Config.configure_task(
    "compute_avg_age", compute_avg_age, (filtered_df_cfg, gender_filter_cfg), avg_age_cfg
)
scenario_cfg = Config.configure_scenario("cardiac_scenario", (task_cfg))
Config.export("config.toml")

We will review the scenario later, but let’s create a gender selection and prepare its predecessor.

gender_lov = ("All", "Male", "Female")
gender_selected = "All"
filtered_df = df_raw.copy()
pie_fig = px.pie()
box_fig = px.box()
avg_age = 0

Next, we will develop functions that update our concept of variables and data when the user interacts with the dashboard, such as selecting a gender or presenting the scenario.

def update_dash(state):
    subset = (
        df_raw if state.gender_selected == "All"
        else df_raw(df_raw("sex_label") == state.gender_selected)
    )
    state.filtered_df = subset
    state.avg_age = round(subset("age").mean(), 1) if not subset.empty else 0

    state.pie_fig = px.pie(
        subset.groupby("sex_label")("target").count().reset_index(name="count"),
        names="sex_label", values="count",
        title=f"Target Count -- {state.gender_selected}"
    )
    state.box_fig = px.box(subset, x="sex_label", y="chol", title="Cholesterol by Gender")

def save_scenario(state):
    state.scenario.filtered_df.write(state.filtered_df)
    state.scenario.gender_filter.write(state.gender_selected)
    state.refresh("scenario")
    tp.gui.notify(state, "s", "Scenario saved -- submit to compute!")

With the functions ready, we will prepare the Front & Dashboard with the basic structure with the code below:

with tgb.Page() as page:
    tgb.text("# Cardiac Arrest Dashboard")
    tgb.selector(value="{gender_selected}", lov="{gender_lov}",
                 label="Select Gender:", on_change=update_dash)

    with tgb.layout(columns="1 1", gap="20px"):
        tgb.chart(figure="{pie_fig}")
        tgb.chart(figure="{box_fig}")

    tgb.text("### Average Age (Live): {avg_age}")
    tgb.table(data="{filtered_df}", pagination=True)

    tgb.text("---")
    tgb.text("## Scenario Management")
    tgb.scenario_selector("{scenario}")
    tgb.selector(label="Scenario Gender:", lov="{gender_lov}",
                 value="{gender_selected}", on_change=save_scenario)
    tgb.scenario("{scenario}")
    tgb.scenario_dag("{scenario}")
    tgb.text("**Avg Age (Scenario):**")
    tgb.data_node("{scenario.avg_age}")
    tgb.table(data="{filtered_df}", pagination=True)

The above dashboard is easy, but it will change according to our choice.

Finally, we will develop the Orchestration process with the following code:

if __name__ == "__main__":
    tp.Orchestrator().run()
    scenario = tp.create_scenario(scenario_cfg)
    scenario.filtered_df.write(df_raw)
    scenario.gender_filter.write("All")
    Gui(page).run(title="Cardiac Arrest Dashboard", dark_mode=True)

Once your pass code is ready, we will run the dashboard with the following command:

Automatically, the dashboard will show in your browser. For example, here is a simple cardiac arrest dashboard that has concepts and gender choices.

If you are scrolling, how the scenario pipeline is shown here. You can try to select the gender and offer the scenario to look at the average age.

Similarly, you can create smart data dashboards with just a few components. Find out Taipei documents To add suitable suitable concepts and features of your dashboard needs.

. Wrap

Data is a source that every company needs, but if it is more difficult to get insight from the data, it is not imagined. In this article, we have created a sleek data dashboard using Azigar, Taipei, and Google Sheets. We showed how to connect data from Google Sheets and how to use the Taipei Library to build the Interactive Dash Board.

I hope it has helped!

Cornelius Yodha Vijaya Data Science is Assistant Manager and Data Writer. Elijan, working in Indonesia for a full time, likes to share indicators of data and data through social media and written media. CorneLius writes on various types of AI and machine learning titles.

You may also like

Leave a Comment

At Skillainest, we believe the future belongs to those who embrace AI, upgrade their skills, and stay ahead of the curve.

Get latest news

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

@2025 Skillainest.Designed and Developed by Pro