5.7 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 02-data-persistence-file-management | 02 | execute | 1 |
|
true |
|
|
-
If file list exceeds viewport:
- Enable native scroll (overflow-y: auto)
- Or add pagination controls (Previous/Next buttons)
-
For touch-optimized scrolling on 7" display:
- Ensure smooth scrolling with -webkit-overflow-scrolling: touch
- Minimum touch target size: 48px for all interactive elements
-
Add file count display:
- "Showing X of Y files"
- Update after scroll/filter
-
Optional enhancements:
- Sort by date (newest first)
- Filter by filename search
- These are "OpenCode's Discretion" - implement if straightforward
The key requirement is FILE-03: User can navigate file list (scroll up/down) to find specific files. Test by loading files page with multiple files and verifying scroll works User can scroll through file list to find specific files
task 2: Add tidEDA export API endpoint src/app.py Add POST /api/files/export endpoint to src/app.py:@app.route('/api/files/export', methods=['POST'])
def api_files_export():
"""Generate tidEDA formatted export from CSV file"""
data = request.get_json() or {}
filename = data.get('filename')
if not filename:
return jsonify({"error": "filename required"}), 400
# Validate filename (security: prevent path traversal)
if '..' in filename or '/' in filename or '\\' in filename:
return jsonify({"error": "invalid filename"}), 400
# Ensure .csv extension
if not filename.endswith('.csv'):
filename = filename + '.csv'
# Read the CSV file
file_path = os.path.join(LOGGER_DIR, filename)
if not os.path.exists(file_path):
return jsonify({"error": "file not found"}), 404
# Generate tidEDA format
# Structure:
# $STATION,{station_id}
# $DATETIME,{timestamp}
# $DATA
# {original_csv_content}
# $END
settings = load_settings()
station_id = settings.get("station", {}).get("id", "UNKNOWN")
with open(file_path, 'r') as f:
csv_content = f.read()
tideda_content = f"$STATION,{station_id}\n"
tideda_content += f"$DATETIME,{datetime.now().isoformat()}\n"
tideda_content += "$DATA\n"
tideda_content += csv_content
tideda_content += "$END\n"
return jsonify({
"filename": filename.replace('.csv', '.tideda'),
"content": tideda_content,
"format": "tidEDA v1.0"
})
Add LOGGER_DIR constant at top of file:
LOGGER_DIR = os.path.join(os.path.dirname(__file__), 'data', 'logger')
os.makedirs(LOGGER_DIR, exist_ok=True)
-
Add "Export" button next to each file or as a bulk action:
- Button with download icon
- Calls POST /api/files/export
-
Handle export response:
- Receive tidEDA formatted content
- Trigger browser download as .tideda file
-
Add JavaScript download helper:
function downloadFile(filename, content) {
const blob = new Blob([content], {type: 'text/plain'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
URL.revokeObjectURL(url);
}
- Add "Generate tidEDA" button at top of page for exporting selected/all files
This satisfies FILE-05: User can generate tidEDA formatted files for data transmission. Verify export button exists in UI and triggers download User can generate and download tidEDA formatted files
- Scroll navigation works smoothly - tidEDA export generates correct format - Download works in browser<success_criteria> User can navigate file list with scrolling and generate tidEDA formatted files for transmission </success_criteria>
After completion, create `.planning/phases/02-data-persistence-file-management/02-02-SUMMARY.md`