- Introduced export schema for JSON data structure. - Created renderer contract detailing canvas/SVG rendering requirements. - Defined IndexedDB storage schema and migration strategies. - Documented data model including entities and relationships. - Developed implementation plan outlining execution flow and project structure. - Provided quickstart guide for development environment setup. - Compiled research documentation on performance, accessibility, and theming. - Established feature specification with user scenarios and functional requirements.
80 lines
2.1 KiB
Markdown
80 lines
2.1 KiB
Markdown
# Data Model — GlowTrack
|
||
|
||
## Entities
|
||
|
||
### WellbeingGrid
|
||
- id: string (stable UUID)
|
||
- createdAt: ISO datetime
|
||
- updatedAt: ISO datetime
|
||
- settings: GridSettings
|
||
- days: DayTile[]
|
||
|
||
### GridSettings
|
||
- startDate: ISO date
|
||
- endDate: ISO date
|
||
- theme: string (palette id)
|
||
- colorBlindMode: 'none' | 'protanopia' | 'deuteranopia' | 'tritanopia'
|
||
- export: ExportSettings
|
||
|
||
### ExportSettings
|
||
- pngScale: number (1.0 = screen resolution)
|
||
- includeLegend: boolean
|
||
|
||
### DayTile
|
||
- date: ISO date (YYYY-MM-DD)
|
||
- mood: Mood
|
||
- entries: HabitEntry[]
|
||
- netScore: number (derived: sum(positive weights) - sum(negative weights))
|
||
|
||
### Mood
|
||
- hue: number (0–360)
|
||
- intensity: number (0–1)
|
||
- note?: string
|
||
|
||
### HabitEntry
|
||
- id: string (UUID)
|
||
- type: 'positive' | 'negative'
|
||
- habitId: string
|
||
- label: string
|
||
- weight: number (default 1; negative weights discouraged — use type)
|
||
- timestamp: ISO datetime
|
||
|
||
### HabitDefinition
|
||
- id: string (UUID)
|
||
- type: 'positive' | 'negative'
|
||
- label: string
|
||
- icon?: string (for UI glyphs)
|
||
- defaultWeight: number (default 1)
|
||
- archived: boolean
|
||
|
||
## Relationships
|
||
- WellbeingGrid has many DayTile
|
||
- DayTile has many HabitEntry
|
||
- HabitEntry references HabitDefinition via habitId
|
||
|
||
## Derived/Display Rules
|
||
- Base hue = mood.hue
|
||
- Glow luminance = function(netScore) with gentle easing; clamp to range
|
||
- Negative entries add subtle static texture overlay
|
||
- Glyphs: ticks for positive count; dots for negative count
|
||
|
||
## Validation Rules
|
||
- Dates must be valid ISO; no duplicates for DayTile.date
|
||
- HabitEntry.weight > 0; type determines sign for net score
|
||
- netScore recomputed on add/update/delete of entries
|
||
- Schema version must be present in exported JSON
|
||
|
||
## JSON Export Structure (high level)
|
||
- version: string (semver)
|
||
- app: { name: 'GlowTrack', version: string }
|
||
- exportedAt: ISO datetime
|
||
- data: { settings, habits: HabitDefinition[], days: DayTile[] }
|
||
|
||
## IndexedDB Stores (overview)
|
||
- stores:
|
||
- settings (key: 'singleton')
|
||
- habits (key: id)
|
||
- days (key: date)
|
||
- entries (key: id, index: date, index: habitId)
|
||
- versioning: bump on schema change; write migrations per version
|