Profiling and Visualizing Raw Unstructured E-Commerce Data
Statistics & ExperimentsModel answerLast updated
A guide on auditing, aggregating, and visualizing raw e-commerce event telemetry to evaluate a product launch for executive stakeholders.
You are assigned an unversioned, undocumented dataset of e-commerce user activity and transaction records. The file contains nine attributes: order_id, user_id, event_ts (recorded in UTC), merchant_id, session_id, event_type (view, add_to_cart, purchase), amount_usd, device_type, and country.
You need to establish data reliability and prepare a clear dashboard for executive leadership evaluating launch week performance. Detail your strategy across the following five areas:
- Initial Data Profiling: Detail 10 systematic verification steps to identify data quality issues, unexpected anomalies, or structural irregularities prior to metric calculation.
- Visual Strategy: Propose 4 to 5 target visualizations (specifying titles, axes, and granularities) that answer key operational and performance questions. Explain the core insight each chart targets.
- Temporal Aggregation: Evaluate the selection of daily versus hourly granularities during a rollout week. Outline trade-offs and describe an implementation method to handle dynamic resampling.
- Data Anomaly Mitigation: Explain how a clock drift issue on a logging node would manifest across metrics and charts, and describe how to visually annotate and handle this anomaly.
- Dashboard & Executive Briefing: Outline a single-page executive overview wireframe (layout, primary metrics, active filters) and describe a structured approach for a 5-minute executive review.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Overview & Strategy
When auditing raw, undocumented telemetry data under time constraints, an analyst must maintain high rigor: never trust raw inputs blindly, ensure every visual supports a concrete business decision, and clearly communicate data quality caveats to stakeholders.
A structured 30-minute triage and presentation plan can be broken down as follows:
| Phase | Time Allocation | Goal |
|---|---|---|
| Data Profiling & Auditing | 0–10 mins | Load raw values, run validation checks, identify bad records |
| Metric Modeling & Aggregation | 10–20 mins | Define base metrics, deduplicate orders, establish baseline trends |
| Visual Design & Wireframing | 20–27 mins | Map business questions to specific visual outputs and layout |
| Stakeholder Briefing Prep | 27–30 mins | Formulate clear narrative, executive takeaways, and known risks |
Step 1: Ten Initial Data Quality Verification Checks
Load data initially using raw string types to prevent silent type coercion errors (e.g., implicit parsing of invalid dates to NaN).
import pandas as pd
# Load initial data as string to prevent silent coercion
df = pd.read_csv("telemetry_log.csv", dtype=str)
# Explicit parsing
df["ts"] = pd.to_datetime(df["event_ts"], utc=True, errors="coerce")
df["amount"] = pd.to_numeric(df["amount_usd"], errors="coerce")
# Filter purchase events
purchases = df[df["event_type"].str.lower() == "purchase"]
- Schema Integrity & Timestamp Parsing: Confirm overall row counts, data types, and check for unparseable timestamp formats or missing timezone offsets (
df['ts'].isna()). - Missing Value Contextual Analysis: Verify that non-purchase events (
view,add_to_cart) lackorder_idandamount_usd, while 100% ofpurchaseevents possess valid, non-null values for both. - Deduplication Audit: Evaluate row-level duplicates, duplicate
(session_id, event_type, ts)triples, and duplicateorder_idvalues on purchases (which indicate retried webhooks or double-counted conversions). - Session Sequence Monotonicity: Check that logical event ordering holds per
session_id(e.g.,viewtimestamp $\le$add_to_carttimestamp $\le$purchasetimestamp). Flag sessions where purchase timestamps precede view events. - Diurnal Pattern & Timezone Sanity: Aggregate event counts by UTC hour broken down by
country. Ensure local peak usage aligns with standard diurnal patterns (e.g., US evening activity occurring between 00:00–04:00 UTC). Shifts indicate local timestamps were logged without offset conversion. - Domain Categorical Hygiene: Inspect distinct string values in
event_type,device_type, andcountryfor casing inconsistencies (iOSvsios), trailing spaces, non-standard ISO country codes, or high missingness. - Monetary Distribution & Outliers: Analyze minimum, median, 99th percentile, and maximum values for
amount_usd. Inspect non-positive values ($\le 0$) which may represent refunds, test activity, or administrative adjustments, as well as extreme values (e.g., $99,999 test transactions). - Currency & Unit Consistency: Verify unit scale by computing median spend per merchant. A median 100$\times$ higher for specific merchants suggests values recorded in cents rather than dollars. Compare country-level medians to detect unconverted local currencies.
- Entity Mapping & Referential Integrity: Confirm structural relationships: every
order_idmaps to a singleuser_idandmerchant_id, and everysession_idmaps to a singleuser_id. - Coverage Uniformity: Validate spatial-temporal density across dimensions (e.g., check for zero event counts in specific
country$\times$device_typecombinations) to detect client-side telemetry drop-offs.
Step 2: Visualization Strategy
Core metrics are defined as:
- GMV: $\sum \text{amount_usd}$ over unique purchase orders.
- Conversion Rate: $\frac{\text{Sessions with Purchase}}{\text{Total Unique Sessions}}$.
- Average Order Value (AOV): $\frac{\text{GMV}}{\text{Total Unique Orders}}$.
+-----------------------------------------------------------------------------------+
| CHART 1: Executive Trend Overview |
| Dual-Axis: Daily GMV ($) [Bars] vs Total Orders (#) [Line] |
| Benchmark: Ghost Line showing Prior-Week GMV |
+-----------------------------------------------------------------------------------+
| CHART 2: Conversion Funnel |
| Horizontal Stage Progression: Sessions (View -> Cart -> Purchase) |
| Comparison: Launch Week vs Pre-Launch Baseline (%) |
+-----------------------------------------------------------------------------------+
| CHART 3: Regional & Hardware Heatmap |
| Matrix: Country (Y-Axis) vs Device Type (X-Axis) |
| Cell Metric: Session Conversion Rate (%) | Greyed out if N < threshold |
+-----------------------------------------------------------------------------------+
| CHART 4: Revenue Drivers (Waterfall) |
| Step-wise Impact: Prior Baseline -> Traffic Vol -> Conversion % -> AOV -> Launch |
+-----------------------------------------------------------------------------------+
Detailed Breakdown
-
Daily GMV & Order Volume vs. Prior Week Baseline
- Visual Specs: Dual-axis line/bar chart. Primary Y-axis: GMV ($, bars). Secondary Y-axis: Order count (solid line). X-axis: Date. Includes a dashed line for prior-week baseline GMV.
- Question Addressed: What is the baseline performance trajectory of the launch?
- Expected Insight: Isolates whether total revenue growth is driven by increased transaction counts or higher spend per transaction.
-
Conversion Funnel Efficiency by Launch Phase
- Visual Specs: Horizontal conversion funnel showing relative session rates:
View$\rightarrow$Add to Cart$\rightarrow$Purchase. Side-by-side bar comparison between launch week and pre-launch baseline. - Question Addressed: Where in the purchasing funnel are users dropping off?
- Expected Insight: Determines if lower conversion stems from product discovery issues (view to cart) or checkout friction (cart to purchase).
- Visual Specs: Horizontal conversion funnel showing relative session rates:
-
Conversion Performance Matrix (Device $\times$ Country)
- Visual Specs: Heatmap displaying
countryon the Y-axis anddevice_typeon the X-axis. Cell color intensity represents overall conversion rate. Cells with low sample sizes ($N < 100$ sessions) are greyed out. - Question Addressed: Are performance bottlenecks isolated to specific client platforms or geographic markets?
- Expected Insight: Identifies targeted technical bugs, such as a checkout failure on Android devices in a specific region.
- Visual Specs: Heatmap displaying
-
GMV Growth Waterfall Decomposition
- Visual Specs: Waterfall chart step-building from baseline GMV to current GMV. Steps show contributions from: Traffic Volume Change, Conversion Rate Change, and Average Order Value (AOV) Change.
- Question Addressed: Which underlying lever contributed most to the net change in revenue?
- Expected Insight: Provides executives with a clear breakdown of growth drivers.
Step 3: Temporal Aggregation Strategy
Trade-off Analysis: Daily vs. Hourly Grain
| Dimension | Daily Aggregation | Hourly Aggregation |
|---|---|---|
| Primary Audience | C-Suite / Executive Leadership | Operations & Engineering Teams |
| Noise & Volatility | Smooths out diurnal fluctuations | High variance; prone to intraday noise |
| Use Case | Macro performance evaluation | Outage detection, deployment tracking |
| Data Volume | Low footprint ($7$ points/week) | Higher density ($168$ points/week) |
Parameterized Resampling Implementation
When computing rates at aggregate time intervals, compute sums of numerators and denominators independently before dividing. Avoid taking the arithmetic mean of pre-calculated rates.
def aggregate_telemetry(df: pd.DataFrame, grain: str = "D") -> pd.DataFrame:
"""
Resamples telemetry logs dynamically.
grain: 'D' for Daily, 'h' for Hourly.
"""
# Filter valid unique purchases
purchases = (
df[df["event_type"] == "purchase"]
.drop_duplicates(subset=["order_id"])
.set_index("ts")
)
# Session counts
sessions = df.set_index("ts").resample(grain)["session_id"].nunique()
# Transaction aggregation
tx_agg = purchases.resample(grain).agg(
gmv=("amount", "sum"),
orders=("order_id", "nunique"),
paying_sessions=("session_id", "nunique")
)
# Merge and calculate derived metrics
result = pd.concat([tx_agg, sessions.rename("total_sessions")], axis=1).fillna(0)
result["conversion_rate"] = result["paying_sessions"] / result["total_sessions"]
result["aov"] = result["gmv"] / result["orders"]
return result
Step 4: Data Anomaly Mitigation (Clock Drift Analysis)
Manifestation of Clock Skew
If a server cluster experiences a positive $+9$ hour time offset on Wednesday:
- Hourly Trend Visuals: Intraday curves skew unnaturally, showing artificial midnight spikes or unexpected zero-activity windows.
- Daily Aggregated Visuals: Wednesday traffic appears artificially depressed while Thursday traffic spikes, as late Wednesday events get allocated to Thursday UTC.
- Funnel & Session Monotonicity: Timestamp order breaks (
purchaserecorded prior toview), leading to negative session durations. - Cross-Day Session Attribution: Conversion rates distort because views and purchases from the same session fall into different calendar days.
Mitigation and Visualization Protocol
- Visual Annotation: Highlight the impacted period with a vertical shaded warning band (e.g., grey hatch pattern) labeled "Server Time Sync Issue (Wed 12:00 UTC - Thu 03:00 UTC)".
- Corrective Adjustment:
- If the time offset is known (+9 hours), apply a corrective offset (
ts_adjusted = ts - pd.Timedelta(hours=9)) specifically for telemetry originating from affected host IDs. - If the drift is inconsistent, exclude the affected server cohort from baseline trends and add an explicit footnote stating the estimated impact (e.g., “Excludes ~4.2% of web traffic due to timestamp synchronization error”).
- If the time offset is known (+9 hours), apply a corrective offset (
Step 5: Executive Dashboard & Briefing Plan
Single-Page Dashboard Layout Wireframe
+-----------------------------------------------------------------------------------+
| HEADER: Launch Performance Dashboard | Filters: [Date Range] [Country] [Device] |
+-----------------------------------------------------------------------------------+
| KPI SUMMARY CARDS |
| [ GMV: $1.2M (+14%) ] [ Orders: 18.4K (+8%) ] [ CVR: 3.2% (-0.3%) ] [ AOV: $65 ]|
+-----------------------------------------------------------------------------------+
| MAIN VISUAL (LEFT 60%) | SECONDARY VISUAL (RIGHT 40%) |
| Daily GMV & Order Volume | Conversion Funnel Comparison |
| (Bars: GMV, Line: Orders, Ghost: Prev) | (Baseline vs Launch Week) |
+-----------------------------------------------------------------------------------+
| BREAKDOWN VISUAL (LEFT 50%) | WATERFALL VISUAL (RIGHT 50%) |
| Country x Device Conversion Heatmap | GMV Growth Factor Breakdown |
+-----------------------------------------------------------------------------------+
| FOOTNOTE: Data Quality Note: Server clock drift on Wed corrected via session ids. |
+-----------------------------------------------------------------------------------+
5-Minute Executive Briefing Outline
- Minute 1: Top-Line Performance: Present headline KPIs (GMV, Order Count, Conversion Rate). State immediately whether launch targets were met.
- Minute 2: Core Growth Drivers: Use the Waterfall Chart to explain why performance shifted (e.g., "Revenue grew +14% driven primarily by a +20% increase in total traffic volume, despite a minor drop in conversion rate").
- Minute 3: Funnel & Segment Friction: Present the Heatmap and Funnel charts to highlight targeted opportunities (e.g., "Conversion dropped on mobile Android devices in LATAM due to checkout page drop-offs").
- Minute 4: Data Integrity & Reliability: Proactively state key data caveats (e.g., "Wednesday telemetry experienced clock drift; timestamps were reconstructed using session logs with high confidence").
- Minute 5: Key Takeaways & Action Items: Provide 2–3 clear operational recommendations (e.g., prioritize mobile checkout bug fixes; reallocate marketing spend toward high-AOV regions).