DataVis Client is a multi-sensor data analysis and visualization toolkit for health research. It's a full-stack Next.js application that processes CSV/Excel sensor data through Python preprocessing pipelines and renders interactive time series visualizations with AI-powered insights.
npm run dev # Start Next.js dev server (Turbopack)
npm run genkit:dev # Start Genkit AI development server
npm run build # Production build
npm run lint # ESLint
npm run typecheck # TypeScript check (tsc --noEmit)Python scripts are executed via Node.js child_process. Python 3 with pandas, matplotlib, seaborn, and openpyxl is required.
- Upload/Import → User uploads CSV/Excel files or imports from Google Drive
- Preprocessing →
/api/python/runexecutespython_scripts/preprocess.pywhich routes to specialized preprocessors:preprocessors/metawear.py- MetaWear pressure sensorspreprocessors/palanalysis.py- PALanalysis activity datapreprocessors/glucose.py- CGM glucose monitoringpreprocessors/k5.py- COSMED K5 metabolic cart datapreprocessors/generic.py- Auto-detection fallback
- State Management → Processed data stored as
RawDataEntry[]in main page state - Visualization →
src/lib/csv.tshandles time coercion, downsampling, and interpolation; Recharts renders charts - AI Analysis → Genkit flows in
src/ai/flows/provide outlier detection, question answering, and Python script generation
src/app/- Next.js App Router pages and API routessrc/app/page.tsx- Main DataVis Client page (primary orchestrator component)src/app/sandboxing/- Visualization sandbox for batch processingsrc/ai/flows/- Genkit AI prompts and flows (Zod-validated)src/components/- React components including Shadcn/ui primitives inui/src/lib/csv.ts- CSV parsing, downsampling, timeline building, series interpolationsrc/server/python/runner.ts- Python subprocess executionpython_scripts/- Python preprocessing and export scripts
POST /api/python/run- Execute preprocessing on uploaded filesPOST /api/drive/process-folder- Google Drive folder import with retry/backoffPOST /api/sandbox/generate-script- LLM-generated visualization scriptsPOST /api/run-export- Execute export scripts frompython_scripts/
- Time values are coerced to elapsed seconds relative to first timestamp
- Series names are mangled as
${metric} (${fileName})for multi-file support - Charts downsample to max 1000 points for performance
buildTimeline()andinterpolateSeriesValues()align multi-file data on a uniform time grid
Required in .env or .env.local:
GEMINI_API_KEY- Google Gemini APINEXT_PUBLIC_GOOGLE_CLIENT_ID- OAuth client for DriveNEXT_PUBLIC_GOOGLE_API_KEY- Google API keyOPENAI_API_KEY- OpenAI API (optional, for script generation)
- Dark mode default with light mode toggle
- Colors: Steel blue (#4682B4) primary, Salmon (#FA8072) accent
- Fonts: Inter (body), Source Code Pro (code)
- Tailwind CSS with HSL color variables