Day 80 of 100 Days Coding Challenge: Python
At the start of this whole adventure, I felt like a kid stuck between two arcades: one machine labeled “Poetry” and the other “PowerShell.” Both terminals were blinking at me, demanding quarters, and I wasn’t sure which joystick to grab first. Overwhelming? Absolutely. Exciting? Even more so. Curiosity is a noisy creature—it drowned out the fear.
Fast-forward to today: we added Streamlit. Or at least, we were supposed to—except I discovered I had already installed it. (Past Me occasionally leaves gifts for Future Me.) With it, I cobbled together an interactive web app that shows a skeleton of civilizations. It’s not pretty, but it works, and sometimes “working” is the most beautiful sight of all.
I’d first heard of Streamlit while dabbling in machine learning tutorials. Back then, it was this shiny, mysterious framework that promised to turn Python scripts into apps with the ease of flipping a pancake. Today, I can actually use it—and maybe one day, I’ll build dashboards that model the universe of Asimov’s Foundation or Brandon Sanderson’s Cosmere. Ambitious? Yes. Possible? With enough coffee, absolutely.
Today’s Motivation / Challenge
Why does this matter? Because squinting at raw JSON is about as fun as watching paint dry. With Streamlit, I can slide, click, and filter through civilizations like I’m browsing an ancient version of Netflix. Want only South Asian civilizations between 500 BCE and 500 CE? Done. It’s history on demand, minus the endless commercials.
Purpose of the Code (Object)
The code turns a pile of historical data into a friendly web interface. Instead of hammering at APIs or database queries, you get sliders and dropdowns. Slide to pick a year range, click to pick a region or tag, and voilà—the app shows you only what you asked for. It’s history made interactive, without the headaches.
AI Prompt
Please create an instruction to do the Day 5 tasks. Today’s goal is:
Day 5 — Streamlit list & filters
- Sidebar: year slider (−3000 to 2000), region multiselect, tag multiselect.
- Main: civ cards; click → civ detail.
Accept: filters change visible list without errors.
Functions & Features
- Sidebar with interactive filters: year range, regions, and tags.
- Main panel shows civilization “cards.”
- Clicking a card loads civilization details.
- Filters instantly update the list—no reloads needed.
Requirements / Setup
You’ll need:
- Python 3.11
Installs:
pip install streamlit requests plotly
Minimal Code Sample
with st.sidebar:
year_range = st.slider(“Year range”, -3000, 2000, (-500, 500))
regions = st.multiselect(“Regions”, [“Europe”, “East Asia”, “South Asia”])
tags = st.multiselect(“Tags”, [“war”, “tech”, “culture”])
resp = requests.get(f”{base}/civs”, params={
“start”: year_range[0], “end”: year_range[1], “region”: regions, “tags”: tags
})
items = resp.json()[“items”]
Sidebar collects filters, sends them to the API, and displays matching civilizations.
The Civilization Timeline Builder
Notes / Lessons Learned
Streamlit hides a sneaky detail: caching. This program uses st.cache_data for things like JSON and dataframes, while st.cache_resource babysits the heavy stuff (like database clients). The kicker? The order matters. Place your filters and routing before the main content, or you’ll spend hours wondering why your app feels like it’s dragging a boulder uphill.
The more I poked around, the more I realized: Streamlit isn’t just picky—it’s opinionated, like a good chef. At first, it annoyed me. But then it clicked. The structure is there to keep things smooth, fast, and uncluttered. Sometimes “why” matters more than “how.” And yes, that thought will haunt me until I build that Cosmere dashboard.
Optional Ideas for Expansion
- Add a search box so you can type “Rome” instead of scrolling endlessly.
- Make the civ cards prettier with images and little flag icons.
- Add a “random civilization” button for the historically indecisive.

