Module 4 · Advanced Practical Projects

A decision dashboard with AI and Streamlit

Lesson 12 of 15 9 min lesson Updated on October 30, 2026
Progress in the course80%

In this lesson

A dashboard that leads to an action.

A good dashboard is not the one with the most charts. It is the one that leads someone to act. Here you build a dashboard with Streamlit, a Python library that turns a script into a web page. AI helps in three places, but the decision stays with a person.

Question, action and comparison

Every element on the dashboard has to answer a question and trigger an action. If it triggers nothing, it leaves the screen. "How many items have been waiting for a person for more than 24 hours?" triggers "reassign someone". "How many emails came in this week?" on its own triggers nothing.

Every number needs a comparison: the previous period, a target or the median of the last few weeks. A number on its own is decoration.

Streamlit: the script runs again

On every click on a filter, the whole script runs again, from top to bottom. So whatever is expensive to compute needs a cache, a memory kept between runs. Every cache should have an expiry time, the ttl. Without it, an old query can stay on the screen for hours.

What each person chose, such as the period, lives in st.session_state. Each tab has its own session. The common mistake is to keep the choice in a global variable: it is shared by everyone, and one person's screen changes another's.

Read-only data

The dashboard reads the queue and never writes to it. In SQLite, open the database with an address that ends in mode=ro. Any attempt to write fails, and a bug in the dashboard cannot corrupt the queue. The query brings only the columns the screen uses: the email text, with personal data, never even reaches the dashboard.

The queue saves the time in UTC, and the dashboard shows Brasília time, Brazil's official time. If you do not convert before grouping, the items from 9:00 p.m. to 11:59 p.m. fall on the next day.

AI in three places

The AI never adds, counts or decides on its own. The code calculates what is exact.

What the pros know

Logging in is not the same as having permission. The Streamlit documentation says that OpenID Connect supports authentication, but not authorization. In other words: the Google account proves who the person is, but what decides who can see the dashboard is your list of allowed emails. People who publish dashboards for real build all four layers: a server listening only on the local address, a proxy with HTTPS in front, a login and an allowlist. Skipping the last one leaves the data open to anyone with an account.

LGPD: show only the aggregate

A dashboard with data from customer emails handles personal data under the LGPD, Brazil's data protection law, even without a name. A line such as "refund of 1,200 reais on October 14" can identify someone. Show counts, rates and medians. The detail per item stays only with whoever handles the case.

Careful

The secrets file, with the API key and the login secret, never goes into the repository. Put it in .gitignore. If a secret leaked, replace it right away.

Practice · 5 min

  1. List the elements on your dashboard and write the question and the action for each one. Delete the ones left without an action.
  2. Write the title of each chart as a question and read it out loud to someone from outside.
  3. Pick one number and define its comparison.
Deliverable: a list with the question, action and comparison for each element on the dashboard.

Summary

Sources

Read on October 30, 2026.

  1. Streamlit. Authentication and personalization: OIDC and authorization.
  2. Streamlit. Caching overview: data cache and ttl.
  3. Streamlit. Session State.

Lesson quiz

Three situations to apply what you learned.

Lesson 12 of 15

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp