diff --git a/client/data/resources/database.dbml b/client/data/resources/database.dbml index 9541db4..befc143 100644 --- a/client/data/resources/database.dbml +++ b/client/data/resources/database.dbml @@ -7,8 +7,12 @@ Table user { } Table posture { + id INTEGER [primary key, unique, increment] user_id INTEGER [ref: > user.id] - prop_good REAL + + // Proportion of time that posture is good within period + prop_good REAL + period_start DATETIME period_end DATETIME } \ No newline at end of file diff --git a/client/data/routines.py b/client/data/routines.py index 0297aa3..ff929fe 100644 --- a/client/data/routines.py +++ b/client/data/routines.py @@ -1,11 +1,11 @@ -"""Routines that can be integrated into main control flow.""" +"""Data routines that can be integrated into main control flow.""" import sqlite3 from typing import Any from importlib import resources from pydbml import PyDBML -DATABASE_DEFINTION = resources.files("data.resources").joinpath("database.dbml") +DATABASE_DEFINITION = resources.files("data.resources").joinpath("database.dbml") DATABASE_RESOURCE = resources.files("data.resources").joinpath("database.db") @@ -16,7 +16,7 @@ def init_database() -> None: if database_file.is_file(): return - parsed = PyDBML(DATABASE_DEFINTION) + parsed = PyDBML(DATABASE_DEFINITION) init_script = parsed.sql connection = sqlite3.connect(database_file)