Database Service¶
The DatabaseService is the heart of Nokken's data persistence layer, providing a structured interface to the SQLite database.
Key Responsibilities¶
- Managing the SQLite database schema and versioning
- Providing CRUD operations for all entity types
- Abstracting database operations from the rest of the application
- Handling error management through a custom
DatabaseException
class
Interactions with Other Services¶
- Feature modules: All feature modules interact with the database service to store and retrieve data
- State providers: Riverpod state providers use the database service to fetch data
ValidationService
: Database operations use validation to ensure data integrity
Database Schema¶
The database consists of several tables:
medications
: Stores medication informationtaken_medications
: Records which medications have been takenbloodwork
: Stores lab results and appointment informationmood_entries
: Stores daily mood and wellness metrics