|
Bogdan Timofte
authored
3 weeks ago
|
1
|
# Data Type Views Optimization – Visual Guide
|
|
|
2
|
|
|
|
3
|
## Overview
|
|
|
4
|
|
|
|
5
|
Transformed HealthProbe's data type detail views from **table-heavy** to **graphics-rich** design, emphasizing visual indicators over text rows.
|
|
|
6
|
|
|
|
7
|
---
|
|
|
8
|
|
|
|
9
|
## Before & After: DataTypeSnapshotDetailView
|
|
|
10
|
|
|
|
11
|
### BEFORE (List-based)
|
|
|
12
|
```
|
|
|
13
|
┌─ Data Type ─────────────────────────┐
|
|
|
14
|
│ Name Step Count │
|
|
|
15
|
│ Identifier HKQuantity... │
|
|
|
16
|
│ Current Count 1,250 │
|
|
|
17
|
│ Previous Count 1,180 │
|
|
|
18
|
└──────────────────────────────────────┘
|
|
|
19
|
|
|
|
20
|
┌─ Range ──────────────────────────────┐
|
|
|
21
|
│ Earliest 2025-04-15 │
|
|
|
22
|
│ Latest 2025-05-13 │
|
|
|
23
|
│ ⚠️ Incomplete... │
|
|
|
24
|
└──────────────────────────────────────┘
|
|
|
25
|
|
|
|
26
|
┌─ Changes ────────────────────────────┐
|
|
|
27
|
│ Compared To 2025-05-12 15:30 │
|
|
|
28
|
│ Net Change [+70 records] │
|
|
|
29
|
│ Added Records 45 │
|
|
|
30
|
│ Disappeared 12 │
|
|
|
31
|
│ Preparing... │
|
|
|
32
|
└──────────────────────────────────────┘
|
|
|
33
|
```
|
|
|
34
|
|
|
|
35
|
**Problems:**
|
|
|
36
|
- Dense text, hard to scan
|
|
|
37
|
- Data repeated (counts in text + badge)
|
|
|
38
|
- No visual evolution story
|
|
|
39
|
- 8+ section/row layers
|
|
|
40
|
|
|
|
41
|
---
|
|
|
42
|
|
|
|
43
|
### AFTER (Graphics-rich)
|
|
|
44
|
|
|
|
45
|
```
|
|
|
46
|
┌─ Metric Comparison ───────────────────┐
|
|
|
47
|
│ Now │ │ Before │
|
|
|
48
|
│ 1,250 │ │ 1,180 │
|
|
|
49
|
├─────────────┼────┼────────────────────┤
|
|
|
50
|
│ ↗ Green +70 (5.9%) ✓ │
|
|
|
51
|
│ +70 records │
|
|
|
52
|
└───────────────────────────────────────┘
|
|
|
53
|
|
|
|
54
|
┌─ Evolution Timeline ──────────────────┐
|
|
|
55
|
│ ▲ ▲ ▲ ▼ ▲ │
|
|
|
56
|
│ 1250 1140 1100 950 1070 │
|
|
|
57
|
│ 5/8 5/9 5/10 5/11 5/12 │
|
|
|
58
|
│ │
|
|
|
59
|
│ Min 1,100 Max 1,250 Latest 1,070│
|
|
|
60
|
└───────────────────────────────────────┘
|
|
|
61
|
|
|
|
62
|
┌─ Data Range ──────────────────────────┐
|
|
|
63
|
│ 🕐 28 days 🕐 │
|
|
|
64
|
│ Apr 15 ────────────────── May 13 │
|
|
|
65
|
│ │
|
|
|
66
|
└───────────────────────────────────────┘
|
|
|
67
|
|
|
|
68
|
┌─ Record Changes ──────────────────────┐
|
|
|
69
|
│ ✚ Added 45 (78.9%) [━━━━░░] │
|
|
|
70
|
│ ✕ Gone 12 (21.1%) [░░░░░░] │
|
|
|
71
|
└───────────────────────────────────────┘
|
|
|
72
|
```
|
|
|
73
|
|
|
|
74
|
**Improvements:**
|
|
|
75
|
- ✨ One card = one story (metric, timeline, range, changes)
|
|
|
76
|
- 📊 Data shown graphically (bars, arrows, progress)
|
|
|
77
|
- 🎯 Visual hierarchy clear (size, color, position)
|
|
|
78
|
- ↕️ Evolution visible in one glance
|
|
|
79
|
- 🎨 Color-coded meaning (green ↑, red ↓, amber ⚠)
|
|
|
80
|
|
|
|
81
|
---
|
|
|
82
|
|
|
|
83
|
## Before & After: DataTypesView (List Row)
|
|
|
84
|
|
|
|
85
|
### BEFORE
|
|
|
86
|
```
|
|
|
87
|
┌─────────────────────────────────────┐
|
|
|
88
|
│ Step Count │
|
|
|
89
|
│ Now 1,250 Prev 1,180 [+70] ✓ │
|
|
|
90
|
└─────────────────────────────────────┘
|
|
|
91
|
```
|
|
|
92
|
|
|
|
93
|
**Problems:**
|
|
|
94
|
- Text metrics hard to compare
|
|
|
95
|
- Delta only shown as badge
|
|
|
96
|
- No direction indicator
|
|
|
97
|
- Dense layout
|
|
|
98
|
|
|
|
99
|
---
|
|
|
100
|
|
|
|
101
|
### AFTER
|
|
|
102
|
```
|
|
|
103
|
┌─────────────────────────────────────┐
|
|
|
104
|
│ Step Count │
|
|
|
105
|
│ Now 1250 Before 1180 │
|
|
|
106
|
│ ↗ Green +70 records ✓ │
|
|
|
107
|
└─────────────────────────────────────┘
|
|
|
108
|
```
|
|
|
109
|
|
|
|
110
|
**Improvements:**
|
|
|
111
|
- Metric boxes with proper spacing
|
|
|
112
|
- Directional arrow (↑ green, ↓ red, - gray)
|
|
|
113
|
- "New" sparkle (✨) for new data types
|
|
|
114
|
- Better visual scanning
|
|
|
115
|
|
|
|
116
|
---
|
|
|
117
|
|
|
|
118
|
## Component Reference
|
|
|
119
|
|
|
|
120
|
### MetricComparisonCard
|
|
|
121
|
Shows current vs previous with delta.
|
|
|
122
|
- **Use:** When comparing two values
|
|
|
123
|
- **Deduplicates:** 4 text rows → 1 visual card
|
|
|
124
|
- **Visual:** Color boxes, arrow indicator, percentage
|
|
|
125
|
|
|
|
126
|
### TypeEvolutionTimeline
|
|
|
127
|
Shows 5-point progression.
|
|
|
128
|
- **Use:** When you have multiple snapshots
|
|
|
129
|
- **Deduplicates:** Historical date/count rows → 1 timeline
|
|
|
130
|
- **Visual:** Bar chart, connectors, min/max stats
|
|
|
131
|
|
|
|
132
|
### RecordChangeIndicator
|
|
|
133
|
Shows added/disappeared records.
|
|
|
134
|
- **Use:** When showing record diffs
|
|
|
135
|
- **Deduplicates:** 2 text rows → 1 interactive component
|
|
|
136
|
- **Visual:** Color buttons, progress bar, percentages
|
|
|
137
|
|
|
|
138
|
### DataTypeRangeIndicator
|
|
|
139
|
Shows earliest/latest dates and quality.
|
|
|
140
|
- **Use:** When showing data capture range
|
|
|
141
|
- **Deduplicates:** 3 rows (Earliest, Latest, Quality) → 1 card
|
|
|
142
|
- **Visual:** Calendar icons, gradient bar, badge
|
|
|
143
|
|
|
|
144
|
---
|
|
|
145
|
|
|
|
146
|
## Design Principles Applied
|
|
|
147
|
|
|
|
148
|
| Principle | Implementation |
|
|
|
149
|
|-----------|-----------------|
|
|
|
150
|
| **Graphics over Text** | Arrows instead of "Increase/Decrease", bar charts instead of numbers |
|
|
|
151
|
| **Deduplication** | One visual component replaces 3-4 text rows |
|
|
|
152
|
| **Direction First** | ↑↓- symbols immediately show transition direction |
|
|
|
153
|
| **Color Coding** | Green (healthy), Red (critical), Amber (warning), Gray (neutral) |
|
|
|
154
|
| **Scanability** | Large, spaced metrics are easy to read at a glance |
|
|
|
155
|
| **Interaction** | Buttons are tappable, not just informational |
|
|
|
156
|
|
|
|
157
|
---
|
|
|
158
|
|
|
|
159
|
## Code Metrics
|
|
|
160
|
|
|
|
161
|
| Metric | Before | After | Change |
|
|
|
162
|
|--------|--------|-------|--------|
|
|
|
163
|
| DataTypeSnapshotDetailView lines | 800 | 580 | -27% |
|
|
|
164
|
| Sections/Cards | 8+ | 4 | -50% |
|
|
|
165
|
| Text rows (detail view) | 15+ | 4 | -73% |
|
|
|
166
|
| Reusable components | 0 | 4 | +400% |
|
|
|
167
|
|
|
|
168
|
---
|
|
|
169
|
|
|
|
170
|
## Testing the Views
|
|
|
171
|
|
|
|
172
|
### 1. Light Mode
|
|
|
173
|
```
|
|
|
174
|
Preview → Light (default)
|
|
|
175
|
Check: Colors visible, text readable, badges clear
|
|
|
176
|
```
|
|
|
177
|
|
|
|
178
|
### 2. Dark Mode
|
|
|
179
|
```
|
|
|
180
|
Preview → Dark
|
|
|
181
|
Check: Contrast sufficient, gradient visible, no black-on-black
|
|
|
182
|
```
|
|
|
183
|
|
|
|
184
|
### 3. Accessibility
|
|
|
185
|
```
|
|
|
186
|
VoiceOver: Read order should be: name → metrics → evolution → range → changes
|
|
|
187
|
Dynamic Type: Test at xSmall (1.0) and AX3 (1.3+)
|
|
|
188
|
```
|
|
|
189
|
|
|
|
190
|
### 4. Edge Cases
|
|
|
191
|
```
|
|
|
192
|
- No previous snapshot → show empty state
|
|
|
193
|
- No date range → show "–" placeholder
|
|
|
194
|
- Legacy record format → show warning banner
|
|
|
195
|
- Loading state → show spinner in record section
|
|
|
196
|
```
|
|
|
197
|
|
|
|
198
|
---
|
|
|
199
|
|
|
|
200
|
## Files Modified/Created
|
|
|
201
|
|
|
|
202
|
```
|
|
|
203
|
Views/DataTypes/
|
|
|
204
|
├── DataTypesView.swift (refactored row)
|
|
|
205
|
├── MetricComparisonCard.swift (NEW)
|
|
|
206
|
├── TypeEvolutionTimeline.swift (NEW)
|
|
|
207
|
├── RecordChangeIndicator.swift (NEW)
|
|
|
208
|
└── DataTypeRangeIndicator.swift (NEW)
|
|
|
209
|
|
|
|
210
|
Views/Snapshots/
|
|
|
211
|
└── DataTypeSnapshotDetailView.swift (refactored layout)
|
|
|
212
|
```
|
|
|
213
|
|
|
|
214
|
---
|
|
|
215
|
|
|
|
216
|
## Future Enhancements
|
|
|
217
|
|
|
|
218
|
1. **Animation:** Transition arrows when delta changes
|
|
|
219
|
2. **Sparklines:** Tiny mini-charts in list rows
|
|
|
220
|
3. **Inline Actions:** "Mark as OK" button directly on cards
|
|
|
221
|
4. **Comparison View:** Side-by-side cards for two data types
|
|
|
222
|
5. **Export:** Cards optimized for PDF export (medical reports)
|