# Phase 2: Data Persistence & File Management - Context **Gathered:** 2026-03-12 **Status:** Ready for planning ## Phase Boundary CSV data logging to flash memory with file management UI. User can view list of CSV files, navigate/scroll through files, view file contents, delete files, and generate tidEDA formatted files for transmission to myvscada server. ## Implementation Decisions ### Storage Location - CSV files stored in `/myvscada/logger` (matches server folder structure) ### File Naming - Format: `SP{station_id}_{timestamp}.csv` (e.g., `SP001_20260312_143022.csv`) ### tidEDA Format - Standard format — matches existing system specification ### Logging Trigger - Periodic interval — configurable logging interval (e.g., every 5/10/15 minutes) ### OpenCode's Discretion - Exact logging interval default value - File retention policy (how many files to keep) - Scroll behavior (smooth scroll vs page-by-page) ## Existing Code Insights ### Reusable Assets - Flask backend already running (src/app.py) — extend with file API routes - Settings stored via existing settings API - Bootstrap 5.3 templates — can reuse for file list UI ### Established Patterns - Socket.IO for real-time updates — can use for file list refresh - RESTful API structure — follow same pattern for file endpoints - Touch-optimized UI — apply same 48px+ touch targets ### Integration Points - New file API routes: `/api/files`, `/api/files/`, `/api/files//delete` - New "Flash Memory" menu link in main navigation - Reuse calibration template structure for file list ## Specific Ideas - `/myvscada/logger` path matches the server directory structure in protocol settings - File naming matches existing convention from THE_IDEA.md (SP8020_FTP.txt style) - Standard tidEDA format per existing system specification ## Deferred Ideas None — discussion stayed within phase scope --- *Phase: 02-data-persistence-file-management* *Context gathered: 2026-03-12*