প্রজেক্ট: e-commerce ড্যাশবোর্ড
এই পাঠে যা শিখবেন
- E-commerce KPIs এবং তাদের গাণিতিক formula
- Synthetic dataset generation pandas-এ
- Multi-tab Streamlit dashboard architecture
- Cohort analysis ও retention curve
- GitHub deployment workflow
১ · Project brief
ভাবুন আপনি একটি Bangladesh e-commerce startup-এর প্রথম data analyst। CEO চান একটি live dashboard — সব KPI এক জায়গায়, daily refresh, mobile-friendly। আপনার budget: ০। Tool: Python + Streamlit + Plotly। সময়: ১ সপ্তাহ।
এই project-এ আমরা step-by-step build করব। সম্পূর্ণ কোড দেওয়া আছে — copy করে চালাতে পারবেন।
ecommerce-dashboard/
├── app.py — main Streamlit entry
├── data_loader.py — synthetic data generator
├── kpi.py — KPI calculation functions
├── charts.py — Plotly chart factory
├── requirements.txt
└── README.md
২ · KPI definitions
প্রথমে formal definitions:
-
GMV (Gross Merchandise Value): মোট order value বিক্রয়। refund বাদ যাওয়ার আগে।
$$\text{GMV} = \sum_{\text{orders}} (\text{quantity} \times \text{unit price})$$ -
AOV (Average Order Value): প্রতি order-এ গড় টাকা।
$$\text{AOV} = \frac{\text{GMV}}{\text{number of orders}}$$ -
CAC (Customer Acquisition Cost): একজন নতুন গ্রাহক পেতে কত খরচ।
$$\text{CAC} = \frac{\text{marketing spend}}{\text{new customers acquired}}$$ -
LTV (Lifetime Value): একজন গ্রাহকের পুরো life-time-এ গড় revenue।
$$\text{LTV} = \text{AOV} \times \text{purchase frequency} \times \text{lifespan}$$ -
Conversion rate: কত % visitor কেনে।
$$\text{Conv} = \frac{\text{orders}}{\text{visitors}} \times 100$$ - Retention (M+1): এই মাসে নতুন আসা গ্রাহকের কত % পরের মাসেও কিনলেন।
- Churn rate: ১ - retention।
৩ · Synthetic data generator
Real Daraz data নেই — নিজেই generate করব। Realistic pattern সহ ১২ months × ৫,০০০ orders।
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
np.random.seed(42)
CATEGORIES = ['Mobile','Fashion','Beauty','Home','Books','Sports','Toys']
CITIES = ['Dhaka','Chattogram','Sylhet','Rajshahi','Khulna','Barisal','Rangpur']
CHANNELS = ['Facebook','Google','Direct','Email','Referral','Organic']
def generate_orders(n_days=365, base_orders=50):
"""১২ মাসের synthetic order data — seasonality সহ।"""
rows = []
start = datetime(2024, 1, 1)
for d in range(n_days):
date = start + timedelta(days=d)
# seasonality — Eid spike (Apr/Jun), Pohela Boishakh (Apr 14)
month = date.month
seasonal = 1.0
if month in [4, 6]: seasonal = 1.6 # Eid
if month in [11, 12]: seasonal = 1.4 # winter shopping
if date.weekday() in [4, 5]: seasonal *= 1.2 # weekend
# daily orders Poisson
n_orders = np.random.poisson(base_orders * seasonal)
for _ in range(n_orders):
cat = np.random.choice(CATEGORIES,
p=[0.30,0.22,0.15,0.12,0.08,0.08,0.05])
city = np.random.choice(CITIES,
p=[0.45,0.20,0.10,0.08,0.07,0.05,0.05])
channel = np.random.choice(CHANNELS,
p=[0.30,0.25,0.20,0.10,0.10,0.05])
qty = np.random.randint(1, 4)
base_price = {'Mobile':25000,'Fashion':1500,'Beauty':800,
'Home':3000,'Books':400,'Sports':2000,'Toys':1200}[cat]
price = base_price * np.random.uniform(0.7, 1.3)
customer_id = f'C{np.random.randint(1, 5000):05d}'
rows.append({
'date': date,
'order_id': f'O{len(rows)+1:07d}',
'customer_id': customer_id,
'category': cat,
'city': city,
'channel': channel,
'quantity': qty,
'unit_price': round(price, 2),
'gmv': round(qty * price, 2),
})
return pd.DataFrame(rows)
def generate_marketing(n_days=365):
"""Daily marketing spend — channel-wise।"""
rows = []
start = datetime(2024, 1, 1)
for d in range(n_days):
date = start + timedelta(days=d)
month = date.month
boost = 2.0 if month in [4, 6, 11, 12] else 1.0
for ch in ['Facebook','Google','Email']:
base = {'Facebook':50000,'Google':80000,'Email':5000}[ch]
spend = base * boost * np.random.uniform(0.8, 1.2)
rows.append({'date': date, 'channel': ch,
'spend': round(spend, 2)})
return pd.DataFrame(rows)
if __name__ == '__main__':
orders = generate_orders()
marketing = generate_marketing()
orders.to_csv('orders.csv', index=False)
marketing.to_csv('marketing.csv', index=False)
print(f'Generated {len(orders)} orders, {len(marketing)} marketing rows')
৪ · KPI calculation module
import pandas as pd
import numpy as np
def total_gmv(df):
return df['gmv'].sum()
def total_orders(df):
return len(df)
def aov(df):
return df['gmv'].sum() / max(len(df), 1)
def unique_customers(df):
return df['customer_id'].nunique()
def cac(orders_df, marketing_df):
"""Marketing spend / new customers."""
spend = marketing_df['spend'].sum()
new_cust = orders_df['customer_id'].nunique()
return spend / max(new_cust, 1)
def repeat_rate(df):
"""% customers with 2+ orders."""
counts = df.groupby('customer_id').size()
return (counts >= 2).sum() / len(counts) * 100
def cohort_retention(df):
"""First-purchase month → retention curve."""
df = df.copy()
df['order_month'] = df['date'].dt.to_period('M')
first = df.groupby('customer_id')['order_month'].min().rename('cohort')
df = df.merge(first, on='customer_id')
df['cohort_idx'] = (df['order_month'] - df['cohort']).apply(lambda x: x.n)
cohort = df.groupby(['cohort','cohort_idx'])['customer_id'].nunique().unstack()
pct = cohort.div(cohort[0], axis=0) * 100
return pct.round(1)
def daily_gmv(df):
return df.groupby('date')['gmv'].sum().reset_index()
def category_gmv(df):
return df.groupby('category')['gmv'].sum().sort_values(
ascending=False).reset_index()
def city_gmv(df):
return df.groupby('city')['gmv'].sum().sort_values(
ascending=False).reset_index()
def channel_performance(orders_df, marketing_df):
"""Channel-wise revenue, orders, spend, CAC."""
rev = orders_df.groupby('channel').agg(
orders=('order_id','count'),
revenue=('gmv','sum'),
customers=('customer_id','nunique')
).reset_index()
spend = marketing_df.groupby('channel')['spend'].sum().reset_index()
out = rev.merge(spend, on='channel', how='left').fillna(0)
out['cac'] = out['spend'] / out['customers'].replace(0, 1)
out['roas'] = out['revenue'] / out['spend'].replace(0, 1)
return out
cohort_retention — সবচেয়ে complex। প্রথম-purchase month-এ cohort, পরবর্তী মাসগুলোয় কত % retain।
৫ · Chart factory
import plotly.express as px
import plotly.graph_objects as go
def chart_daily_gmv(df):
fig = px.line(df, x='date', y='gmv',
title='Daily GMV',
labels={'gmv':'GMV (BDT)','date':'Date'})
fig.update_traces(line=dict(color='#2563eb', width=2))
fig.update_layout(template='plotly_white', height=400)
return fig
def chart_category(df):
fig = px.bar(df, x='gmv', y='category', orientation='h',
title='Category-wise GMV',
labels={'gmv':'GMV (BDT)','category':''},
color='gmv', color_continuous_scale='Blues')
fig.update_layout(template='plotly_white', height=400,
yaxis={'categoryorder':'total ascending'})
return fig
def chart_city(df):
fig = px.bar(df, x='city', y='gmv',
title='City-wise GMV',
color='gmv', color_continuous_scale='Greens')
fig.update_layout(template='plotly_white', height=400)
return fig
def chart_channel(df):
fig = go.Figure()
fig.add_trace(go.Bar(x=df['channel'], y=df['revenue'],
name='Revenue', marker_color='#2563eb',
yaxis='y'))
fig.add_trace(go.Scatter(x=df['channel'], y=df['roas'],
mode='lines+markers', name='ROAS',
marker_color='#dc2626', yaxis='y2'))
fig.update_layout(
title='Channel — Revenue vs ROAS',
yaxis=dict(title='Revenue (BDT)', side='left'),
yaxis2=dict(title='ROAS', side='right', overlaying='y'),
template='plotly_white', height=400,
legend=dict(x=0.01, y=0.99))
return fig
def chart_cohort(retention_df):
fig = px.imshow(retention_df.values,
labels=dict(x='Months Since First Purchase',
y='Cohort', color='Retention %'),
x=retention_df.columns,
y=[str(c) for c in retention_df.index],
color_continuous_scale='RdYlGn',
aspect='auto',
text_auto='.0f')
fig.update_layout(title='Cohort Retention Heatmap',
template='plotly_white', height=500)
return fig
৬ · Streamlit app — main file
import streamlit as st
import pandas as pd
import plotly.express as px
# local modules
from data_loader import generate_orders, generate_marketing
from kpi import (total_gmv, total_orders, aov, unique_customers, cac,
repeat_rate, cohort_retention, daily_gmv,
category_gmv, city_gmv, channel_performance)
from charts import (chart_daily_gmv, chart_category, chart_city,
chart_channel, chart_cohort)
# ─────── Page config ───────
st.set_page_config(
page_title='Daraz-Style Dashboard',
page_icon='🛍️',
layout='wide',
initial_sidebar_state='expanded'
)
# ─────── Cache ───────
@st.cache_data
def load_data():
orders = generate_orders()
marketing = generate_marketing()
orders['date'] = pd.to_datetime(orders['date'])
marketing['date'] = pd.to_datetime(marketing['date'])
return orders, marketing
orders, marketing = load_data()
# ─────── Sidebar ───────
with st.sidebar:
st.image('https://via.placeholder.com/200x60?text=YourBrand', width=200)
st.markdown('### 🎯 Filters')
min_d = orders['date'].min().date()
max_d = orders['date'].max().date()
date_range = st.date_input('Date Range', value=(min_d, max_d),
min_value=min_d, max_value=max_d)
cities = ['All'] + sorted(orders['city'].unique().tolist())
sel_city = st.selectbox('City', cities)
cats = sorted(orders['category'].unique().tolist())
sel_cats = st.multiselect('Categories', cats, default=cats)
st.markdown('---')
st.caption('Built with Streamlit + Plotly')
st.caption('© ABCL TECH 2025')
# ─────── Apply filters ───────
df = orders.copy()
if len(date_range) == 2:
df = df[(df['date'].dt.date >= date_range[0]) &
(df['date'].dt.date <= date_range[1])]
if sel_city != 'All':
df = df[df['city'] == sel_city]
df = df[df['category'].isin(sel_cats)]
mkt = marketing.copy()
if len(date_range) == 2:
mkt = mkt[(mkt['date'].dt.date >= date_range[0]) &
(mkt['date'].dt.date <= date_range[1])]
# ─────── Title ───────
st.title('🛍️ Daraz-Style E-commerce Dashboard')
st.caption('A capstone project — ABCL TECH Data Science Course')
# ─────── KPI cards ───────
col1, col2, col3, col4 = st.columns(4)
col1.metric('GMV', f'৳ {total_gmv(df)/1e7:.2f} Cr', '+১২%')
col2.metric('Orders', f'{total_orders(df):,}', '+৮%')
col3.metric('AOV', f'৳ {aov(df):,.0f}', '+২%')
col4.metric('Unique Customers', f'{unique_customers(df):,}', '+১৫%')
col5, col6, col7, col8 = st.columns(4)
col5.metric('CAC', f'৳ {cac(df, mkt):,.0f}', '-৫%', delta_color='inverse')
col6.metric('Repeat Rate', f'{repeat_rate(df):.1f}%', '+৩%')
col7.metric('Total Marketing Spend', f'৳ {mkt["spend"].sum()/1e7:.2f} Cr')
col8.metric('Avg ROAS', f'{df["gmv"].sum()/max(mkt["spend"].sum(),1):.2f}x')
st.markdown('---')
# ─────── Tabs ───────
tab1, tab2, tab3, tab4, tab5 = st.tabs([
'📈 Trends', '🛒 Categories', '🗺️ Geography',
'📡 Channels', '👥 Cohorts'])
with tab1:
st.subheader('Daily GMV Trend')
daily = daily_gmv(df)
st.plotly_chart(chart_daily_gmv(daily), use_container_width=True)
# 7-day moving average overlay
daily['ma7'] = daily['gmv'].rolling(7, min_periods=1).mean()
fig2 = px.line(daily, x='date', y=['gmv','ma7'],
title='GMV with 7-day Moving Average',
labels={'value':'GMV (BDT)','variable':''})
fig2.update_layout(template='plotly_white', height=400)
st.plotly_chart(fig2, use_container_width=True)
with tab2:
st.subheader('Category Performance')
cat_df = category_gmv(df)
st.plotly_chart(chart_category(cat_df), use_container_width=True)
st.subheader('Top 10 Best-Selling SKUs')
top10 = df.groupby('category').agg(
orders=('order_id','count'),
revenue=('gmv','sum'),
avg_price=('unit_price','mean')
).sort_values('revenue', ascending=False).head(10)
st.dataframe(top10.style.format({
'revenue':'৳{:,.0f}','avg_price':'৳{:,.0f}'}),
use_container_width=True)
with tab3:
st.subheader('Geographic Distribution')
city_df = city_gmv(df)
st.plotly_chart(chart_city(city_df), use_container_width=True)
st.subheader('City × Category Heatmap')
pivot = df.pivot_table(index='city', columns='category',
values='gmv', aggfunc='sum').fillna(0)
fig3 = px.imshow(pivot.values, x=pivot.columns, y=pivot.index,
color_continuous_scale='Blues',
aspect='auto', text_auto='.2s',
labels=dict(color='GMV'))
fig3.update_layout(template='plotly_white', height=500)
st.plotly_chart(fig3, use_container_width=True)
with tab4:
st.subheader('Marketing Channel Performance')
ch_df = channel_performance(df, mkt)
st.plotly_chart(chart_channel(ch_df), use_container_width=True)
st.subheader('Channel Details')
st.dataframe(ch_df.style.format({
'revenue':'৳{:,.0f}','spend':'৳{:,.0f}',
'cac':'৳{:,.0f}','roas':'{:.2f}x'}),
use_container_width=True)
st.info('🔍 ROAS < 1 মানে loss-making channel।')
with tab5:
st.subheader('Cohort Retention Heatmap')
st.write('প্রতিটি row একটি প্রথম-purchase month-এর cohort। '
'Column — সেই cohort-এর কত % পরবর্তী মাসগুলোয় ফিরে এসেছেন।')
if len(df) > 100:
retention = cohort_retention(df)
st.plotly_chart(chart_cohort(retention), use_container_width=True)
# M+1 retention summary
if 1 in retention.columns:
avg_m1 = retention[1].mean()
st.metric('Average M+1 Retention', f'{avg_m1:.1f}%')
else:
st.warning('Not enough data — filters relax করুন।')
# ─────── Footer ───────
st.markdown('---')
st.caption('Data is synthetic — for demo purposes only.')
৭ · Run করার নির্দেশ
# 1. Install dependencies
pip install streamlit pandas plotly numpy
# 2. সব ৪টি file save করুন একই folder-এ:
# app.py, data_loader.py, kpi.py, charts.py
# 3. Generate data (একবার)
python data_loader.py
# 4. Streamlit run
streamlit run app.py
# 5. Browser-এ http://localhost:8501
৮ · requirements.txt
streamlit==1.32.0
pandas==2.2.0
plotly==5.20.0
numpy==1.26.4
৯ · README.md template
# Daraz-Style E-commerce Dashboard
A Bangladesh-context e-commerce analytics dashboard built with
Streamlit + Plotly. Capstone project for ABCL TECH Data Science
course (Module 4 · Lesson 29).
## Features
- 📊 8 real-time KPIs (GMV, AOV, CAC, ROAS, retention, ...)
- 📈 5 dashboard tabs (Trends, Categories, Geography,
Channels, Cohorts)
- 🎯 Sidebar filters (date range, city, category)
- 👥 Cohort retention heatmap
- 🛍️ Bangladesh-realistic synthetic data (Eid spike, weekday
pattern, BD city distribution)
## Quick Start
```bash
pip install -r requirements.txt
python data_loader.py
streamlit run app.py
```
## Tech Stack
- **Frontend**: Streamlit
- **Charts**: Plotly (Express + graph_objects)
- **Data**: pandas, NumPy
- **Deploy**: Streamlit Cloud / GitHub
## Live Demo
→ https://your-app.streamlit.app
## Author
Your Name · LinkedIn: ...
ABCL TECH Data Science Capstone, 2025
১০ · Streamlit Cloud-এ deploy
- GitHub-এ repo বানান (public)।
- সব ৬টি file commit + push।
- share.streamlit.io → New app → repo + main + app.py।
- ~১ মিনিট — live URL।
- LinkedIn-এ share — portfolio-এ link।
১১ · Extension ideas — practice
- Forecast tab: Prophet দিয়ে next 30 days GMV prediction (পাঠ ২৩)।
- Customer segmentation: RFM analysis + K-means cluster।
- Funnel analysis: visit → add-to-cart → checkout → purchase।
- A/B test calculator: two variants — significance test।
- Alert system: KPI threshold cross-এ Slack/email notification।
- Real database: CSV-এর বদলে PostgreSQL/Snowflake connect।
- Authentication: Streamlit-Authenticator package।
- Bengali UI toggle: language switcher।
১২ · Performance tips
@st.cache_dataaggressive — load_data, KPI calculation।- Large dataset: pre-aggregate daily/monthly, drop transaction-level।
- Plotly:
scatterglfor >১০K points। - Streamlit fragment: tab-specific rerun (1.33+)।
- SQL backend: query just current filter, না full table।
ভাবনার প্রশ্ন
প্র ০১ এই dashboard-কে production-এ scale করতে — কী কী architectural change করতে হবে? ১০K user concurrent ধরে নিন।
Demo থেকে production journey — অনেক change।
(১) Data layer:
- CSV → PostgreSQL/Snowflake/BigQuery।
- Real-time streaming: Kafka + ClickHouse।
- Pre-aggregated rollup table — daily, weekly, monthly।
- Indexed by date, customer_id, city।
(২) Caching layer:
- Redis — hot KPI values।
- CDN — static dashboard snapshot।
- Streamlit cache + DB query cache।
(৩) Compute scaling:
- Streamlit single-process limited — Docker + Kubernetes auto-scale।
- ৪-৮ replica behind load balancer।
- Sticky session — same user → same pod।
(৪) Authentication & authorization:
- OAuth (Google, Microsoft) integration।
- Role-based access — manager vs analyst।
- Row-level security — country/region।
(৫) Performance optimization:
- Pre-computed aggregates (nightly job)।
- Lazy tab loading।
- Pagination large tables।
- Datashader for >১০ লাখ point।
(৬) Monitoring:
- Sentry — error tracking।
- Datadog — performance metrics।
- Custom KPI accuracy alert।
(৭) CI/CD pipeline:
- GitHub Actions — test + deploy।
- Staging environment।
- Blue-green deployment — zero downtime।
(৮) Cost considerations:
- Streamlit cluster: 8 × t3.large @ $50/mo = $400।
- Redis cache: $50/mo।
- PostgreSQL RDS: $200/mo (db.r5.large)।
- CDN + monitoring: $100/mo।
- Total ~$750/mo for ১০K user — reasonable।
(৯) Alternative architecture:
- Decouple frontend (React/Next.js) + backend (FastAPI)।
- BI tool migration — Power BI Premium Capacity।
- Hybrid — Streamlit prototype, Power BI scale।
(১০) Bangladesh context:
- Mobile-first — ৭০%+ user phone-এ।
- Slow internet — bandwidth-friendly mode।
- Local hosting for compliance — Bangladesh datacenter।
- Bangla typography proper rendering।
মূল উপলব্ধি: Demo simple, production complex। Streamlit ১০K সম্ভব কিন্তু effort significant; ১ লাখ+ — different stack consider।
প্র ০২ "Cohort retention" KPI কেন এত গুরুত্বপূর্ণ e-commerce-এ? কীভাবে এটা business decision-এ translate হয়?
Retention — e-commerce-এর সবচেয়ে under-rated KPI। GMV/AOV বেশি catchy, কিন্তু retention business viability-এর true indicator।
কেন critical:
- একটি retain customer-এর CAC আবার লাগে না।
- Repeat customer-এর AOV সাধারণত ১.৫-২x।
- Word-of-mouth referral retain customer থেকেই।
- Unit economics — LTV/CAC ratio retention-নির্ভর।
Cohort analysis কীভাবে কাজ করে:
- প্রতিটি গ্রাহকের প্রথম purchase month — তার "cohort"।
- Jan ২০২৪ cohort — তারা Feb, Mar, ... Dec কত % retain হলেন।
- Feb cohort আলাদাভাবে track হয়।
- Heatmap-এ — cohort × month grid, color = retention %।
কী pattern বুঝবেন:
Healthy:
- M+1 retention: ৩০-৪০% (e-commerce average)।
- M+3: ২০-৩০%।
- M+6: ১৫-২৫% (steady state)।
- Curve flatten — long-term loyal base।
Unhealthy:
- M+1 retention <১৫% — onboarding broken।
- Steep drop M+1 → M+2 — promo-driven, not loyal।
- Monotonic decline to ০ — leaky bucket।
Cohort comparison:
- Recent cohort vs old — improving/worsening?
- Channel-wise cohort — referral vs paid retention difference।
- Category-first-purchase — mobile vs fashion retention?
Business decisions:
(১) Marketing spend allocation:
- High-retention channel — double down।
- Low-retention paid channel — pause।
- Referral program ROI evidence।
(২) Onboarding investment:
- M+1 drop = first-experience problem।
- Welcome email sequence।
- First-week push notification।
- Loyalty program first-purchase।
(৩) Re-engagement campaigns:
- "M+3 churned" cohort — discount email।
- Personalized recommendation।
- Win-back specific offer।
(৪) Product strategy:
- Subscription/membership push (Daraz Mall premium)।
- Repeat-purchase category emphasis।
- Cross-sell algorithm।
(৫) LTV calculation:
- $$\text{LTV} = \sum_{m=0}^{\infty} \text{retention}(m) \cdot \text{AOV} \cdot \text{purchase\_freq}$$
- Retention curve area = LTV multiplier।
- LTV vs CAC ratio >3x → healthy unit economics।
(৬) Investor pitch:
- Cohort heatmap — instant credibility।
- "Each newer cohort better" — improving product story।
- "Steady-state retention ২০%" — predictable revenue।
Bangladesh-specific cohort patterns:
- Eid cohort — high acquisition, lower long-term retention।
- COD-only cohort — generally lower retention।
- Mobile-first cohort — higher engagement।
- Repeat festival shoppers — annual cyclical pattern।
Common mistakes:
- Aggregate retention only — cohort hidden।
- Ignoring acquisition channel cohort split।
- Short time window (1-3 months) — long-term invisible।
- Not adjusting for product launch dates।
মূল উপলব্ধি: Cohort = product-market fit-এর honest mirror। GMV growth fake হতে পারে paid acquisition দিয়ে; cohort retention deceive করা যায় না।
প্র ০৩ আপনি এই dashboard-কে portfolio-এ ব্যবহার করতে চান। কোন additional features add করবেন? কীভাবে interview-এ describe করবেন?
Portfolio dashboard — generic tutorial-এর চেয়ে standout হতে হবে।
Standout features to add:
(১) Real Bangladesh data integration:
- Kaggle Bangladesh e-commerce dataset।
- Daraz product reviews scraping (public)।
- Bangladesh Bank remittance data overlay।
(২) Predictive analytics:
- Prophet GMV forecast — next ৩০ days।
- Confidence interval band।
- Festival adjustment (Eid spike build-in)।
(৩) Customer segmentation:
- RFM analysis — Recency, Frequency, Monetary।
- K-means cluster (৫ segments)।
- "Champions, Loyal, At-Risk, Lost, New" labeling।
- Per-segment dashboard view।
(৪) Anomaly detection:
- Isolation Forest unusual order detection।
- Daily KPI threshold alert।
- Fraud pattern flagging।
(৫) Recommendation engine:
- Collaborative filtering — "users who bought X also bought Y"।
- Per-customer recommendation tab।
- Conversion rate uplift simulation।
(৬) A/B test calculator:
- Sample size calculator।
- Statistical significance test (chi-square)।
- Effect size estimation।
(৭) Sentiment analysis:
- Product review NLP।
- Bangla sentiment classifier।
- Word cloud + topic modeling।
(৮) Geographic deep-dive:
- Bangladesh choropleth district map।
- Per-district drill-down।
- Population-adjusted metrics।
(৯) Export functionality:
- PDF report generation।
- CSV download filtered data।
- Scheduled email report।
(১০) UI polish:
- Custom Streamlit theme — brand color।
- Bengali toggle।
- Dark mode।
- Mobile-responsive layout।
Interview narrative:
Setup (১ মিনিট):
- "Bangladesh e-commerce-এর data analysis problem আমাকে interest করেছে।"
- "Daraz scale-এ বুঝতে চেয়েছিলাম — কোন KPIs CEO-team প্রতিদিন দেখে।"
Technical journey (৩ মিনিট):
- "Synthetic data generator — realistic Eid spike, weekend pattern।"
- "Modular code — data_loader, kpi, charts, app — testable।"
- "Cohort analysis — সবচেয়ে interesting challenge। Pivot table + period subtraction।"
- "Plotly + Streamlit choice rationale।"
Insights demonstrated (৩ মিনিট):
- Live demo — date filter change, instant update।
- "Eid month GMV ৬০% spike — Q2/Q4 budget concentrate রাখা উচিত।"
- "Mobile category dominant — ৩০% GMV — investment justified।"
- "Sylhet cohort retention low — onboarding investigate দরকার।"
Challenges & learnings (২ মিনিট):
- "Streamlit rerun-এ early performance issue — caching solve।"
- "Cohort matrix sparse — proper period handling learn করেছি।"
- "Bengali label — Plotly font customization।"
Future work (১ মিনিট):
- "Forecast tab Prophet দিয়ে।"
- "Real Daraz API integration future plan।"
- "A/B test framework expansion।"
Demo tips:
- Live URL দিন laptop-এ pre-loaded।
- Mobile-version-ও show।
- Code repo GitHub link clean structure।
- README story-driven।
- Screenshots LinkedIn-এ regular post — visibility।
Q&A preparation:
- "Why Streamlit not React?" — speed, scope, prototype-first।
- "How would you scale to ১M users?" — architecture answer ready।
- "Real data কীভাবে integrate?" — DB connector + auth।
- "Test coverage?" — pytest unit test for kpi functions।
মূল উপলব্ধি: Project = real story। Bangladesh data + structured narrative + technical depth — competitive interviews-এ stands out।
প্র ০৪ "Synthetic data" দিয়ে portfolio দেখানো — interviewer doubt করতে পারে। কীভাবে credibility maintain করবেন?
Real data hard to come by — কিন্তু synthetic-এর reputation সমস্যা।
Synthetic data-র challenge:
- "আপনি pattern নিজেই বানিয়েছেন — তাই insight obvious।"
- "Real-world messiness নেই।"
- "Edge case handle করেননি।"
Credibility strategies:
(১) Realistic noise & messiness:
- Missing values inject (১০%)।
- Duplicate orders rare।
- Refund records (~৫%)।
- Outlier order (very large quantity)।
- Timezone inconsistency।
(২) Multi-source synthesis:
- Bangladesh population data (BBS)।
- Real festival calendar।
- Real e-commerce category mix (Daraz published)।
- Real channel attribution mix।
(৩) Validation against real benchmarks:
- "My synthetic GMV growth ২৫% — Daraz public reports ৩০-৪০% (২০২২)।"
- Industry research (eMarketer, Statista)।
- Bangladesh e-commerce association reports।
(৪) Documentation:
- "Synthetic data — generation rationale" section।
- Each parameter justification (Poisson distribution, why ৫০ orders/day)।
- Limitation acknowledged।
- Real-world deployment plan।
(৫) Mix with public real data:
- Olist Brazilian e-commerce dataset (Kaggle)।
- UCI online retail dataset।
- "This dataset for transactions, my synthetic for Bangladesh context"।
- Hybrid acceptable।
(৬) Pivoting strategy:
- "Ideal — real Daraz data, but proprietary।"
- "Synthetic generator demonstrates: data engineering + statistical modeling + business knowledge।"
- Generator code itself = portfolio piece।
(৭) Real-data follow-up project:
- Companion project — public Kaggle dataset।
- "This dashboard — same code, real Brazilian retail data।"
- Generalization demonstrates।
(৮) Web scraping public data:
- Daraz product listings (public)।
- Pricing trends (legal scraping, robots.txt respect)।
- Bangladesh Bank remittance data (open)।
- BBS census (open)।
(৯) Internship/freelance work:
- Local SME-এর জন্য pro-bono work।
- Real (small) data, real problem।
- NDA respect — anonymized portfolio।
(১০) Open data hackathons:
- Bangladesh Data Hackathon।
- Aspire to Innovate (a2i) datasets।
- Solutions portfolio-worthy।
Interview script for synthetic:
Recruiter: "এই data কোথা থেকে?"
You: "Real Bangladesh e-commerce data publicly nei — তাই realistic synthetic generator লিখেছি। parameters Bangladesh-specific: Eid spike, COD preference, mobile category dominance। Generator code itself my portfolio-এর অংশ — statistical modeling + domain knowledge demonstrate। যদি real data deploy করতে দেন — same dashboard plug-and-play।"
Strong elements:
- Honesty about limitations।
- Generator-as-skill repositioning।
- Real-world deployment readiness।
Real-data alternatives ranked:
- Internship/work data (NDA-anonymized) — best।
- Public Kaggle e-commerce dataset।
- Web-scraped public data।
- Government/NGO open data।
- Synthetic with real benchmarks — last resort but valid।
মূল উপলব্ধি: Synthetic data legitimate when properly framed। Real data preferred but not always accessible — generation skill itself valued। Honest narrative > fake claims।
অনুশীলন
-
Build it: উপরের সব ৪টি file save করুন।
streamlit run app.py। Browser-এ দেখুন।প্রথমবার চালালে synthetic data generate হবে — ১৫-২০ সেকেন্ড। তারপর সব tab চেক করুন। Filter বদলান — instant update।
Common errors: missing import, file not in same folder, port 8501 blocked।
-
Add a tab: "💰 Refunds" tab add করুন। Synthetic data-এ ৫% order refund-এ ফেলে — refund rate per category দেখান।
# data_loader.py-তে df['refunded'] = np.random.random(len(df)) < 0.05 # kpi.py-তে def refund_rate(df): return df['refunded'].mean() * 100 # app.py-এ tab6 = st.tabs(... + ['💰 Refunds']) with tab6: rate = refund_rate(df) st.metric('Overall Refund Rate', f'{rate:.1f}%') by_cat = df.groupby('category')['refunded'].mean()*100 st.bar_chart(by_cat) -
Deploy: Project-কে GitHub-এ push করুন এবং Streamlit Cloud-এ deploy করুন। Live URL share করুন।
git init; git add .; git commit -m 'init'; git push।- share.streamlit.io → New app।
- Repo + branch + app.py select।
- Wait ~১ মিনিট।
- URL share LinkedIn-এ।
আরও পড়ুন · ABCL TECH-এ আপনার পরবর্তী পদক্ষেপ
- পাঠ ৩০ · কোর্সের চূড়ান্ত পর্যালোচনা পরবর্তী পাঠ ৩০-পাঠ যাত্রার সারসংক্ষেপ — career path, ML track।
- পাঠ ২৮ · Storytelling with data আগের পাঠ Dashboard শুধু chart না — গল্পও।
- পাঠ ২৬ · Streamlit ডেটা অ্যাপ এই পাঠের সাথে সম্পর্কিত Streamlit foundation।
- সব AI Courses দেখুন ABCL TECH Python, ML, DL, NLP, CV, GenAI, RL, MLOps।