Files
GlowTrack/specs/001-glowtrack-a-mood/data-model.md
Danilo Reyes 2f096d0265 feat: Add GlowTrack mood and habit wellbeing grid specifications
- 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.
2025-09-18 00:36:13 -06:00

80 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 (0360)
- intensity: number (01)
- 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