-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.html
More file actions
280 lines (253 loc) · 13.7 KB
/
Copy pathupload.html
File metadata and controls
280 lines (253 loc) · 13.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cognify - Upload Dataset</title>
<link rel="stylesheet" href="css/upload.css">
<link rel="stylesheet" href="css/apple-health-styles.css">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50 15L45 35 25 40 37 52 32 72 50 62 68 72 63 52 75 40 55 35z' fill='%231db954'/></svg>">
</head>
<body>
<!-- UPLOAD DATASET SCREEN -->
<div id="upload-selection" class="album-selection">
<div class="album-header">
<div class="logo-small">
<svg width="36" height="36" viewBox="0 0 24 24">
<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z" fill="#1db954" />
</svg>
<span>Cognify</span>
</div>
<h2>Upload Your Dataset</h2>
</div>
<div class="back-navigation">
<a href="albums.html" class="back-link">
<svg width="16" height="16" viewBox="0 0 24 24">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z" fill="currentColor"/>
</svg>
Back to Datasets
</a>
</div>
<!-- Upload instructions -->
<div class="upload-instructions">
<div class="instruction-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="#1db954">
<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/>
</svg>
</div>
<div class="instruction-content">
<h3>Upload Your Stress Dataset</h3>
<p>Upload a CSV file or Apple Health export containing time-series data for stress-related measurements. Your file should include:</p>
<ul>
<li>A timestamp column (time, date, or sequence)</li>
<li>At least one measurement column (heart rate, GSR, etc.)</li>
<li>Optional: subject/participant column if multiple subjects</li>
</ul>
</div>
</div>
<!-- Tab Navigation -->
<div class="tab-navigation">
<button class="tab-button active" data-tab="csv-upload">CSV Upload</button>
<button class="tab-button" data-tab="apple-health">Apple Health</button>
</div>
<!-- CSV Upload Section -->
<div class="upload-section" id="csv-upload-section">
<div class="upload-area" id="upload-area">
<input type="file" id="csv-file" accept=".csv" hidden>
<div class="upload-prompt">
<svg width="48" height="48" viewBox="0 0 24 24" fill="#1db954">
<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/>
</svg>
<h3>Drag & Drop Your CSV File</h3>
<p>or</p>
<button id="browse-button" class="browse-button">Browse Files</button>
</div>
<div id="file-info" class="file-info hidden">
<div class="file-preview">
<svg width="36" height="36" viewBox="0 0 24 24" fill="#1db954">
<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>
</svg>
<div class="file-details">
<span id="file-name">No file selected</span>
<span id="file-size"></span>
</div>
</div>
<button id="remove-file" class="remove-file">
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
</svg>
</button>
</div>
</div>
</div>
<!-- Apple Health Upload Section -->
<div class="upload-section apple-health-section hidden" id="apple-health-section">
<div class="upload-area" id="apple-health-upload-area">
<input type="file" id="apple-health-file" accept=".zip" hidden>
<div class="upload-prompt">
<svg width="48" height="48" viewBox="0 0 24 24" fill="#FF2D55" class="apple-health-icon">
<path d="M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1zm-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4.5-4H7V4h9v14z"/>
</svg>
<h3>Drag & Drop Your Apple Health Export.zip</h3>
<p>or</p>
<button id="apple-health-browse-button" class="browse-button">Browse Files</button>
</div>
<div id="apple-health-file-info" class="file-info hidden">
<div class="file-preview">
<svg width="36" height="36" viewBox="0 0 24 24" fill="#FF2D55" class="apple-health-icon">
<path d="M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1zm-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4.5-4H7V4h9v14z"/>
</svg>
<div class="file-details">
<span id="apple-health-file-name">No file selected</span>
<span id="apple-health-file-size"></span>
</div>
</div>
<button id="apple-health-remove-file" class="remove-file">
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
</svg>
</button>
</div>
</div>
</div>
<!-- CSV Data configuration -->
<div id="data-configuration" class="data-configuration hidden">
<h3>Configure Your Dataset</h3>
<!-- Data preview table -->
<div class="preview-section">
<h4>Preview</h4>
<div class="preview-table-container">
<table id="preview-table" class="preview-table"></table>
</div>
</div>
<!-- Configuration options -->
<div class="config-section">
<h4>Configuration</h4>
<div class="config-item">
<label for="timestamp-column">Timestamp Column:</label>
<select id="timestamp-column" class="config-select"></select>
<div class="tooltip">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
</svg>
<span class="tooltiptext">Select the column that represents time (required)</span>
</div>
</div>
<div class="config-item">
<label for="metric-column">Metric Column:</label>
<select id="metric-column" class="config-select"></select>
<div class="tooltip">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
</svg>
<span class="tooltiptext">Select the column containing your stress data (required)</span>
</div>
</div>
<div class="config-item">
<label for="metric-name">Custom Metric Name:</label>
<input type="text" id="metric-name" class="config-input" placeholder="e.g., Heart Rate (BPM)">
</div>
<div class="config-item">
<label for="subject-column">Subject Column:</label>
<select id="subject-column" class="config-select">
<option value="">None (Single Subject)</option>
</select>
<div class="tooltip">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
</svg>
<span class="tooltiptext">If your dataset includes multiple subjects, select the column that identifies them</span>
</div>
</div>
<div class="config-item">
<label for="dataset-name">Dataset Name:</label>
<input type="text" id="dataset-name" class="config-input" placeholder="e.g., My Stress Study">
</div>
<div class="config-item checkbox-item">
<label for="create-average">
<input type="checkbox" id="create-average" checked>
Generate average across subjects
</label>
<div class="tooltip">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
</svg>
<span class="tooltiptext">Calculate and display an average of all subjects' data</span>
</div>
</div>
</div>
<!-- Action buttons -->
<div class="action-buttons">
<button id="visualize-button" class="primary-button" disabled>Visualize Data</button>
<button id="cancel-button" class="secondary-button">Cancel</button>
</div>
</div>
<!-- Apple Health configuration -->
<div id="apple-health-configuration" class="data-configuration hidden">
<h3>Configure Apple Health Data</h3>
<div class="apple-health-metrics">
<h4>Available Metrics</h4>
<div id="apple-health-metrics-list" class="apple-health-metrics-list">
<div class="loading-spinner-small"></div>
<p class="loading-message">Processing data...</p>
</div>
</div>
<div class="date-range-selection hidden" id="date-range-selection">
<h4>Select Date Range</h4>
<div class="date-range-slider-container">
<div id="date-range-slider"></div>
<div class="date-range-labels">
<span id="start-date-label">Start: N/A</span>
<span id="end-date-label">End: N/A</span>
</div>
</div>
</div>
<div class="config-item">
<label for="apple-health-dataset-name">Dataset Name:</label>
<input type="text" id="apple-health-dataset-name" class="config-input" placeholder="e.g., My Apple Health Data">
</div>
<div class="preview-section hidden" id="apple-health-preview-section">
<h4>Preview</h4>
<div class="preview-table-container">
<table id="apple-health-preview-table" class="preview-table"></table>
</div>
</div>
<div class="action-buttons">
<button id="apple-health-visualize-button" class="primary-button" disabled>Visualize Data</button>
<button id="apple-health-cancel-button" class="secondary-button">Cancel</button>
</div>
</div>
</div>
<!-- Error modal -->
<div id="error-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h2>Error</h2>
<span class="close-modal">×</span>
</div>
<div class="modal-body">
<p id="error-message"></p>
</div>
<div class="modal-footer">
<button id="error-ok" class="primary-button">OK</button>
</div>
</div>
</div>
<!-- Loading overlay -->
<div id="loading-overlay" class="loading-overlay hidden">
<div class="loading-spinner"></div>
<p>Processing your data...</p>
</div>
<!-- D3.js -->
<script src="https://d3js.org/d3.v7.min.js"></script>
<!-- JSZip for processing Apple Health export.zip -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<!-- PapaParse for CSV parsing -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.3.2/papaparse.min.js"></script>
<!-- Upload Page JavaScript -->
<script src="js/upload.js"></script>
<script src="js/apple-health-integration.js"></script>
<script src="js/loading-manager.js"></script>
<script src="js/logo-redirect.js"></script>
</body>
</html>