--- /dev/null
+**********
+ nutra-db
+**********
+
+.. image:: https://api.travis-ci.com/gamesguru/ntdb.svg?branch=master
+ :target: https://travis-ci.com/gamesguru/ntdb
+
+Python, SQL and CSV files for setting up portable SQL database.
+
+See CLI: https://github.com/nutratech/cli
+
+Pypi page: https://pypi.org/project/nutra
+
+Building the database
+#########################
+
+1. Inside ``/data`` folder, run :code:`bash setup.sh`
+
+2. Now run :code:`python3 process.py`
+
+3. Create the database with :code:`sqlite3 nutra.db`
+
+4. Create the tables, import the data, and save:
+
+.. code-block:: bash
+
+ .read tables.sql
+ .read import.sql
+ .exit
+
+Tables (Relational Design)
+##########################
+
+See :code:`sql/tables.sql` for details.
+
+This is frequently updated, see :code:`docs/` for more info.
+
+.. image:: docs/nutra.svg
.import '| tail -n +2 nt/src_cd.csv' src_cd
.import '| tail -n +2 nt/deriv_cd.csv' deriv_cd
--- .import '| tail -n +2 nt/nut_data.csv' nut_data
+.import '| tail -n +2 nt/nut_data.csv' nut_data
.import '| tail -n +2 nt/lang_desc.csv' lang_desc
CREATE TABLE food_des (
id integer PRIMARY KEY AUTOINCREMENT,
- fdgrp_id int,
- long_desc text,
+ fdgrp_id int NOT NULL,
+ long_desc text NOT NULL,
shrt_desc text,
com_name text,
manufac_name text,
);
CREATE TABLE nut_data (
- food_id int,
- nutr_id int,
- nutr_val float,
+ food_id int NOT NULL,
+ nutr_id int NOT NULL,
+ nutr_val float NOT NULL,
num_data_pts int,
std_err float,
src_cd text,
low_eb float,
up_eb float,
stat_cmt text,
- add_mod_date date
+ add_mod_date date,
+ cc text
);
CREATE TABLE lang_desc (