rename sqlite3, remove some CSV, drop biometrics (#9)
authorShane Jaroch <chown_tee@proton.me>
Mon, 11 Jul 2022 16:04:03 +0000 (12:04 -0400)
committerGitHub <noreply@github.com>
Mon, 11 Jul 2022 16:04:03 +0000 (12:04 -0400)
22 files changed:
.editorconfig
.gitattributes
CHANGELOG.md
Makefile
README.rst
__init__.py
docs/nt.svg
docs/sqleton.sh
sql/__init__.py
sql/data/bio_log_entry.csv [deleted file]
sql/data/biometric_log.csv [deleted file]
sql/data/biometrics.csv [deleted file]
sql/data/food_log.csv [deleted file]
sql/data/profiles.csv [deleted file]
sql/data/recipe_dat.csv [deleted file]
sql/data/recipe_log.csv [deleted file]
sql/data/recipes.csv [deleted file]
sql/data/version.csv
sql/export.sh
sql/format.sh
sql/functions.sql
sql/tables.sql

index 30b02fd39331f0fc5ba802cf067afd317f6f2b09..ba6a1e802279a13134c9940c034b8f953d6fb8f6 100644 (file)
@@ -6,15 +6,19 @@ indent_size = 4
 end_of_line = lf
 charset = utf-8
 trim_trailing_whitespace = true
-insert_final_newline = true
 
 max_line_length = 100
 
 
-[*.{py}]
+[*.py]
 max_line_length = 88
 
 
+[*.sh]
+indent_style = tab
+max_line_length = 79
+
+
 [*.sql]
 indent_size = 2
 max_line_length = 80
index 0242374cf6d0a7d2adb1d5b7bd83df1e5893103e..7533c02b403ffcd71cdfec13f0af7f1a49f171d6 100644 (file)
@@ -1,2 +1 @@
 *.sql linguist-detectable
-
index 6b2cb263b7dc524c580245b6980b783bbbf717c4..b77c00aba637c1f2eb740503dcd808e1d9ca6d1f 100644 (file)
@@ -9,44 +9,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Changed
 
--   Replace grams with `msre_id` and `amt` in `food_log` table
+- Replace grams with `msre_id` and `amt` in `food_log` table
+- Rename to use `.sqlite3` extension, instead of `nt.sqlite`
+
+### Development
+
+- Enhance lint tools
+- Use `__main__.py` & `python -m sql` to package and build sqlite3 file
+
+### Added
+
+- SQL tables `bug` and `msg`, for bug reports & pushed message queue
 
 ## [0.0.4] - 2021-06-17
 
 ### Added
 
--   Empty `__init__.py` file to make packagable with `cli` repo (as a `git submodule`)
--   Tables `custom_foods` and respective `cf_dat`
+- Empty `__init__.py` file to make packageable with `cli` repo (as a `git submodule`)
+- SQL table `custom_foods` and respective `cf_dat`
 
 ### Changed
 
--   Build with `python sql/__init__.py` (removed root-level script `build.py`)
--   Rename pre-populted `meals` table to `meal_name`
+- Build with `python sql/__init__.py` (removed root-level script `build.py`)
+- Rename pre-populated `meals` table to `meal_name`
 
 ### Fixed
 
--   Slight bash inconvenience when using `export.sh`
+- Slight bash inconvenience when using `export.sh`
 
 ### Removed
 
--   `food_costs` table
+- `food_costs` table
+- `biometrics` ad related tables
 
 ## [0.0.3] - 2021-05-24
 
 ### Added
 
--   More dummy CSV data (not production ready)
--   `tagname` column to `recipes` table
+- More dummy CSV data (not production ready)
+- `tagname` column to `recipes` table
 
 ### Changed
 
--   `date` column uses `INT` type now, instead of `date`
--   Drop `created` and `updated` fields off of `rda` table, add them to `biometrics`
+- `date` column uses `INT` type now, instead of `date`
+- Drop `created` and `updated` fields off of `rda` table, add them to `biometrics`
 
 ### Removed
 
--   `last_sync` column (future release? Feature is planned, but not alloted)
--   `guid` parameter from `functions.sql`
+- `last_sync` column (future release? Feature is planned, but not allotted)
+- `guid` parameter from `functions.sql`
 
 ## [0.0.2] - 2021-05-24
 
@@ -56,29 +67,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Removed
 
--   `guid` columns (may return in a future release)
+- `guid` columns (may return in a future release)
 
 ## [0.0.1] - 2021-05-21
 
 ### Added
 
--   Version table
--   Travis CI configuration file `.travis.yml`
--   `functions.sql` for use in Python client
--   [TODO] Placeholder for initial upgrade script (`sql/upgrade_scripts/0.0.1.sql`)
--   `food_costs` table (lone table, functionality not yet implemented)
+- Version table
+- Travis CI configuration file `.travis.yml`
+- `functions.sql` for use in Python client
+- [TODO] Placeholder for initial upgrade script (`sql/upgrade_scripts/0.0.1.sql`)
+- `food_costs` table (lone table, functionality not yet implemented)
 
 ### Changed
 
--   Use Python for import script (`build.py` replaced `import.sql`)
+- Use Python for import script (`build.py` replaced `import.sql`)
 
 ## [0.0.0] - 2020-09-22
 
 ### Added
 
--   Initial release of table schema design
--   Import script `import.sql` (SQL)
--   Export script `export.sh` (Shell)
--   Rudimentary dummy data in CSV files
+- Initial release of table schema design
+- Import script `import.sql` (SQL)
+- Export script `export.sh` (Shell)
+- Rudimentary dummy data in CSV files
     (e.g. `food_log.csv`, `biometric_log.csv`, `profiles.csv`)
--   Database diagram generated via `docs/sqleton.sh`
+- Database diagram generated via `docs/sqleton.sh`
index 5bb21109e492270690ea0ca32e1dad20c2976b65..c52a3afebd338f11a580c6daf39a91cfa9ccc60c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ _help:
 
 .PHONY: clean
 clean: ## Clean up build intermediates
-       rm -f  sql/nt.sqlite
+       rm -f  sql/nt.sqlite3
        rm -rf .mypy_cache/ .pytest_cache/
        find sql/ -name __pycache__ -o -name .pytest_cache | xargs rm -rf
 
@@ -20,14 +20,14 @@ build:      ## Build sqlite image
 .PHONY: test
 test:  ## Cursory sanity check
        sqlite3 -csv -header \
-               sql/nt.sqlite \
+               sql/nt.sqlite3 \
                'SELECT * FROM bf_eqs;' \
-               'SELECT * FROM biometrics;' \
                'SELECT * FROM bmr_eqs;' \
                'SELECT * FROM meal_name;' \
                'SELECT * FROM version;' \
 
 .PHONY: install
 install:       ## Copy sqlite file into ~/.nutra
+       # TODO: does this respect if the file exists already?
        mkdir -p ~/.nutra
-       cp sql/nt.sqlite ~/.nutra
+       cp sql/nt.sqlite3 ~/.nutra
index 3dd58c8921dc7e68ebdefed452f8af424f8556a5..5d3a2b7ed56820c74b4f3713cde84df46e7a889a 100644 (file)
@@ -11,47 +11,44 @@ See CLI:    https://github.com/nutratech/cli
 
 Pypi page:  https://pypi.org/project/nutra
 
-
 Building the database
 #########################
 
-1. If you are committing database changes, add a line to ``data/version.csv``
-   (e.g. ``id=4`` is the latest in this case),
-
-+-----+----------+-------------+------------------+
-| id  | version  | created     | notes            |
-+=====+==========+=============+==================+
-| 1   | 0.0.0    | 2020-09-22  | initial release  |
-+-----+----------+-------------+------------------+
-| 2   | 0.0.1    | 2021-05-21  | bump version     |
-+-----+----------+-------------+------------------+
-| 3   | 0.0.2    | 2021-05-24  | remove guids     |
-+-----+----------+-------------+------------------+
-| 4   | 0.0.3    | 2021-05-24  | general cleanup  |
-+-----+----------+-------------+------------------+
+Create the database with.
 
-2. Create the database with,
+::
 
-.. code-block:: bash
+    make build
 
-    make
+Verify the tables were populated and exist.
 
-3. Verify the tables were populated and exist,
-
-.. code-block:: bash
+::
 
     make test
 
-4. If everything looks good, commit and update submodules in the
-   ``cli`` (python) and ``nt-android`` (java) repos.
+If everything looks good: commit, and update submodules in the ``cli`` repo.
+
+.. important:: If you are committing database changes, add a line to
+    ``sql/data/version.csv`` (``id=4`` is the latest in this case).
 
+    +-----+----------+-------------+------------------+
+    | id  | version  | created     | notes            |
+    +=====+==========+=============+==================+
+    | 1   | 0.0.0    | 2020-09-22  | initial release  |
+    +-----+----------+-------------+------------------+
+    | 2   | 0.0.1    | 2021-05-21  | bump version     |
+    +-----+----------+-------------+------------------+
+    | 3   | 0.0.2    | 2021-05-24  | remove guids     |
+    +-----+----------+-------------+------------------+
+    | 4   | 0.0.3    | 2021-05-24  | general cleanup  |
+    +-----+----------+-------------+------------------+
 
 Tables (Relational Design)
 ##########################
 
-Note: functions are kept in ``sql/functions.sql``.
+**Note:** functions are kept in ``sql/functions.sql``.
 
-See ``sql/tables.sql`` for details.
+See ``sql/tables.sql`` for details on design.
 
 This is frequently updated, see ``docs/`` for more info.
 
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c86693f28aa42eb4eff08feb83bd0da5cf462f1d 100644 (file)
@@ -0,0 +1,4 @@
+"""
+NOTE: this is used as a submodule in the cli repo (ntclient)
+ so we need this to all be packagable, e.g. have __init__.py files
+"""
index 4f1af3050604d43013921646370375433d6a539c..98c75f1e476e4aaa2262ef8a2906b23101583415 100644 (file)
 <!-- Generated by graphviz version 2.43.0 (0)
  -->
 <!-- Title: undefined Pages: 1 -->
-<svg width="1088pt" height="1576pt"
- viewBox="0.00 0.00 1087.60 1575.60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(28.8 1525.8)">
+<svg width="1159pt" height="1311pt"
+ viewBox="0.00 0.00 1158.60 1310.60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(28.8 1260.8)">
 <title>undefined</title>
-<polygon fill="white" stroke="transparent" points="-28.8,49.8 -28.8,-1525.8 1058.8,-1525.8 1058.8,49.8 -28.8,49.8"/>
-<text text-anchor="start" x="474.5" y="12.6" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">sql/nt.sqlite</text>
+<polygon fill="white" stroke="transparent" points="-28.8,49.8 -28.8,-1260.8 1129.8,-1260.8 1129.8,49.8 -28.8,49.8"/>
+<text text-anchor="start" x="506" y="12.6" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">sql/nt.sqlite3</text>
 <!-- version -->
 <g id="node1" class="node">
 <title>version</title>
-<path fill="none" stroke="black" d="M651.24,-355.64C651.24,-355.64 771.24,-355.64 771.24,-355.64 777.24,-355.64 783.24,-361.64 783.24,-367.64 783.24,-367.64 783.24,-447.64 783.24,-447.64 783.24,-453.64 777.24,-459.64 771.24,-459.64 771.24,-459.64 651.24,-459.64 651.24,-459.64 645.24,-459.64 639.24,-453.64 639.24,-447.64 639.24,-447.64 639.24,-367.64 639.24,-367.64 639.24,-361.64 645.24,-355.64 651.24,-355.64"/>
-<text text-anchor="start" x="684.24" y="-439.24" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">version</text>
-<polyline fill="none" stroke="black" points="639.24,-429.64 783.24,-429.64 "/>
-<text text-anchor="start" x="646.24" y="-416.04" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="667.24" y="-416.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="646.24" y="-399.04" font-family="Helvetica,sans-Serif" font-size="12.00">version </text>
-<text text-anchor="start" x="694.24" y="-399.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="646.24" y="-382.04" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="696.24" y="-382.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">date</text>
-<text text-anchor="start" x="646.24" y="-365.04" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
-<text text-anchor="start" x="683.24" y="-365.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<path fill="none" stroke="black" d="M83.24,-781.64C83.24,-781.64 203.24,-781.64 203.24,-781.64 209.24,-781.64 215.24,-787.64 215.24,-793.64 215.24,-793.64 215.24,-873.64 215.24,-873.64 215.24,-879.64 209.24,-885.64 203.24,-885.64 203.24,-885.64 83.24,-885.64 83.24,-885.64 77.24,-885.64 71.24,-879.64 71.24,-873.64 71.24,-873.64 71.24,-793.64 71.24,-793.64 71.24,-787.64 77.24,-781.64 83.24,-781.64"/>
+<text text-anchor="start" x="116.24" y="-865.24" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">version</text>
+<polyline fill="none" stroke="black" points="71.24,-855.64 215.24,-855.64 "/>
+<text text-anchor="start" x="78.24" y="-842.04" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="99.24" y="-842.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="78.24" y="-825.04" font-family="Helvetica,sans-Serif" font-size="12.00">version </text>
+<text text-anchor="start" x="126.24" y="-825.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="78.24" y="-808.04" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="128.24" y="-808.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">date</text>
+<text text-anchor="start" x="78.24" y="-791.04" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
+<text text-anchor="start" x="115.24" y="-791.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
 </g>
 <!-- bmr_eqs -->
 <g id="node2" class="node">
 <title>bmr_eqs</title>
-<path fill="none" stroke="black" d="M11.55,-748.03C11.55,-748.03 131.55,-748.03 131.55,-748.03 137.55,-748.03 143.55,-754.03 143.55,-760.03 143.55,-760.03 143.55,-806.03 143.55,-806.03 143.55,-812.03 137.55,-818.03 131.55,-818.03 131.55,-818.03 11.55,-818.03 11.55,-818.03 5.55,-818.03 -0.45,-812.03 -0.45,-806.03 -0.45,-806.03 -0.45,-760.03 -0.45,-760.03 -0.45,-754.03 5.55,-748.03 11.55,-748.03"/>
-<text text-anchor="start" x="40.55" y="-797.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">bmr_eqs</text>
-<polyline fill="none" stroke="black" points="-0.45,-788.03 143.55,-788.03 "/>
-<text text-anchor="start" x="6.55" y="-774.43" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="27.55" y="-774.43" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="6.55" y="-757.43" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="45.55" y="-757.43" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<path fill="none" stroke="black" d="M237.74,-0.8C237.74,-0.8 357.74,-0.8 357.74,-0.8 363.74,-0.8 369.74,-6.8 369.74,-12.8 369.74,-12.8 369.74,-58.8 369.74,-58.8 369.74,-64.8 363.74,-70.8 357.74,-70.8 357.74,-70.8 237.74,-70.8 237.74,-70.8 231.74,-70.8 225.74,-64.8 225.74,-58.8 225.74,-58.8 225.74,-12.8 225.74,-12.8 225.74,-6.8 231.74,-0.8 237.74,-0.8"/>
+<text text-anchor="start" x="266.74" y="-50.4" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">bmr_eqs</text>
+<polyline fill="none" stroke="black" points="225.74,-40.8 369.74,-40.8 "/>
+<text text-anchor="start" x="232.74" y="-27.2" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="253.74" y="-27.2" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="232.74" y="-10.2" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
+<text text-anchor="start" x="271.74" y="-10.2" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
 </g>
 <!-- bf_eqs -->
 <g id="node3" class="node">
 <title>bf_eqs</title>
-<path fill="none" stroke="black" d="M688.81,-830.99C688.81,-830.99 808.81,-830.99 808.81,-830.99 814.81,-830.99 820.81,-836.99 820.81,-842.99 820.81,-842.99 820.81,-888.99 820.81,-888.99 820.81,-894.99 814.81,-900.99 808.81,-900.99 808.81,-900.99 688.81,-900.99 688.81,-900.99 682.81,-900.99 676.81,-894.99 676.81,-888.99 676.81,-888.99 676.81,-842.99 676.81,-842.99 676.81,-836.99 682.81,-830.99 688.81,-830.99"/>
-<text text-anchor="start" x="724.81" y="-880.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">bf_eqs</text>
-<polyline fill="none" stroke="black" points="676.81,-870.99 820.81,-870.99 "/>
-<text text-anchor="start" x="683.81" y="-857.39" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="704.81" y="-857.39" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="683.81" y="-840.39" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="722.81" y="-840.39" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<path fill="none" stroke="black" d="M787.99,-237.02C787.99,-237.02 907.99,-237.02 907.99,-237.02 913.99,-237.02 919.99,-243.02 919.99,-249.02 919.99,-249.02 919.99,-295.02 919.99,-295.02 919.99,-301.02 913.99,-307.02 907.99,-307.02 907.99,-307.02 787.99,-307.02 787.99,-307.02 781.99,-307.02 775.99,-301.02 775.99,-295.02 775.99,-295.02 775.99,-249.02 775.99,-249.02 775.99,-243.02 781.99,-237.02 787.99,-237.02"/>
+<text text-anchor="start" x="823.99" y="-286.62" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">bf_eqs</text>
+<polyline fill="none" stroke="black" points="775.99,-277.02 919.99,-277.02 "/>
+<text text-anchor="start" x="782.99" y="-263.42" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="803.99" y="-263.42" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="782.99" y="-246.42" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
+<text text-anchor="start" x="821.99" y="-246.42" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
 </g>
 <!-- profiles -->
 <g id="node4" class="node">
 <title>profiles</title>
-<path fill="none" stroke="black" d="M413.74,-668.17C413.74,-668.17 533.74,-668.17 533.74,-668.17 539.74,-668.17 545.74,-674.17 545.74,-680.17 545.74,-680.17 545.74,-862.17 545.74,-862.17 545.74,-868.17 539.74,-874.17 533.74,-874.17 533.74,-874.17 413.74,-874.17 413.74,-874.17 407.74,-874.17 401.74,-868.17 401.74,-862.17 401.74,-862.17 401.74,-680.17 401.74,-680.17 401.74,-674.17 407.74,-668.17 413.74,-668.17"/>
-<text text-anchor="start" x="445.74" y="-853.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">profiles</text>
-<polyline fill="none" stroke="black" points="401.74,-844.17 545.74,-844.17 "/>
-<text text-anchor="start" x="408.74" y="-830.57" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="429.74" y="-830.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="408.74" y="-813.57" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="447.74" y="-813.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="408.74" y="-796.57" font-family="Helvetica,sans-Serif" font-size="12.00">gender </text>
-<text text-anchor="start" x="455.74" y="-796.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="408.74" y="-779.57" font-family="Helvetica,sans-Serif" font-size="12.00">dob </text>
-<text text-anchor="start" x="435.74" y="-779.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">date</text>
-<text text-anchor="start" x="408.74" y="-762.57" font-family="Helvetica,sans-Serif" font-size="12.00">act_lvl </text>
-<text text-anchor="start" x="450.74" y="-762.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="408.74" y="-745.57" font-family="Helvetica,sans-Serif" font-size="12.00">goal_wt </text>
-<text text-anchor="start" x="458.74" y="-745.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-<text text-anchor="start" x="408.74" y="-728.57" font-family="Helvetica,sans-Serif" font-size="12.00">goal_bf </text>
-<text text-anchor="start" x="456.74" y="-728.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-<text text-anchor="start" x="408.74" y="-711.57" font-family="Helvetica,sans-Serif" font-size="12.00">bmr_eq_id </text>
-<text text-anchor="start" x="475.74" y="-711.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="408.74" y="-694.57" font-family="Helvetica,sans-Serif" font-size="12.00">bf_eq_id </text>
-<text text-anchor="start" x="462.74" y="-694.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="408.74" y="-677.57" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="458.74" y="-677.57" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M445.13,-311.37C445.13,-311.37 565.13,-311.37 565.13,-311.37 571.13,-311.37 577.13,-317.37 577.13,-323.37 577.13,-323.37 577.13,-505.37 577.13,-505.37 577.13,-511.37 571.13,-517.37 565.13,-517.37 565.13,-517.37 445.13,-517.37 445.13,-517.37 439.13,-517.37 433.13,-511.37 433.13,-505.37 433.13,-505.37 433.13,-323.37 433.13,-323.37 433.13,-317.37 439.13,-311.37 445.13,-311.37"/>
+<text text-anchor="start" x="477.13" y="-496.97" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">profiles</text>
+<polyline fill="none" stroke="black" points="433.13,-487.37 577.13,-487.37 "/>
+<text text-anchor="start" x="440.13" y="-473.77" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="461.13" y="-473.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="440.13" y="-456.77" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
+<text text-anchor="start" x="479.13" y="-456.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="440.13" y="-439.77" font-family="Helvetica,sans-Serif" font-size="12.00">gender </text>
+<text text-anchor="start" x="487.13" y="-439.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="440.13" y="-422.77" font-family="Helvetica,sans-Serif" font-size="12.00">dob </text>
+<text text-anchor="start" x="467.13" y="-422.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">date</text>
+<text text-anchor="start" x="440.13" y="-405.77" font-family="Helvetica,sans-Serif" font-size="12.00">act_lvl </text>
+<text text-anchor="start" x="482.13" y="-405.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="440.13" y="-388.77" font-family="Helvetica,sans-Serif" font-size="12.00">goal_wt </text>
+<text text-anchor="start" x="490.13" y="-388.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<text text-anchor="start" x="440.13" y="-371.77" font-family="Helvetica,sans-Serif" font-size="12.00">goal_bf </text>
+<text text-anchor="start" x="488.13" y="-371.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<text text-anchor="start" x="440.13" y="-354.77" font-family="Helvetica,sans-Serif" font-size="12.00">bmr_eq_id </text>
+<text text-anchor="start" x="507.13" y="-354.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="440.13" y="-337.77" font-family="Helvetica,sans-Serif" font-size="12.00">bf_eq_id </text>
+<text text-anchor="start" x="494.13" y="-337.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="440.13" y="-320.77" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="490.13" y="-320.77" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- profiles&#45;&gt;bmr_eqs -->
 <g id="edge2" class="edge">
 <title>profiles&#45;&gt;bmr_eqs</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M401.37,-773.3C331.14,-775.37 224.78,-778.51 151.95,-780.66"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="151.59,-777.86 143.68,-780.9 151.76,-783.46 151.59,-777.86"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M448.46,-310.93C406.57,-234.45 351.68,-134.27 321.03,-78.32"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="323.35,-76.73 317.06,-71.06 318.44,-79.42 323.35,-76.73"/>
 </g>
 <!-- profiles&#45;&gt;bf_eqs -->
 <g id="edge1" class="edge">
 <title>profiles&#45;&gt;bf_eqs</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M546.01,-796.08C583.76,-809.1 630.06,-825.06 668.88,-838.44"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="668.07,-841.12 676.54,-841.08 669.89,-835.83 668.07,-841.12"/>
-</g>
-<!-- biometrics -->
-<g id="node5" class="node">
-<title>biometrics</title>
-<path fill="none" stroke="black" d="M133.64,-1392.61C133.64,-1392.61 253.64,-1392.61 253.64,-1392.61 259.64,-1392.61 265.64,-1398.61 265.64,-1404.61 265.64,-1404.61 265.64,-1484.61 265.64,-1484.61 265.64,-1490.61 259.64,-1496.61 253.64,-1496.61 253.64,-1496.61 133.64,-1496.61 133.64,-1496.61 127.64,-1496.61 121.64,-1490.61 121.64,-1484.61 121.64,-1484.61 121.64,-1404.61 121.64,-1404.61 121.64,-1398.61 127.64,-1392.61 133.64,-1392.61"/>
-<text text-anchor="start" x="154.64" y="-1476.21" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">biometrics</text>
-<polyline fill="none" stroke="black" points="121.64,-1466.61 265.64,-1466.61 "/>
-<text text-anchor="start" x="128.64" y="-1453.01" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="149.64" y="-1453.01" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="128.64" y="-1436.01" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="167.64" y="-1436.01" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="128.64" y="-1419.01" font-family="Helvetica,sans-Serif" font-size="12.00">unit </text>
-<text text-anchor="start" x="155.64" y="-1419.01" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="128.64" y="-1402.01" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="178.64" y="-1402.01" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-</g>
-<!-- biometric_log -->
-<g id="node6" class="node">
-<title>biometric_log</title>
-<path fill="none" stroke="black" d="M500.43,-1047.49C500.43,-1047.49 620.43,-1047.49 620.43,-1047.49 626.43,-1047.49 632.43,-1053.49 632.43,-1059.49 632.43,-1059.49 632.43,-1173.49 632.43,-1173.49 632.43,-1179.49 626.43,-1185.49 620.43,-1185.49 620.43,-1185.49 500.43,-1185.49 500.43,-1185.49 494.43,-1185.49 488.43,-1179.49 488.43,-1173.49 488.43,-1173.49 488.43,-1059.49 488.43,-1059.49 488.43,-1053.49 494.43,-1047.49 500.43,-1047.49"/>
-<text text-anchor="start" x="510.43" y="-1165.09" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">biometric_log</text>
-<polyline fill="none" stroke="black" points="488.43,-1155.49 632.43,-1155.49 "/>
-<text text-anchor="start" x="495.43" y="-1141.89" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="516.43" y="-1141.89" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="495.43" y="-1124.89" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
-<text text-anchor="start" x="553.43" y="-1124.89" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="495.43" y="-1107.89" font-family="Helvetica,sans-Serif" font-size="12.00">date </text>
-<text text-anchor="start" x="526.43" y="-1107.89" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="495.43" y="-1090.89" font-family="Helvetica,sans-Serif" font-size="12.00">tags </text>
-<text text-anchor="start" x="525.43" y="-1090.89" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="495.43" y="-1073.89" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
-<text text-anchor="start" x="532.43" y="-1073.89" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="495.43" y="-1056.89" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="545.43" y="-1056.89" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-</g>
-<!-- biometric_log&#45;&gt;profiles -->
-<g id="edge3" class="edge">
-<title>biometric_log&#45;&gt;profiles</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M543.09,-1047.44C531.22,-1000.16 515.23,-936.45 501.59,-882.11"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="504.26,-881.25 499.59,-874.17 498.83,-882.61 504.26,-881.25"/>
-</g>
-<!-- bio_log_entry -->
-<g id="node7" class="node">
-<title>bio_log_entry</title>
-<path fill="none" stroke="black" d="M452.04,-1311.14C452.04,-1311.14 572.04,-1311.14 572.04,-1311.14 578.04,-1311.14 584.04,-1317.14 584.04,-1323.14 584.04,-1323.14 584.04,-1386.14 584.04,-1386.14 584.04,-1392.14 578.04,-1398.14 572.04,-1398.14 572.04,-1398.14 452.04,-1398.14 452.04,-1398.14 446.04,-1398.14 440.04,-1392.14 440.04,-1386.14 440.04,-1386.14 440.04,-1323.14 440.04,-1323.14 440.04,-1317.14 446.04,-1311.14 452.04,-1311.14"/>
-<text text-anchor="start" x="463.04" y="-1377.74" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">bio_log_entry</text>
-<polyline fill="none" stroke="black" points="440.04,-1368.14 584.04,-1368.14 "/>
-<text text-anchor="start" x="447.04" y="-1354.04" font-family="Helvetica,sans-Serif" font-size="12.00">log_id* </text>
-<text text-anchor="start" x="492.04" y="-1354.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="447.04" y="-1337.04" font-family="Helvetica,sans-Serif" font-size="12.00">biometric_id* </text>
-<text text-anchor="start" x="531.04" y="-1337.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="447.04" y="-1320.04" font-family="Helvetica,sans-Serif" font-size="12.00">value </text>
-<text text-anchor="start" x="484.04" y="-1320.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-</g>
-<!-- bio_log_entry&#45;&gt;biometrics -->
-<g id="edge4" class="edge">
-<title>bio_log_entry&#45;&gt;biometrics</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M439.79,-1375.06C390.31,-1389.04 324.67,-1407.59 273.62,-1422.01"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="272.82,-1419.33 265.88,-1424.2 274.34,-1424.72 272.82,-1419.33"/>
-</g>
-<!-- bio_log_entry&#45;&gt;biometric_log -->
-<g id="edge5" class="edge">
-<title>bio_log_entry&#45;&gt;biometric_log</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M520.92,-1310.96C527.56,-1278.24 536.83,-1232.62 544.72,-1193.78"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="547.53,-1194.01 546.38,-1185.61 542.05,-1192.89 547.53,-1194.01"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M577.42,-384.36C633.27,-361.17 710.49,-329.1 768.15,-305.16"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="769.48,-307.64 775.79,-301.99 767.33,-302.47 769.48,-307.64"/>
 </g>
 <!-- recipes -->
-<g id="node8" class="node">
+<g id="node5" class="node">
 <title>recipes</title>
-<path fill="none" stroke="black" d="M223.92,-122.47C223.92,-122.47 343.92,-122.47 343.92,-122.47 349.92,-122.47 355.92,-128.47 355.92,-134.47 355.92,-134.47 355.92,-214.47 355.92,-214.47 355.92,-220.47 349.92,-226.47 343.92,-226.47 343.92,-226.47 223.92,-226.47 223.92,-226.47 217.92,-226.47 211.92,-220.47 211.92,-214.47 211.92,-214.47 211.92,-134.47 211.92,-134.47 211.92,-128.47 217.92,-122.47 223.92,-122.47"/>
-<text text-anchor="start" x="256.92" y="-206.07" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">recipes</text>
-<polyline fill="none" stroke="black" points="211.92,-196.47 355.92,-196.47 "/>
-<text text-anchor="start" x="218.92" y="-182.87" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="239.92" y="-182.87" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="218.92" y="-165.87" font-family="Helvetica,sans-Serif" font-size="12.00">tagname </text>
-<text text-anchor="start" x="276.92" y="-165.87" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="218.92" y="-148.87" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="257.92" y="-148.87" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="218.92" y="-131.87" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="268.92" y="-131.87" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M610.86,-1127.64C610.86,-1127.64 730.86,-1127.64 730.86,-1127.64 736.86,-1127.64 742.86,-1133.64 742.86,-1139.64 742.86,-1139.64 742.86,-1219.64 742.86,-1219.64 742.86,-1225.64 736.86,-1231.64 730.86,-1231.64 730.86,-1231.64 610.86,-1231.64 610.86,-1231.64 604.86,-1231.64 598.86,-1225.64 598.86,-1219.64 598.86,-1219.64 598.86,-1139.64 598.86,-1139.64 598.86,-1133.64 604.86,-1127.64 610.86,-1127.64"/>
+<text text-anchor="start" x="643.86" y="-1211.24" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">recipes</text>
+<polyline fill="none" stroke="black" points="598.86,-1201.64 742.86,-1201.64 "/>
+<text text-anchor="start" x="605.86" y="-1188.04" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="626.86" y="-1188.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="605.86" y="-1171.04" font-family="Helvetica,sans-Serif" font-size="12.00">tagname </text>
+<text text-anchor="start" x="663.86" y="-1171.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="605.86" y="-1154.04" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
+<text text-anchor="start" x="644.86" y="-1154.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="605.86" y="-1137.04" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="655.86" y="-1137.04" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- recipe_dat -->
-<g id="node9" class="node">
+<g id="node6" class="node">
 <title>recipe_dat</title>
-<path fill="none" stroke="black" d="M525.58,-0.82C525.58,-0.82 645.58,-0.82 645.58,-0.82 651.58,-0.82 657.58,-6.82 657.58,-12.82 657.58,-12.82 657.58,-109.82 657.58,-109.82 657.58,-115.82 651.58,-121.82 645.58,-121.82 645.58,-121.82 525.58,-121.82 525.58,-121.82 519.58,-121.82 513.58,-115.82 513.58,-109.82 513.58,-109.82 513.58,-12.82 513.58,-12.82 513.58,-6.82 519.58,-0.82 525.58,-0.82"/>
-<text text-anchor="start" x="547.58" y="-101.42" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">recipe_dat</text>
-<polyline fill="none" stroke="black" points="513.58,-91.82 657.58,-91.82 "/>
-<text text-anchor="start" x="520.58" y="-77.72" font-family="Helvetica,sans-Serif" font-size="12.00">recipe_id* </text>
-<text text-anchor="start" x="584.58" y="-77.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="520.58" y="-60.72" font-family="Helvetica,sans-Serif" font-size="12.00">food_id* </text>
-<text text-anchor="start" x="574.58" y="-60.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="520.58" y="-43.72" font-family="Helvetica,sans-Serif" font-size="12.00">grams </text>
-<text text-anchor="start" x="563.58" y="-43.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-<text text-anchor="start" x="520.58" y="-26.72" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
-<text text-anchor="start" x="557.58" y="-26.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="520.58" y="-9.72" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="570.58" y="-9.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M860.24,-1062.45C860.24,-1062.45 980.24,-1062.45 980.24,-1062.45 986.24,-1062.45 992.24,-1068.45 992.24,-1074.45 992.24,-1074.45 992.24,-1171.45 992.24,-1171.45 992.24,-1177.45 986.24,-1183.45 980.24,-1183.45 980.24,-1183.45 860.24,-1183.45 860.24,-1183.45 854.24,-1183.45 848.24,-1177.45 848.24,-1171.45 848.24,-1171.45 848.24,-1074.45 848.24,-1074.45 848.24,-1068.45 854.24,-1062.45 860.24,-1062.45"/>
+<text text-anchor="start" x="882.24" y="-1163.05" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">recipe_dat</text>
+<polyline fill="none" stroke="black" points="848.24,-1153.45 992.24,-1153.45 "/>
+<text text-anchor="start" x="855.24" y="-1139.35" font-family="Helvetica,sans-Serif" font-size="12.00">recipe_id* </text>
+<text text-anchor="start" x="919.24" y="-1139.35" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="855.24" y="-1122.35" font-family="Helvetica,sans-Serif" font-size="12.00">food_id* </text>
+<text text-anchor="start" x="909.24" y="-1122.35" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="855.24" y="-1105.35" font-family="Helvetica,sans-Serif" font-size="12.00">grams </text>
+<text text-anchor="start" x="898.24" y="-1105.35" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<text text-anchor="start" x="855.24" y="-1088.35" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
+<text text-anchor="start" x="892.24" y="-1088.35" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="855.24" y="-1071.35" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="905.24" y="-1071.35" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- recipe_dat&#45;&gt;recipes -->
-<g id="edge6" class="edge">
+<g id="edge3" class="edge">
 <title>recipe_dat&#45;&gt;recipes</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M513.32,-88.42C468.25,-105.33 410.18,-127.11 363.75,-144.52"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="362.61,-141.96 356.11,-147.39 364.58,-147.2 362.61,-141.96"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M848.11,-1139.35C817.74,-1146.25 782.28,-1154.31 751.09,-1161.4"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="750.44,-1158.68 743.26,-1163.18 751.68,-1164.14 750.44,-1158.68"/>
 </g>
 <!-- custom_foods -->
-<g id="node10" class="node">
+<g id="node7" class="node">
 <title>custom_foods</title>
-<path fill="none" stroke="black" d="M722.24,-958.53C722.24,-958.53 842.24,-958.53 842.24,-958.53 848.24,-958.53 854.24,-964.53 854.24,-970.53 854.24,-970.53 854.24,-1050.53 854.24,-1050.53 854.24,-1056.53 848.24,-1062.53 842.24,-1062.53 842.24,-1062.53 722.24,-1062.53 722.24,-1062.53 716.24,-1062.53 710.24,-1056.53 710.24,-1050.53 710.24,-1050.53 710.24,-970.53 710.24,-970.53 710.24,-964.53 716.24,-958.53 722.24,-958.53"/>
-<text text-anchor="start" x="732.24" y="-1042.13" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">custom_foods</text>
-<polyline fill="none" stroke="black" points="710.24,-1032.53 854.24,-1032.53 "/>
-<text text-anchor="start" x="717.24" y="-1018.93" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="738.24" y="-1018.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="717.24" y="-1001.93" font-family="Helvetica,sans-Serif" font-size="12.00">tagname </text>
-<text text-anchor="start" x="775.24" y="-1001.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="717.24" y="-984.93" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="756.24" y="-984.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="717.24" y="-967.93" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="767.24" y="-967.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M793.24,-745.53C793.24,-745.53 913.24,-745.53 913.24,-745.53 919.24,-745.53 925.24,-751.53 925.24,-757.53 925.24,-757.53 925.24,-837.53 925.24,-837.53 925.24,-843.53 919.24,-849.53 913.24,-849.53 913.24,-849.53 793.24,-849.53 793.24,-849.53 787.24,-849.53 781.24,-843.53 781.24,-837.53 781.24,-837.53 781.24,-757.53 781.24,-757.53 781.24,-751.53 787.24,-745.53 793.24,-745.53"/>
+<text text-anchor="start" x="803.24" y="-829.13" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">custom_foods</text>
+<polyline fill="none" stroke="black" points="781.24,-819.53 925.24,-819.53 "/>
+<text text-anchor="start" x="788.24" y="-805.93" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="809.24" y="-805.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="788.24" y="-788.93" font-family="Helvetica,sans-Serif" font-size="12.00">tagname </text>
+<text text-anchor="start" x="846.24" y="-788.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="788.24" y="-771.93" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
+<text text-anchor="start" x="827.24" y="-771.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="788.24" y="-754.93" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="838.24" y="-754.93" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- cf_dat -->
-<g id="node11" class="node">
+<g id="node8" class="node">
 <title>cf_dat</title>
-<path fill="none" stroke="black" d="M898.26,-923.73C898.26,-923.73 1018.26,-923.73 1018.26,-923.73 1024.26,-923.73 1030.26,-929.73 1030.26,-935.73 1030.26,-935.73 1030.26,-1032.73 1030.26,-1032.73 1030.26,-1038.73 1024.26,-1044.73 1018.26,-1044.73 1018.26,-1044.73 898.26,-1044.73 898.26,-1044.73 892.26,-1044.73 886.26,-1038.73 886.26,-1032.73 886.26,-1032.73 886.26,-935.73 886.26,-935.73 886.26,-929.73 892.26,-923.73 898.26,-923.73"/>
-<text text-anchor="start" x="936.26" y="-1024.33" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">cf_dat</text>
-<polyline fill="none" stroke="black" points="886.26,-1014.73 1030.26,-1014.73 "/>
-<text text-anchor="start" x="893.26" y="-1000.63" font-family="Helvetica,sans-Serif" font-size="12.00">cf_id* </text>
-<text text-anchor="start" x="931.26" y="-1000.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="893.26" y="-983.63" font-family="Helvetica,sans-Serif" font-size="12.00">nutr_id* </text>
-<text text-anchor="start" x="945.26" y="-983.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="893.26" y="-966.63" font-family="Helvetica,sans-Serif" font-size="12.00">nutr_val </text>
-<text text-anchor="start" x="945.26" y="-966.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-<text text-anchor="start" x="893.26" y="-949.63" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
-<text text-anchor="start" x="930.26" y="-949.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
-<text text-anchor="start" x="893.26" y="-932.63" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="943.26" y="-932.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M969.26,-710.73C969.26,-710.73 1089.26,-710.73 1089.26,-710.73 1095.26,-710.73 1101.26,-716.73 1101.26,-722.73 1101.26,-722.73 1101.26,-819.73 1101.26,-819.73 1101.26,-825.73 1095.26,-831.73 1089.26,-831.73 1089.26,-831.73 969.26,-831.73 969.26,-831.73 963.26,-831.73 957.26,-825.73 957.26,-819.73 957.26,-819.73 957.26,-722.73 957.26,-722.73 957.26,-716.73 963.26,-710.73 969.26,-710.73"/>
+<text text-anchor="start" x="1007.26" y="-811.33" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">cf_dat</text>
+<polyline fill="none" stroke="black" points="957.26,-801.73 1101.26,-801.73 "/>
+<text text-anchor="start" x="964.26" y="-787.63" font-family="Helvetica,sans-Serif" font-size="12.00">cf_id* </text>
+<text text-anchor="start" x="1002.26" y="-787.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="964.26" y="-770.63" font-family="Helvetica,sans-Serif" font-size="12.00">nutr_id* </text>
+<text text-anchor="start" x="1016.26" y="-770.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="964.26" y="-753.63" font-family="Helvetica,sans-Serif" font-size="12.00">nutr_val </text>
+<text text-anchor="start" x="1016.26" y="-753.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<text text-anchor="start" x="964.26" y="-736.63" font-family="Helvetica,sans-Serif" font-size="12.00">notes </text>
+<text text-anchor="start" x="1001.26" y="-736.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="964.26" y="-719.63" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="1014.26" y="-719.63" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- cf_dat&#45;&gt;custom_foods -->
-<g id="edge7" class="edge">
+<g id="edge4" class="edge">
 <title>cf_dat&#45;&gt;custom_foods</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M886.16,-995C878.49,-996.15 870.65,-997.32 862.89,-998.48"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="862.02,-995.78 854.52,-999.73 862.84,-1001.32 862.02,-995.78"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M957.16,-782C949.49,-783.15 941.65,-784.32 933.89,-785.48"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="933.02,-782.78 925.52,-786.73 933.84,-788.32 933.02,-782.78"/>
 </g>
 <!-- meal_name -->
-<g id="node12" class="node">
+<g id="node9" class="node">
 <title>meal_name</title>
-<path fill="none" stroke="black" d="M16.38,-378.66C16.38,-378.66 136.38,-378.66 136.38,-378.66 142.38,-378.66 148.38,-384.66 148.38,-390.66 148.38,-390.66 148.38,-436.66 148.38,-436.66 148.38,-442.66 142.38,-448.66 136.38,-448.66 136.38,-448.66 16.38,-448.66 16.38,-448.66 10.38,-448.66 4.38,-442.66 4.38,-436.66 4.38,-436.66 4.38,-390.66 4.38,-390.66 4.38,-384.66 10.38,-378.66 16.38,-378.66"/>
-<text text-anchor="start" x="34.38" y="-428.26" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">meal_name</text>
-<polyline fill="none" stroke="black" points="4.38,-418.66 148.38,-418.66 "/>
-<text text-anchor="start" x="11.38" y="-405.06" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="32.38" y="-405.06" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="11.38" y="-388.06" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
-<text text-anchor="start" x="50.38" y="-388.06" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<path fill="none" stroke="black" d="M243.03,-941.68C243.03,-941.68 363.03,-941.68 363.03,-941.68 369.03,-941.68 375.03,-947.68 375.03,-953.68 375.03,-953.68 375.03,-999.68 375.03,-999.68 375.03,-1005.68 369.03,-1011.68 363.03,-1011.68 363.03,-1011.68 243.03,-1011.68 243.03,-1011.68 237.03,-1011.68 231.03,-1005.68 231.03,-999.68 231.03,-999.68 231.03,-953.68 231.03,-953.68 231.03,-947.68 237.03,-941.68 243.03,-941.68"/>
+<text text-anchor="start" x="261.03" y="-991.28" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">meal_name</text>
+<polyline fill="none" stroke="black" points="231.03,-981.68 375.03,-981.68 "/>
+<text text-anchor="start" x="238.03" y="-968.08" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="259.03" y="-968.08" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="238.03" y="-951.08" font-family="Helvetica,sans-Serif" font-size="12.00">name </text>
+<text text-anchor="start" x="277.03" y="-951.08" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
 </g>
 <!-- food_log -->
-<g id="node13" class="node">
+<g id="node10" class="node">
 <title>food_log</title>
-<path fill="none" stroke="black" d="M371.22,-379.89C371.22,-379.89 491.22,-379.89 491.22,-379.89 497.22,-379.89 503.22,-385.89 503.22,-391.89 503.22,-391.89 503.22,-539.89 503.22,-539.89 503.22,-545.89 497.22,-551.89 491.22,-551.89 491.22,-551.89 371.22,-551.89 371.22,-551.89 365.22,-551.89 359.22,-545.89 359.22,-539.89 359.22,-539.89 359.22,-391.89 359.22,-391.89 359.22,-385.89 365.22,-379.89 371.22,-379.89"/>
-<text text-anchor="start" x="400.22" y="-531.49" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">food_log</text>
-<polyline fill="none" stroke="black" points="359.22,-521.89 503.22,-521.89 "/>
-<text text-anchor="start" x="366.22" y="-508.29" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="387.22" y="-508.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="366.22" y="-491.29" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
-<text text-anchor="start" x="424.22" y="-491.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="366.22" y="-474.29" font-family="Helvetica,sans-Serif" font-size="12.00">date </text>
-<text text-anchor="start" x="397.22" y="-474.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="366.22" y="-457.29" font-family="Helvetica,sans-Serif" font-size="12.00">meal_id </text>
-<text text-anchor="start" x="417.22" y="-457.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="366.22" y="-440.29" font-family="Helvetica,sans-Serif" font-size="12.00">food_id </text>
-<text text-anchor="start" x="414.22" y="-440.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="366.22" y="-423.29" font-family="Helvetica,sans-Serif" font-size="12.00">msre_id </text>
-<text text-anchor="start" x="417.22" y="-423.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="366.22" y="-406.29" font-family="Helvetica,sans-Serif" font-size="12.00">amt </text>
-<text text-anchor="start" x="394.22" y="-406.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-<text text-anchor="start" x="366.22" y="-389.29" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="416.22" y="-389.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M328.62,-550.4C328.62,-550.4 448.62,-550.4 448.62,-550.4 454.62,-550.4 460.62,-556.4 460.62,-562.4 460.62,-562.4 460.62,-710.4 460.62,-710.4 460.62,-716.4 454.62,-722.4 448.62,-722.4 448.62,-722.4 328.62,-722.4 328.62,-722.4 322.62,-722.4 316.62,-716.4 316.62,-710.4 316.62,-710.4 316.62,-562.4 316.62,-562.4 316.62,-556.4 322.62,-550.4 328.62,-550.4"/>
+<text text-anchor="start" x="357.62" y="-702" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">food_log</text>
+<polyline fill="none" stroke="black" points="316.62,-692.4 460.62,-692.4 "/>
+<text text-anchor="start" x="323.62" y="-678.8" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="344.62" y="-678.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="323.62" y="-661.8" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
+<text text-anchor="start" x="381.62" y="-661.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="323.62" y="-644.8" font-family="Helvetica,sans-Serif" font-size="12.00">date </text>
+<text text-anchor="start" x="354.62" y="-644.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="323.62" y="-627.8" font-family="Helvetica,sans-Serif" font-size="12.00">meal_id </text>
+<text text-anchor="start" x="374.62" y="-627.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="323.62" y="-610.8" font-family="Helvetica,sans-Serif" font-size="12.00">food_id </text>
+<text text-anchor="start" x="371.62" y="-610.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="323.62" y="-593.8" font-family="Helvetica,sans-Serif" font-size="12.00">msre_id </text>
+<text text-anchor="start" x="374.62" y="-593.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="323.62" y="-576.8" font-family="Helvetica,sans-Serif" font-size="12.00">amt </text>
+<text text-anchor="start" x="351.62" y="-576.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<text text-anchor="start" x="323.62" y="-559.8" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="373.62" y="-559.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- food_log&#45;&gt;profiles -->
-<g id="edge9" class="edge">
+<g id="edge6" class="edge">
 <title>food_log&#45;&gt;profiles</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M443.24,-552.15C447.9,-585.67 453.31,-624.5 458.26,-660.07"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="455.5,-660.54 459.38,-668.08 461.05,-659.77 455.5,-660.54"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M433.83,-550.24C438.23,-541.86 442.73,-533.28 447.23,-524.7"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="449.77,-525.89 451.01,-517.51 444.81,-523.29 449.77,-525.89"/>
 </g>
 <!-- food_log&#45;&gt;meal_name -->
-<g id="edge8" class="edge">
+<g id="edge5" class="edge">
 <title>food_log&#45;&gt;meal_name</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M358.99,-412.65C348.86,-407.33 338.25,-402.74 327.59,-399.62 271.98,-383.36 206.54,-387.72 156.4,-395.7"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="155.93,-392.94 148.49,-397.01 156.84,-398.46 155.93,-392.94"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M366.91,-722.7C349.95,-790.13 327.11,-880.97 313.83,-933.74"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="311.1,-933.12 311.87,-941.56 316.53,-934.49 311.1,-933.12"/>
 </g>
 <!-- recipe_log -->
-<g id="node14" class="node">
+<g id="node11" class="node">
 <title>recipe_log</title>
-<path fill="none" stroke="black" d="M192.39,-402.82C192.39,-402.82 312.39,-402.82 312.39,-402.82 318.39,-402.82 324.39,-408.82 324.39,-414.82 324.39,-414.82 324.39,-545.82 324.39,-545.82 324.39,-551.82 318.39,-557.82 312.39,-557.82 312.39,-557.82 192.39,-557.82 192.39,-557.82 186.39,-557.82 180.39,-551.82 180.39,-545.82 180.39,-545.82 180.39,-414.82 180.39,-414.82 180.39,-408.82 186.39,-402.82 192.39,-402.82"/>
-<text text-anchor="start" x="214.39" y="-537.42" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">recipe_log</text>
-<polyline fill="none" stroke="black" points="180.39,-527.82 324.39,-527.82 "/>
-<text text-anchor="start" x="187.39" y="-513.72" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
-<text text-anchor="start" x="208.39" y="-513.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
-<text text-anchor="start" x="187.39" y="-496.72" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
-<text text-anchor="start" x="245.39" y="-496.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="187.39" y="-479.72" font-family="Helvetica,sans-Serif" font-size="12.00">date </text>
-<text text-anchor="start" x="218.39" y="-479.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="187.39" y="-462.72" font-family="Helvetica,sans-Serif" font-size="12.00">meal_id </text>
-<text text-anchor="start" x="238.39" y="-462.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="187.39" y="-445.72" font-family="Helvetica,sans-Serif" font-size="12.00">recipe_id </text>
-<text text-anchor="start" x="245.39" y="-445.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="187.39" y="-428.72" font-family="Helvetica,sans-Serif" font-size="12.00">grams </text>
-<text text-anchor="start" x="230.39" y="-428.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
-<text text-anchor="start" x="187.39" y="-411.72" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
-<text text-anchor="start" x="237.39" y="-411.72" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<path fill="none" stroke="black" d="M553.17,-719.69C553.17,-719.69 673.17,-719.69 673.17,-719.69 679.17,-719.69 685.17,-725.69 685.17,-731.69 685.17,-731.69 685.17,-862.69 685.17,-862.69 685.17,-868.69 679.17,-874.69 673.17,-874.69 673.17,-874.69 553.17,-874.69 553.17,-874.69 547.17,-874.69 541.17,-868.69 541.17,-862.69 541.17,-862.69 541.17,-731.69 541.17,-731.69 541.17,-725.69 547.17,-719.69 553.17,-719.69"/>
+<text text-anchor="start" x="575.17" y="-854.29" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">recipe_log</text>
+<polyline fill="none" stroke="black" points="541.17,-844.69 685.17,-844.69 "/>
+<text text-anchor="start" x="548.17" y="-830.59" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="569.17" y="-830.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="548.17" y="-813.59" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
+<text text-anchor="start" x="606.17" y="-813.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="548.17" y="-796.59" font-family="Helvetica,sans-Serif" font-size="12.00">date </text>
+<text text-anchor="start" x="579.17" y="-796.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="548.17" y="-779.59" font-family="Helvetica,sans-Serif" font-size="12.00">meal_id </text>
+<text text-anchor="start" x="599.17" y="-779.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="548.17" y="-762.59" font-family="Helvetica,sans-Serif" font-size="12.00">recipe_id </text>
+<text text-anchor="start" x="606.17" y="-762.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="548.17" y="-745.59" font-family="Helvetica,sans-Serif" font-size="12.00">grams </text>
+<text text-anchor="start" x="591.17" y="-745.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<text text-anchor="start" x="548.17" y="-728.59" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="598.17" y="-728.59" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
 </g>
 <!-- recipe_log&#45;&gt;profiles -->
-<g id="edge12" class="edge">
+<g id="edge9" class="edge">
 <title>recipe_log&#45;&gt;profiles</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M311.42,-557.88C337.52,-592.18 368.56,-632.97 396.48,-669.65"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="394.58,-671.78 401.65,-676.45 399.03,-668.38 394.58,-671.78"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M591.18,-719.26C575.44,-663.5 554.03,-587.62 536.5,-525.51"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="539.14,-524.56 534.27,-517.62 533.75,-526.08 539.14,-524.56"/>
 </g>
 <!-- recipe_log&#45;&gt;recipes -->
-<g id="edge10" class="edge">
+<g id="edge7" class="edge">
 <title>recipe_log&#45;&gt;recipes</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M260.39,-402.75C265.77,-350.55 272.76,-282.74 277.72,-234.62"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="280.52,-234.72 278.56,-226.48 274.95,-234.15 280.52,-234.72"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M624.92,-875.05C635.82,-947.31 651.81,-1053.37 661.77,-1119.37"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="659.05,-1120.12 663.01,-1127.62 664.59,-1119.29 659.05,-1120.12"/>
 </g>
 <!-- recipe_log&#45;&gt;meal_name -->
-<g id="edge11" class="edge">
+<g id="edge8" class="edge">
 <title>recipe_log&#45;&gt;meal_name</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M180.29,-453.02C172.46,-450.05 164.45,-447.02 156.53,-444.02"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="157.12,-441.25 148.65,-441.03 155.14,-446.49 157.12,-441.25"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M540.85,-839.05C489.48,-868.78 420.98,-908.42 370.69,-937.53"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="369.24,-935.13 363.72,-941.56 372.04,-939.98 369.24,-935.13"/>
 </g>
 <!-- rda -->
-<g id="node15" class="node">
+<g id="node12" class="node">
 <title>rda</title>
-<path fill="none" stroke="black" d="M195.19,-1026.08C195.19,-1026.08 315.19,-1026.08 315.19,-1026.08 321.19,-1026.08 327.19,-1032.08 327.19,-1038.08 327.19,-1038.08 327.19,-1101.08 327.19,-1101.08 327.19,-1107.08 321.19,-1113.08 315.19,-1113.08 315.19,-1113.08 195.19,-1113.08 195.19,-1113.08 189.19,-1113.08 183.19,-1107.08 183.19,-1101.08 183.19,-1101.08 183.19,-1038.08 183.19,-1038.08 183.19,-1032.08 189.19,-1026.08 195.19,-1026.08"/>
-<text text-anchor="start" x="243.19" y="-1092.68" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">rda</text>
-<polyline fill="none" stroke="black" points="183.19,-1083.08 327.19,-1083.08 "/>
-<text text-anchor="start" x="190.19" y="-1068.98" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id* </text>
-<text text-anchor="start" x="254.19" y="-1068.98" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="190.19" y="-1051.98" font-family="Helvetica,sans-Serif" font-size="12.00">nutr_id* </text>
-<text text-anchor="start" x="242.19" y="-1051.98" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="190.19" y="-1034.98" font-family="Helvetica,sans-Serif" font-size="12.00">rda </text>
-<text text-anchor="start" x="214.19" y="-1034.98" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<path fill="none" stroke="black" d="M18.78,-247.93C18.78,-247.93 138.78,-247.93 138.78,-247.93 144.78,-247.93 150.78,-253.93 150.78,-259.93 150.78,-259.93 150.78,-322.93 150.78,-322.93 150.78,-328.93 144.78,-334.93 138.78,-334.93 138.78,-334.93 18.78,-334.93 18.78,-334.93 12.78,-334.93 6.78,-328.93 6.78,-322.93 6.78,-322.93 6.78,-259.93 6.78,-259.93 6.78,-253.93 12.78,-247.93 18.78,-247.93"/>
+<text text-anchor="start" x="66.78" y="-314.53" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">rda</text>
+<polyline fill="none" stroke="black" points="6.78,-304.93 150.78,-304.93 "/>
+<text text-anchor="start" x="13.78" y="-290.83" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id* </text>
+<text text-anchor="start" x="77.78" y="-290.83" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="13.78" y="-273.83" font-family="Helvetica,sans-Serif" font-size="12.00">nutr_id* </text>
+<text text-anchor="start" x="65.78" y="-273.83" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="13.78" y="-256.83" font-family="Helvetica,sans-Serif" font-size="12.00">rda </text>
+<text text-anchor="start" x="37.78" y="-256.83" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
 </g>
 <!-- rda&#45;&gt;profiles -->
-<g id="edge13" class="edge">
+<g id="edge10" class="edge">
 <title>rda&#45;&gt;profiles</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M287.2,-1025.87C315.91,-986.67 359.19,-927.58 396.83,-876.18"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="399.16,-877.74 401.63,-869.63 394.64,-874.43 399.16,-877.74"/>
+<path fill="none" stroke="black" stroke-width="0.9" d="M151.11,-312.29C227.02,-334.18 346.06,-368.51 424.84,-391.22"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="424.35,-393.99 432.81,-393.52 425.9,-388.61 424.35,-393.99"/>
 </g>
-<!-- food_costs -->
-<g id="node16" class="node">
-<title>food_costs</title>
-<path fill="none" stroke="black" d="M652.07,-547.94C652.07,-547.94 772.07,-547.94 772.07,-547.94 778.07,-547.94 784.07,-553.94 784.07,-559.94 784.07,-559.94 784.07,-622.94 784.07,-622.94 784.07,-628.94 778.07,-634.94 772.07,-634.94 772.07,-634.94 652.07,-634.94 652.07,-634.94 646.07,-634.94 640.07,-628.94 640.07,-622.94 640.07,-622.94 640.07,-559.94 640.07,-559.94 640.07,-553.94 646.07,-547.94 652.07,-547.94"/>
-<text text-anchor="start" x="673.07" y="-614.54" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">food_costs</text>
-<polyline fill="none" stroke="black" points="640.07,-604.94 784.07,-604.94 "/>
-<text text-anchor="start" x="647.07" y="-590.84" font-family="Helvetica,sans-Serif" font-size="12.00">food_id* </text>
-<text text-anchor="start" x="701.07" y="-590.84" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="647.07" y="-573.84" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id* </text>
-<text text-anchor="start" x="711.07" y="-573.84" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
-<text text-anchor="start" x="647.07" y="-556.84" font-family="Helvetica,sans-Serif" font-size="12.00">cost </text>
-<text text-anchor="start" x="676.07" y="-556.84" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
+<!-- food_cost -->
+<g id="node13" class="node">
+<title>food_cost</title>
+<path fill="none" stroke="black" d="M587.84,-2.72C587.84,-2.72 707.84,-2.72 707.84,-2.72 713.84,-2.72 719.84,-8.72 719.84,-14.72 719.84,-14.72 719.84,-77.72 719.84,-77.72 719.84,-83.72 713.84,-89.72 707.84,-89.72 707.84,-89.72 587.84,-89.72 587.84,-89.72 581.84,-89.72 575.84,-83.72 575.84,-77.72 575.84,-77.72 575.84,-14.72 575.84,-14.72 575.84,-8.72 581.84,-2.72 587.84,-2.72"/>
+<text text-anchor="start" x="612.84" y="-69.32" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">food_cost</text>
+<polyline fill="none" stroke="black" points="575.84,-59.72 719.84,-59.72 "/>
+<text text-anchor="start" x="582.84" y="-45.62" font-family="Helvetica,sans-Serif" font-size="12.00">food_id* </text>
+<text text-anchor="start" x="636.84" y="-45.62" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="582.84" y="-28.62" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id* </text>
+<text text-anchor="start" x="646.84" y="-28.62" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="582.84" y="-11.62" font-family="Helvetica,sans-Serif" font-size="12.00">cost </text>
+<text text-anchor="start" x="611.84" y="-11.62" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">real</text>
 </g>
-<!-- food_costs&#45;&gt;profiles -->
-<g id="edge14" class="edge">
-<title>food_costs&#45;&gt;profiles</title>
-<path fill="none" stroke="black" stroke-width="0.9" d="M654.38,-634.95C623.77,-658.03 585.71,-686.73 552.42,-711.83"/>
-<polygon fill="black" stroke="black" stroke-width="0.9" points="550.54,-709.75 545.84,-716.8 553.91,-714.22 550.54,-709.75"/>
+<!-- food_cost&#45;&gt;profiles -->
+<g id="edge11" class="edge">
+<title>food_cost&#45;&gt;profiles</title>
+<path fill="none" stroke="black" stroke-width="0.9" d="M630.91,-89.9C610.65,-142.18 575.96,-231.67 548.14,-303.44"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="545.4,-302.74 545.12,-311.21 550.62,-304.76 545.4,-302.74"/>
+</g>
+<!-- bug -->
+<g id="node14" class="node">
+<title>bug</title>
+<path fill="none" stroke="black" d="M735.35,-476.61C735.35,-476.61 855.35,-476.61 855.35,-476.61 861.35,-476.61 867.35,-482.61 867.35,-488.61 867.35,-488.61 867.35,-653.61 867.35,-653.61 867.35,-659.61 861.35,-665.61 855.35,-665.61 855.35,-665.61 735.35,-665.61 735.35,-665.61 729.35,-665.61 723.35,-659.61 723.35,-653.61 723.35,-653.61 723.35,-488.61 723.35,-488.61 723.35,-482.61 729.35,-476.61 735.35,-476.61"/>
+<text text-anchor="start" x="781.35" y="-645.21" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">bug</text>
+<polyline fill="none" stroke="black" points="723.35,-635.61 867.35,-635.61 "/>
+<text text-anchor="start" x="730.35" y="-621.51" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="751.35" y="-621.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="730.35" y="-604.51" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
+<text text-anchor="start" x="788.35" y="-604.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="730.35" y="-587.51" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="780.35" y="-587.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="730.35" y="-570.51" font-family="Helvetica,sans-Serif" font-size="12.00">arguments </text>
+<text text-anchor="start" x="799.35" y="-570.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="730.35" y="-553.51" font-family="Helvetica,sans-Serif" font-size="12.00">stack </text>
+<text text-anchor="start" x="766.35" y="-553.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="730.35" y="-536.51" font-family="Helvetica,sans-Serif" font-size="12.00">os </text>
+<text text-anchor="start" x="748.35" y="-536.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="730.35" y="-519.51" font-family="Helvetica,sans-Serif" font-size="12.00">py_ver </text>
+<text text-anchor="start" x="774.35" y="-519.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="730.35" y="-502.51" font-family="Helvetica,sans-Serif" font-size="12.00">user_details </text>
+<text text-anchor="start" x="806.35" y="-502.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="730.35" y="-485.51" font-family="Helvetica,sans-Serif" font-size="12.00">submitted </text>
+<text text-anchor="start" x="794.35" y="-485.51" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">tinyint</text>
+</g>
+<!-- bug&#45;&gt;profiles -->
+<g id="edge12" class="edge">
+<title>bug&#45;&gt;profiles</title>
+<path fill="none" stroke="black" stroke-width="0.9" d="M723.23,-532.17C681.09,-509.41 627.85,-480.65 584.52,-457.25"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="585.75,-454.73 577.38,-453.39 583.08,-459.66 585.75,-454.73"/>
+</g>
+<!-- msg -->
+<g id="node15" class="node">
+<title>msg</title>
+<path fill="none" stroke="black" d="M11.85,-516.13C11.85,-516.13 131.85,-516.13 131.85,-516.13 137.85,-516.13 143.85,-522.13 143.85,-528.13 143.85,-528.13 143.85,-659.13 143.85,-659.13 143.85,-665.13 137.85,-671.13 131.85,-671.13 131.85,-671.13 11.85,-671.13 11.85,-671.13 5.85,-671.13 -0.15,-665.13 -0.15,-659.13 -0.15,-659.13 -0.15,-528.13 -0.15,-528.13 -0.15,-522.13 5.85,-516.13 11.85,-516.13"/>
+<text text-anchor="start" x="56.85" y="-650.73" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="13.00">msg</text>
+<polyline fill="none" stroke="black" points="-0.15,-641.13 143.85,-641.13 "/>
+<text text-anchor="start" x="6.85" y="-627.03" font-family="Helvetica,sans-Serif" font-size="12.00">id* </text>
+<text text-anchor="start" x="27.85" y="-627.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">integer</text>
+<text text-anchor="start" x="6.85" y="-610.03" font-family="Helvetica,sans-Serif" font-size="12.00">profile_id </text>
+<text text-anchor="start" x="64.85" y="-610.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="6.85" y="-593.03" font-family="Helvetica,sans-Serif" font-size="12.00">msg_id </text>
+<text text-anchor="start" x="52.85" y="-593.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="6.85" y="-576.03" font-family="Helvetica,sans-Serif" font-size="12.00">created </text>
+<text text-anchor="start" x="56.85" y="-576.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="6.85" y="-559.03" font-family="Helvetica,sans-Serif" font-size="12.00">received </text>
+<text text-anchor="start" x="61.85" y="-559.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">int</text>
+<text text-anchor="start" x="6.85" y="-542.03" font-family="Helvetica,sans-Serif" font-size="12.00">header </text>
+<text text-anchor="start" x="53.85" y="-542.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+<text text-anchor="start" x="6.85" y="-525.03" font-family="Helvetica,sans-Serif" font-size="12.00">body </text>
+<text text-anchor="start" x="40.85" y="-525.03" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00">text</text>
+</g>
+<!-- msg&#45;&gt;profiles -->
+<g id="edge13" class="edge">
+<title>msg&#45;&gt;profiles</title>
+<path fill="none" stroke="black" stroke-width="0.9" d="M143.89,-563.83C221.52,-531.71 344.73,-480.73 425.27,-447.41"/>
+<polygon fill="black" stroke="black" stroke-width="0.9" points="426.61,-449.89 432.93,-444.25 424.46,-444.72 426.61,-449.89"/>
 </g>
 </g>
 </svg>
index cecf1b627919b36024403ab5bdf5f3aee285d823..64e7d2127303dbe4126050e3415ac7b8d98b99e4 100755 (executable)
@@ -1,6 +1,12 @@
 #!/bin/bash -e
 
+set -x
+
 cd "$(dirname "$0")"
 cd ..
 
-sqleton -o docs/nt.svg sql/nt.sqlite
+SQLITE3_FILE=sql/nt.sqlite3
+
+test -f $SQLITE3_FILE
+
+sqleton -o docs/nt.svg $SQLITE3_FILE
index 29f89fe794c9567c4a6b610908f301f5b9b7e42d..dfbe0341b239926ab682fd054e27f739472d735e 100755 (executable)
@@ -1,16 +1,17 @@
 #!/usr/bin/env python3
-"""Main module for building nt.sqlite"""
+"""Main module for building nt.sqlite3"""
 
 import csv
 import os
 import sqlite3
 
-NT_DB_NAME = "nt.sqlite"
+NT_DB_NAME = "nt.sqlite3"
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+CSV_DATA_DIR = os.path.join(SCRIPT_DIR, "data")
 
 
 def build_ntsqlite(verbose=False) -> bool:
-    """Builds and inserts stock data into nt.sqlite"""
+    """Builds and inserts stock data into nt.sqlite3"""
     # cd into this script's directory
     os.chdir(SCRIPT_DIR)
 
@@ -32,7 +33,7 @@ def build_ntsqlite(verbose=False) -> bool:
 
     if verbose:
         print("-> Populate data")
-    for file_path in os.listdir("data"):
+    for file_path in os.listdir(CSV_DATA_DIR):
         if not file_path.endswith(".csv"):
             continue
         table_name = os.path.splitext(os.path.basename(file_path))[0]
diff --git a/sql/data/bio_log_entry.csv b/sql/data/bio_log_entry.csv
deleted file mode 100644 (file)
index 0490aa4..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-log_id,biometric_id,value
-1,22,61
-1,23,100
-1,24,54
-2,22,68
-2,23,93
-2,24,54
-3,22,62
-3,23,103
-3,24,50
-4,22,66
-4,23,99
-4,24,58
-5,22,82
-5,23,115
-5,24,63
-6,22,0
-6,23,104
-6,24,59
-7,22,70
-7,23,108
-7,24,63
-8,22,59
-8,23,112
-8,24,61
-9,22,62
-9,23,108
-9,24,65
-10,1,177
-10,2,67
-10,3,17.2
-10,4,21.6
-10,5,93.345
-10,6,28.575
-10,7,50.8
-10,8,35.56
-10,9,109.22
-10,10,78.74
-10,11,91.44
-10,12,38.1
-10,13,26.67
-10,14,10
-10,15,15
-10,16,14
-10,17,13
-10,18,10
-10,19,12
-10,20,9
-11,22,53
-11,23,91
-11,24,60
-12,22,56
-12,23,101
-12,24,63
-13,22,64
-13,23,105
-13,24,62
-14,1,33
-14,2,8.71
-14,5,24.13
-14,6,10.795
-14,9,50.8
-14,10,46.355
-14,12,31.75
-15,1,179
-15,2,74
-15,3,17.2
-15,4,21.5
-15,5,100.965
-15,6,28.575
-15,7,55.245
-15,8,37.465
-15,9,115.57
-15,10,86.995
-15,11,95.25
-15,12,38.1
-15,13,26.67
-15,14,19
-15,15,34
-15,16,14
-15,17,18
-15,18,12
-15,19,13
-15,20,15
-16,22,59
-16,23,103
-16,24,63
-17,22,53
-17,23,107
-17,24,66
-18,2,73
-18,14,18
-18,15,26
-18,16,15
-19,2,7.26
-20,22,61
-20,23,103
-20,24,65
-21,22,97
-21,23,110
-21,24,71
-22,22,62
-22,23,106
-22,24,68
-23,22,59
-23,23,110
-23,24,66
-24,22,59
-24,23,92
-24,24,58
-25,2,70
-26,2,65.4
-27,2,71
-28,2,67.6
-29,2,66
-30,2,67.2
-31,22,58
-31,23,102
-31,24,61
-32,22,83
-32,23,113
-32,24,64
-33,22,78
-33,23,105
-33,24,70
-34,2,69.5
-35,2,66.2
-36,2,68.4
-37,22,66
-37,23,103
-37,24,63
-38,2,65.2
diff --git a/sql/data/biometric_log.csv b/sql/data/biometric_log.csv
deleted file mode 100644 (file)
index 4b6564f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-id,profile_id,date,tags,notes,created
-1,1,Sun 28 Jun 2020 02:07:01 PM EDT,exercise,,1601977400
-2,2,Sun 28 Jun 2020 02:07:01 PM EDT,exercise,,1601977400
-3,1,Sun 28 Jun 2020 02:38:20 PM EDT,,,1601977400
-4,2,Sun 28 Jun 2020 02:38:20 PM EDT,,,1601977400
-5,1,Sun 28 Jun 2020 10:05:26 PM EDT,exercise,,1601977400
-6,2,Thu 02 Jul 2020 12:12:54 PM EDT,,doctor's office,1601977400
-7,1,Sat 04 Jul 2020 03:50:13 PM EDT,,,1601977400
-8,2,Sat 04 Jul 2020 03:54:27 PM EDT,,,1601977400
-9,2,Sun 05 Jul 2020 01:30:44 PM EDT,,,1601977400
-10,1,Mon 06 Jul 2020 06:54:49 AM EDT,,,1601977400
-11,2,Sun 12 Jul 2020 12:29:11 PM EDT,,,1601977400
-12,2,Sun 12 Jul 2020 02:44:25 PM EDT,,,1601977400
-13,1,Sun 12 Jul 2020 02:44:25 PM EDT,,,1601977400
-14,3,Mon 13 Jul 2020 03:30:46 PM EDT,,,1601977400
-15,2,Fri 17 Jul 2020 02:02:12 PM EDT,,,1601977400
-16,2,Fri 17 Jul 2020 03:14:37 PM EDT,,,1601977400
-17,1,Fri 17 Jul 2020 03:14:37 PM EDT,,,1601977400
-18,2,Sat 08 Aug 2020 01:53:25 PM EDT,,,1601977400
-19,3,Thu 27 Aug 2020 12:44:37 PM EDT,,,1601977400
-20,2,Fri 28 Aug 2020 03:40:56 PM EDT,,,1601977400
-21,1,Fri 28 Aug 2020 03:40:56 PM EDT,,,1601977400
-22,2,Sun 06 Sep 2020 11:49:47 AM EDT,,,1601977400
-23,1,Sun 06 Sep 2020 11:53:21 AM EDT,,,1601977400
-24,2,Sat 12 Sep 2020 12:15:53 PM EDT,,,1601977400
-25,2,Sun 06 Sep 2020,,,1601977400
-26,1,Sun 06 Sep 2020,,,1601977400
-27,2,Sat 12 Sep 2020,,,1601977400
-28,1,Sat 12 Sep 2020,,,1601977400
-29,1,Sun 13 Sep 2020,,,1601977400
-30,1,Mon 14 Sep 2020,,,1601977400
-31,1,Fri 18 Sep 2020 09:04:38 PM EDT,exercise,,1601977400
-32,2,Thu 24 Sep 2020 05:05:51 PM EDT,illness,,1601977400
-33,1,Thu 24 Sep 2020 05:05:51 PM EDT,,,1601977400
-34,2,Thu 24 Sep 2020,,,1601977400
-35,1,Fri 25 Sep 2020,gym scale,,1601977400
-36,2,Sat 26 Sep 2020,,,1601977400
-37,2,Sat 26 Sep 2020 11:54:17 AM EDT,,,1601977400
-38,1,Tue 29 Sep 2020 03:40:37 PM EDT,nude,,1601977400
diff --git a/sql/data/biometrics.csv b/sql/data/biometrics.csv
deleted file mode 100644 (file)
index db27a05..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-id,name,unit,created
-1,Height,cm,1580336088
-2,Weight,kg,1580336088
-3,Wrist,cm,1580336088
-4,Ankle,cm,1580336088
-5,Chest,cm,1580336088
-6,Upper Arm,cm,1580336088
-7,Thigh,cm,1580336088
-8,Calf,cm,1580336088
-9,Shoulders,cm,1580336088
-10,Waist,cm,1580336088
-11,Hips,cm,1580336088
-12,Neck,cm,1580336088
-13,Forearm,cm,1580336088
-14,Pectoral,mm,1580336088
-15,Abdominal,mm,1580336088
-16,Quadricep,mm,1580336088
-17,Midaxillary,mm,1580336088
-18,Subscapular,mm,1580336088
-19,Tricep,mm,1580336088
-20,Suprailiac,mm,1580336088
-21,Body Fat (Custom),,1580336088
-22,Pulse,bpm,1580336088
-23,Systolic Blood Pressure,mmHg,1580336088
-24,Diastolic Blood Pressure,mmHg,1580336088
-25,Blood Glucose,mg/dL,1580336088
-26,Total Cholesterol,mg/dL,1580336088
-27,LDL Cholesterol,mg/dL,1580336088
-28,HDL Cholesterol,mg/dL,1580336088
-29,Triglycerides,mg/dL,1580336088
diff --git a/sql/data/food_log.csv b/sql/data/food_log.csv
deleted file mode 100644 (file)
index e056c1e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-id,profile_id,date,meal_id,food_id,msre_id,amt,created
-1,1,2020-09-20,1,13047,-1,100,1601977400
-2,1,2020-09-20,1,1270,-1,28,1601977400
-3,1,2020-09-20,1,9038,-1,55,1601977400
-4,1,2020-09-20,1,11251,-1,20,1601977400
-5,1,2020-09-20,1,11529,-1,35,1601977400
-6,1,2020-09-20,1,11282,-1,15,1601977400
-7,1,2020-09-20,1,11828,-1,210,1601977400
-8,1,2020-09-20,1,28313,-1,40,1601977400
-9,1,2020-09-20,1,9112,-1,100,1601977400
-10,1,2020-09-20,2,20137,-1,140,1601977400
-11,1,2020-09-20,2,5062,-1,100,1601977400
-12,1,2020-09-20,2,12136,-1,45,1601977400
-13,1,2020-09-20,2,11821,-1,50,1601977400
-14,1,2020-09-20,2,44005,-1,15,1601977400
-15,1,2020-09-20,3,20545,-1,150,1601977400
-16,1,2020-09-20,3,16146,-1,85,1601977400
-17,1,2020-09-20,3,1270,-1,40,1601977400
-18,1,2020-09-20,3,9037,-1,60,1601977400
-19,1,2020-09-20,3,15076,-1,100,1601977400
-20,1,2020-09-20,3,11090,-1,60,1601977400
-21,1,2020-09-20,3,11938,-1,35,1601977400
-22,1,2020-09-20,3,11282,-1,25,1601977400
diff --git a/sql/data/profiles.csv b/sql/data/profiles.csv
deleted file mode 100644 (file)
index 9a8cd3b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-id,name,gender,dob,act_lvl,goal_wt,goal_bf,bmr_id,bf_id,created
-1,Shane,MALE,1993-01-01,2,78,0.12,1,1,1601067725
-2,Mark,MALE,1957-01-01,2,72,0.14,1,1,1601068574
-3,Rocky,DOG,2007-08-01,2,7.3,,1,1,1601068718
diff --git a/sql/data/recipe_dat.csv b/sql/data/recipe_dat.csv
deleted file mode 100644 (file)
index 3d36355..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-recipe_id,food_id,grams,notes,created
-1,20045,180,white rice,
-1,16042,25,pinto beans,
-1,11282,45,onions,
-1,11260,45,mushrooms,
-1,11821,35,bell peppers,
-1,11233,25,kale,
-1,23293,85,"beef (grass-fed, 85/15)",
-1,11529,40,tomatoes,
-1,9037,40,avocados,
-1,1009,20,cheese (cheddar),
-2,18351,55,roll (mixed-grain),
-2,23293,85,"beef (grass-fed, 85/15)",
-2,1009,20,cheddar cheese,
-2,11251,25,lettuce (romaine),
-2,11529,40,tomatoes,
-2,11282,20,onions,
-2,9037,40,avocados,
-3,11355,300,potatoes (red),
-3,4053,30,olive oil,
-3,11297,30,parsley (fresh),
-4,20011,60,flour (buckwheat),
-4,20140,30,flour (spelt),
-4,20080,30,flour (whole wheat),
-4,1123,56,egg,
-4,1079,244,milk (2%),
-4,19911,25,syrup (maple),
-4,16122,20,protein (soy or whey),
-4,2047,1.5,salt,
-4,18372,1.5,baking soda,
-4,18370,0.75,baking powder,
-5,12061,50,almonds,
-5,12220,30,flaxseed,
-5,12012,20,hemp (seed/protein),
-5,16122,28,protein (soy or whey),
-5,9050,50,blueberries,
-5,9040,80,bananas,
-5,9176,40,mangos,
-5,1289,140,kefir,
diff --git a/sql/data/recipe_log.csv b/sql/data/recipe_log.csv
deleted file mode 100644 (file)
index fcad553..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-id,profile_id,date,meal_id,recipe_id,grams,created
-1,1,2020-09-26,1,1,315,1601977400
diff --git a/sql/data/recipes.csv b/sql/data/recipes.csv
deleted file mode 100644 (file)
index feb12ac..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-id,tagname,name,created
-1,burrito-bowl,Burrito bowl (Everyday),1601235568
-2,burger,"Burger (Grass fed, Beef)",1601235568
-3,potato-wedges,Baked potato wedges,1601235568
-4,buckwheat-pancake,Buckwheat pancake (w/ syrup),1601235568
-5,blueberry-hemp-smoothie,Blueberry-hemp Smoothie,1601235568
index 308de8a85f46e086abdd7b62521bccfa8be5e362..f5f5eb38055a558e098501d1906c5884930a373e 100644 (file)
@@ -4,3 +4,4 @@ id,version,created,notes
 3,0.0.2,2021-05-24,remove guids
 4,0.0.3,2021-05-24,general cleanup
 5,0.0.4,2021-06-17,"add custom foods tables (custom_foods, cf_dat)"
+6,0.0.5,2022-07-11,remove biometrics
index ddf5f30de620519e9d1f638498dda79ed6d454a7..c0ea144938e4b4fe2458a73e610ac5267794e510 100755 (executable)
@@ -2,6 +2,6 @@
 
 cd "$(dirname "$0")"
 
-for t in $(sqlite3 nt.sqlite '.tables'); do
-    sqlite3 -csv nt.sqlite "SELECT * FROM $t" > "data/$t.csv"
-done
+for t in $(sqlite3 nt.sqlite3 '.tables'); do
+       sqlite3 -csv nt.sqlite3 "SELECT * FROM $t" > "data/$t.csv"
+done
\ No newline at end of file
index 47de6844ea1f75ab80693dde2a41d5d5f93596cf..ac6058e18d1a04be1186604d7f017624250fe10b 100755 (executable)
@@ -1,6 +1,11 @@
-#!/bin/bash -e
+#!/bin/bash -ex
 
 cd "$(dirname "$0")"
 
-pg_format -s 2 tables.sql -o tables.sql
-pg_format -s 2 functions.sql -o functions.sql
+# Format
+pg_format -L -s 2 -w 80 tables.sql >tables.fmt.sql
+mv tables.fmt.sql tables.sql
+
+pg_format -L -s 2 -w 80 functions.sql >functions.fmt.sql
+mv functions.fmt.sql functions.sql
+
index 1746314b6a0800ac90b77ddb48d2e87d961dceff..d669b63c8000bab703d8a290bc2a520de3bb7d2b 100644 (file)
@@ -1,158 +1,6 @@
---------------------------------
--- Weight
---------------------------------
-
-SELECT
-  profiles.name,
-  date,
-  ROUND(bio_log_entry.value * 2.204, 1) AS weight
-FROM
-  biometric_log
-  INNER JOIN profiles ON profile_id = profiles.id
-  INNER JOIN bio_log_entry ON biometric_id = 2
-    AND log_id = biometric_log.id
-WHERE
-  profiles.name = 'Mark';
-
---------------------------------
--- Pulse and blood pressure
---------------------------------
-
-SELECT DISTINCT
-  date,
-  profiles.name,
-  tags,
-  notes,
-  CAST(sys.value AS int) || '/' || CAST(dia.value AS int) AS pressure,
-  CAST(pulse.value AS int) AS pulse
-FROM
-  biometric_log
-  INNER JOIN profiles ON profile_id = profiles.id
-  INNER JOIN bio_log_entry pulse ON pulse.biometric_id = 22
-    AND pulse.log_id = biometric_log.id
-  INNER JOIN bio_log_entry sys ON sys.biometric_id = 23
-    AND sys.log_id = biometric_log.id
-  INNER JOIN bio_log_entry dia ON dia.biometric_id = 24
-    AND dia.log_id = biometric_log.id
-WHERE
-  profiles.name = 'Mark';
-
---------------------------------
--- Height, wrist, ankle
---------------------------------
-
-SELECT
-  date,
-  profiles.name,
-  height.value AS height,
-  wrist.value AS wrist,
-  ankle.value AS ankle
-FROM
-  biometric_log
-  INNER JOIN profiles ON profile_id = profiles.id
-  LEFT JOIN bio_log_entry height ON height.biometric_id = 1
-    AND height.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry wrist ON wrist.biometric_id = 3
-    AND wrist.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry ankle ON ankle.biometric_id = 4
-    AND ankle.log_id = biometric_log.id
-WHERE
-  height.value
-  OR wrist.value
-  OR ankle.value;
-
---------------------------------
--- Measurements (cm)
---------------------------------
-
-SELECT
-  date,
-  profiles.name,
-  chest.value / 2.54 AS chest,
-  arm.value / 2.54 AS arm,
-  thigh.value / 2.54 AS thigh,
-  calf.value / 2.54 AS calf,
-  shoulders.value / 2.54 AS shoulders,
-  waist.value / 2.54 AS waist,
-  hips.value / 2.54 AS hips,
-  neck.value / 2.54 AS neck,
-  forearm.value / 2.54 AS forearm
-FROM
-  biometric_log
-  INNER JOIN profiles ON profile_id = profiles.id
-  LEFT JOIN bio_log_entry chest ON chest.biometric_id = 5
-    AND chest.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry arm ON arm.biometric_id = 6
-    AND arm.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry thigh ON thigh.biometric_id = 7
-    AND thigh.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry calf ON calf.biometric_id = 8
-    AND calf.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry shoulders ON shoulders.biometric_id = 9
-    AND shoulders.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry waist ON waist.biometric_id = 10
-    AND waist.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry hips ON hips.biometric_id = 11
-    AND hips.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry neck ON neck.biometric_id = 12
-    AND neck.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry forearm ON forearm.biometric_id = 13
-    AND forearm.log_id = biometric_log.id
-WHERE
-  chest.value
-  OR arm.value
-  OR thigh.value
-  OR calf.value
-  OR shoulders.value
-  OR waist.value
-  OR hips.value
-  OR neck.value
-  OR forearm.value;
-
---------------------------------
--- Skinfolds (mm)
---------------------------------
-
-SELECT
-  date,
-  profiles.name,
-  CAST(pectoral.value AS int) AS pec,
-  CAST(abdominal.value AS int) AS ab,
-  CAST(quadricep.value AS int) AS quad,
-  CAST(midaxillar.value AS int) AS midax,
-  CAST(subscapular.value AS int) AS sub,
-  CAST(tricep.value AS int) AS tricep,
-  CAST(suprailiac.value AS int) AS supra
-FROM
-  biometric_log
-  INNER JOIN profiles ON profile_id = profiles.id
-  LEFT JOIN bio_log_entry pectoral ON pectoral.biometric_id = 14
-    AND pectoral.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry abdominal ON abdominal.biometric_id = 15
-    AND abdominal.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry quadricep ON quadricep.biometric_id = 16
-    AND quadricep.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry midaxillar ON midaxillar.biometric_id = 17
-    AND midaxillar.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry subscapular ON subscapular.biometric_id = 18
-    AND subscapular.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry tricep ON tricep.biometric_id = 19
-    AND tricep.log_id = biometric_log.id
-  LEFT JOIN bio_log_entry suprailiac ON suprailiac.biometric_id = 20
-    AND suprailiac.log_id = biometric_log.id
-WHERE
-  pectoral.value
-  OR abdominal.value
-  OR quadricep.value
-  OR midaxillar.value
-  OR subscapular.value
-  OR tricep.value
-  OR suprailiac.value;
-
 --------------------------------
 -- Recipes overview
 --------------------------------
-
 SELECT
   id,
   tagname,
index 01cdf9f0449804fbe7b9d08000ca1223db601eb6..3a95eda5316945aa90b826d2e135e5b656c1cb25 100644 (file)
@@ -1,5 +1,5 @@
--- nt-sqlite, an sqlite3 database for nutratracker clients
--- Copyright (C) 2018-2022  Shane Jaroch <nutratracker@gmail.com>
+-- nt-sqlite, an sqlite3 database for embedded clients
+-- Copyright (C) 2018-2022  Shane Jaroch <chown_tee@proton.me>
 --
 -- This program is free software: you can redistribute it and/or modify
 -- it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
 --
 -- You should have received a copy of the GNU General Public License
 -- along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
 CREATE TABLE `version` (
   id integer PRIMARY KEY AUTOINCREMENT,
   `version` text NOT NULL UNIQUE,
@@ -26,7 +25,6 @@ CREATE TABLE `version` (
 ---------------------------------
 -- Equations
 ---------------------------------
-
 CREATE TABLE bmr_eqs (
   id integer PRIMARY KEY AUTOINCREMENT,
   name text NOT NULL UNIQUE
@@ -41,7 +39,7 @@ CREATE TABLE bf_eqs (
 --------------------------------
 -- Profiles table
 --------------------------------
-
+-- TODO: active profile? Decide what belongs here, vs. in prefs.json (if at all)
 CREATE TABLE profiles (
   id integer PRIMARY KEY AUTOINCREMENT,
   name text NOT NULL UNIQUE,
@@ -57,43 +55,10 @@ CREATE TABLE profiles (
   FOREIGN KEY (bf_eq_id) REFERENCES bf_eqs (id) ON UPDATE CASCADE
 );
 
---
---------------------------------
--- Biometrics
---------------------------------
-
-CREATE TABLE biometrics (
-  -- TODO: support custom biometrics and sync?
-  id integer PRIMARY KEY AUTOINCREMENT,
-  name text NOT NULL UNIQUE,
-  unit text,
-  created int DEFAULT (strftime ('%s', 'now'))
-);
-
-CREATE TABLE biometric_log (
-  id integer PRIMARY KEY AUTOINCREMENT,
-  profile_id int NOT NULL,
-  date int DEFAULT (strftime ('%s', 'now')),
-  tags text,
-  notes text,
-  created int DEFAULT (strftime ('%s', 'now')),
-  FOREIGN KEY (profile_id) REFERENCES profiles (id) ON UPDATE CASCADE
-);
-
-CREATE TABLE bio_log_entry (
-  log_id int NOT NULL,
-  biometric_id int NOT NULL,
-  value real NOT NULL,
-  PRIMARY KEY (log_id, biometric_id),
-  FOREIGN KEY (log_id) REFERENCES biometric_log (id) ON UPDATE CASCADE,
-  FOREIGN KEY (biometric_id) REFERENCES biometrics (id) ON UPDATE CASCADE
-);
-
 --
 --------------------------------
 -- Recipes
 --------------------------------
-
 CREATE TABLE recipes (
   id integer PRIMARY KEY AUTOINCREMENT,
   tagname text NOT NULL UNIQUE,
@@ -115,7 +80,6 @@ CREATE TABLE recipe_dat (
 --------------------------------
 -- Custom foods
 --------------------------------
-
 CREATE TABLE custom_foods (
   id integer PRIMARY KEY AUTOINCREMENT,
   tagname text NOT NULL UNIQUE,
@@ -137,7 +101,6 @@ CREATE TABLE cf_dat (
 --------------------------------
 -- Food (and recipe) logs
 --------------------------------
-
 CREATE TABLE meal_name (
   -- predefined, includes standard three, snacks, brunch, and 3 optional/extra meals
   id integer PRIMARY KEY AUTOINCREMENT,
@@ -157,6 +120,7 @@ CREATE TABLE food_log (
   FOREIGN KEY (meal_id) REFERENCES meal_name (id) ON UPDATE CASCADE
 );
 
+-- TODO: support msre_id for recipes
 CREATE TABLE recipe_log (
   id integer PRIMARY KEY AUTOINCREMENT,
   profile_id int NOT NULL,
@@ -175,7 +139,6 @@ CREATE TABLE recipe_log (
 --------------------------------
 -- Custom RDAs
 --------------------------------
-
 CREATE TABLE rda (
   profile_id int NOT NULL,
   nutr_id int NOT NULL,
@@ -191,8 +154,7 @@ CREATE TABLE rda (
 -- Case for no FK?  e.g. points to food OR custom_food?
 -- Leave edge cases potentially dangling (should never happen)
 -- Does this simplify imports with a potential `guid` column?
-
-CREATE TABLE food_costs (
+CREATE TABLE food_cost (
   food_id int NOT NULL,
   profile_id int NOT NULL,
   cost real NOT NULL,
@@ -200,3 +162,33 @@ CREATE TABLE food_costs (
   FOREIGN KEY (profile_id) REFERENCES profiles (id) ON UPDATE CASCADE ON DELETE CASCADE
 );
 
+--
+--------------------------------
+-- Bug report, message queues
+--------------------------------
+-- NOTE: be sure to SELECT version (latest) to include on bug report too
+CREATE TABLE bug (
+  id integer PRIMARY KEY AUTOINCREMENT,
+  profile_id int,
+  created int DEFAULT (strftime ('%s', 'now')),
+  arguments text,
+  stack text,
+  os text,
+  py_ver text,
+  user_details text,
+  submitted tinyint DEFAULT 0,
+  UNIQUE (arguments, stack),
+  FOREIGN KEY (profile_id) REFERENCES profiles (id) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+CREATE TABLE msg (
+  id integer PRIMARY KEY AUTOINCREMENT,
+  profile_id int,
+  msg_id int NOT NULL,
+  created int,
+  received int DEFAULT (strftime ('%s', 'now')),
+  header text,
+  body text,
+  UNIQUE (profile_id, msg_id),
+  FOREIGN KEY (profile_id) REFERENCES profiles (id) ON UPDATE CASCADE ON DELETE CASCADE
+);