Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
ref, feat: added id for posture and documented prop_good
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellJC committed Aug 16, 2024
1 parent 3645096 commit e43680e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion client/data/resources/database.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions client/data/routines.py
Original file line number Diff line number Diff line change
@@ -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")


Expand All @@ -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)
Expand Down

0 comments on commit e43680e

Please sign in to comment.