How yashumani/drill-down-anamoly works
Purpose and runtime
Drill-down Anomaly Lab is a client-side React/TypeScript research prototype for investigating tabular-data anomalies across all eligible dimensions rather than following a predefined drill hierarchy. The browser app accepts CSV/JSON or deterministic demo data, derives anomaly drivers and interactions, and renders an investigation tree.
Entry points are src/main.tsx (React bootstrap) and src/App.tsx (application state and orchestration). Static deployment artifacts are published through .github/workflows/pages.yml.
Data ingestion and schema boundary
src/lib/io.ts parses CSV and JSON into tabular row objects. src/data/sampleData.ts supplies the built-in synthetic dataset for validation and demonstration.
src/lib/profile.ts profiles columns and classifies numeric measures, categorical dimensions, dates, booleans, and identifier-like/high-cardinality fields. This inferred schema is the boundary between arbitrary input data and the analytical engine; only eligible dimensions and selected numeric measures enter scoring.
Shared row, profile, investigation, and visualization contracts are centralized in src/types.ts.
Investigation state and cohort control
src/App.tsx owns the selected Actual measure, optional Expected/Target measure, dataset/profile state, and the active drill path. Each drill selection is treated as an added cohort filter, not as navigation within a static dimension tree.
A new cohort triggers a full re-analysis of the filtered rows. The resulting path records investigation history and allows the UI to compare the current population with selected segment populations.
Anomaly analysis engine
src/lib/anomaly.ts is the core analytical stage. For each cohort it computes row residuals (actual - expected, or a cohort-mean baseline), independently groups all eligible dimensions, and ranks dimensions using interpretable impact, surprise, variance concentration, and support signals.
It then ranks category values by variance contribution and searches pruned two- and three-way interactions among leading dimensions/categories. This is intentionally browser-scale computation; enterprise-scale group-bys, scoring, interaction search, authorization, and row evidence should move behind the same UI-facing contract.
Chat and analytical assistance
src/lib/chatEngine.ts provides the local chat/investigation assistant behavior used by src/components/ChatPanel.tsx. It operates on the app’s current analytical context rather than representing a documented external AI service integration.
The chat panel is therefore a presentation/control surface over client-side investigation state, alongside visual drill actions.
Visualization and user interaction
src/components/Visuals.tsx renders the investigation tree, all-dimension driver landscape, category contributions, interaction segments, KPI summaries, and audit-oriented views. Selecting a category or interaction feeds a new cohort filter back to src/App.tsx.
src/components/EChart.tsx is the reusable chart adapter, isolating chart-library lifecycle concerns from analytical and state-management logic. src/styles.css provides the application styling layer.
Deployment and documentation
The app is a static frontend built with the npm scripts in package.json; no server, database, or external API is represented in the repository. GitHub Pages deployment is configured at .github/workflows/pages.yml.
Research rationale and implementation-oriented architecture notes live in docs/all-dimension-investigation-tree.md and docs/prototype-architecture.md; the generated/static site surface is under docs/ and index.html.
Main entry points: App.tsx App orchestration · Visuals.tsx Investigation views · types.ts Shared contracts · ChatPanel.tsx Chat panel
Components 17
Browser UI
- React bootstrap
src/main.tsx - App orchestration · Owns measures, schema, cohort, and drill path.
src/App.tsx - Investigation views · Tree, drivers, contributions, interactions, KPIs, and audit views.
src/components/Visuals.tsx - Chart adapter
src/components/EChart.tsx - Chat panel
src/components/ChatPanel.tsx - Application styles
src/styles.css
Analysis Pipeline
- CSV/JSON parser · Converts uploaded files into tabular rows.
src/lib/io.ts - Schema profiler · Classifies measures, dimensions, dates, booleans, and identifiers.
src/lib/profile.ts - Anomaly engine · Scores drivers, category contributions, and pruned interactions.
src/lib/anomaly.ts - Local investigation assistant · Uses the current client-side analytical context.
src/lib/chatEngine.ts - Shared contracts · Rows, profiles, investigations, and visualization contracts.
src/types.ts
Data Sources
- CSV/JSON input
- Synthetic demo data
src/data/sampleData.ts
Delivery & Docs
- GitHub Pages deploy
.github/workflows/pages.yml - Static site surface
index.html - Research rationale
docs/all-dimension-investigation-tree.md - Prototype architecture notes
docs/prototype-architecture.md
Connections 20
- React bootstrap → App orchestration: mounts
- CSV/JSON input → CSV/JSON parser: parse
- Synthetic demo data → App orchestration: demo rows
- CSV/JSON parser → Schema profiler: tabular rows
- Schema profiler → App orchestration: inferred schema
- App orchestration → Anomaly engine: filtered cohort and measures
- Anomaly engine → App orchestration: ranked investigation
- App orchestration → Investigation views: state and results
- Investigation views → App orchestration: category/interaction drill · Adds a cohort filter and triggers re-analysis.
- Investigation views → Chart adapter: render charts
- App orchestration → Chat panel: analytical context
- Chat panel → Local investigation assistant: assistant request
- Local investigation assistant → Chat panel: local response
- Shared contracts → App orchestration: shared types
- Shared contracts → Anomaly engine: shared types
- Shared contracts → Investigation views: shared types
- Application styles → App orchestration: styles
- Static site surface → GitHub Pages deploy: published by
- GitHub Pages deploy → Static site surface: deploys
- Research rationale → Prototype architecture notes: complements