Advanced Data Visualization – 001 | Lesson 08 — Interactive Time Series, Jupyter Widgets and Dashboard Controls

AI GENERATED CONTENT — POSTED AS IS. Questions and topic outlines were adapted from Open Education source posts (attributed to this site and, where identified there, Sayed Ahmed). Newly AI-generated explanations, original synthetic graphics and code are offered for reuse without copyright restrictions asserted by this blog. Third-party rights remain applicable; AI can make mistakes.

Advanced Data Visualization – 001: course index · Source articles: Post 19914 · Post 19916 · Post 19912 · Post 19922 · Post 16051

Learning goals: The original healthcare notebooks use ipywidgets to select indicators, regions and years. A useful interactive dashboard combines valid controls, accurate data filtering, responsive plots and a clear explanation of what the user is seeing.

Original schematic plot illustrating Interactive Time Series, Jupyter Widgets and Dashboard Controls.
Original course-generated illustration; synthetic values, not measurements.

Theory and practical decisions

Use a single source of truth for selection state. A drop-down should not silently change units; titles and legends must update along with the data. Cache stable calculations but invalidate caches when filters change. For temporal comparisons avoid interpolating missing years without disclosure.

Widgets are strongest when paired with a report of data availability, uncertainty, metadata and accessible text alternatives. Legacy browser technologies such as AngularJS appear in the archive, but new dashboards should use supported libraries.

Mathematical model

The filtered mean for selected set S is x̄_S=(Σᵢ∈S xᵢ)/|S|. Changing filters changes the denominator and may change interpretation, especially across regions of unequal population.

Python example and plot

# Run inside Jupyter with ipywidgets installed
import pandas as pd, matplotlib.pyplot as plt
from ipywidgets import interact, Dropdown
df=pd.DataFrame({
 "year":[2022,2023,2024,2022,2023,2024],
 "region":["A"]*3+["B"]*3,
 "value":[10,14,16,12,11,15]})
def show(region="A"):
    subset=df[df.region==region].sort_values("year")
    ax=subset.plot(x="year",y="value",marker="o",
                   title=f"Selected region: {region}",legend=False)
    ax.set_ylabel("Synthetic rate")
    plt.show()
interact(show,region=Dropdown(options=["A","B"]))
# Expected: A -> 10,14,16; B -> 12,11,15

R example and plot

# Requires the shiny package
library(shiny)
df <- data.frame(year=rep(2022:2024,2),
 region=rep(c("A","B"),each=3),
 value=c(10,14,16,12,11,15))
ui <- fluidPage(
 selectInput("region","Region",c("A","B")),
 plotOutput("trend"))
server <- function(input,output,session){
 output$trend <- renderPlot({
   x <- df[df$region == input$region,]
   plot(x$year,x$value,type="b",
        xlab="Year",ylab="Synthetic rate")
 })
}
shinyApp(ui,server)

Expected output and interpretation

The Jupyter dropdown switches a three-point line between regions A and B. In R Shiny the same filter controls a plot. The numbers are synthetic and must not be labeled as genuine health indicators.

Questions and answers

Q1. What should happen to labels when a filter changes?

Answer. Update title, unit, period, source notes and any legend that depends on the selection.

Q2. How can dashboards mislead?

Answer. They can mix incompatible units, show stale cached values, or suppress missing observations.

Q3. Are interactivity and accuracy the same?

Answer. No. Interactive controls do not guarantee valid data, appropriate scaling or correct statistical inference.

Assessment

Add a year-range control and an explicit ‘records shown’ counter; handle a filter selection with zero matching rows.

Translated to Bengali / বাংলায় অনুবাদ

বাংলা অনুবাদ: উপরের ব্যাখ্যামূলক পাঠ ও প্রশ্নোত্তরের সহজ ও শুদ্ধ বাংলা রূপ এখানে দেওয়া হলো। কোডের Python ও R সিনট্যাক্স অপরিবর্তিত।

শেখার লক্ষ্য: সাইটের স্বাস্থ্যসেবা নোটবুকে ipywidgets দিয়ে সূচক, অঞ্চল ও বছর নির্বাচন করা হয়েছে। ভালো ড্যাশবোর্ডে নির্ভরযোগ্য নিয়ন্ত্রণ, সঠিক ফিল্টার, দ্রুত চার্ট এবং স্পষ্ট ব্যাখ্যা থাকে।

নির্বাচিত মানের জন্য একটি নির্ভরযোগ্য অবস্থা ব্যবহার করুন। ড্রপডাউন বদলালে শিরোনাম ও এককও বদলাতে হবে। ফিল্টার বদলালে পুরোনো হিসাব ভুলভাবে দেখাবেন না। অনুপস্থিত বছরের মান অনুমান করলে তা উল্লেখ করুন।

উইজেটের পাশাপাশি উপাত্তের প্রাপ্যতা, অনিশ্চয়তা ও উৎসের বিবরণ দেওয়া জরুরি। পুরোনো লেখায় AngularJS আছে; নতুন ড্যাশবোর্ডে সমর্থিত আধুনিক লাইব্রেরি বেছে নেওয়া উচিত।

গাণিতিক ধারণা: নির্বাচিত উপসেট S-এর গড় x̄_S=(Σᵢ∈S xᵢ)/|S|। ফিল্টার বদলালে বিভাজকও বদলায়; ভিন্ন জনসংখ্যার অঞ্চল তুলনায় তা গুরুত্বপূর্ণ।

প্রত্যাশিত ফল: Jupyter-এর ড্রপডাউন বদলালে A ও B অঞ্চলের তিন বছরের রেখাচিত্র বদলায়। R Shiny-তেও একই ধরনের নিয়ন্ত্রণ কাজ করে। সংখ্যাগুলো কৃত্রিম, প্রকৃত স্বাস্থ্যসূচক নয়।

প্রশ্ন 1. ফিল্টার বদলালে কোন লেবেল বদলাবে?

উত্তর: শিরোনাম, একক, সময়, উৎস ও প্রাসঙ্গিক লেজেন্ড হালনাগাদ করতে হবে।

প্রশ্ন 2. ড্যাশবোর্ড কীভাবে বিভ্রান্ত করতে পারে?

উত্তর: অসম একক মেশানো, পুরোনো তথ্য দেখানো বা অনুপস্থিত পর্যবেক্ষণ গোপন করলে।

প্রশ্ন 3. ইন্টারঅ্যাকটিভ হলেই কি চার্ট নির্ভুল?

উত্তর: না। নির্বাচনযোগ্য নিয়ন্ত্রণ থাকলেও উপাত্ত বা বিশ্লেষণ ভুল হতে পারে।

বাংলা অনুশীলন

বছরের সীমা নির্বাচন ও কতটি রেকর্ড দেখা যাচ্ছে তার গণনা যোগ করুন; কোনো রেকর্ড না থাকলে উপযুক্ত বার্তা দেখান।

মূল উৎসগুলোর লিংক উপরে আছে। এআই-তৈরি নিজস্ব ব্যাখ্যা ও চিত্র পুনর্ব্যবহারে এই ব্লগ থেকে কপিরাইটের বিধিনিষেধ দেওয়া হচ্ছে না। তৃতীয় পক্ষের অধিকার আলাদা। এআই ভুল করতে পারে, তাই যাচাই করুন।


Discover more from Open Education

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from Open Education

Subscribe now to keep reading and get access to the full archive.

Continue reading