wip
authorShane Jaroch <nutratracker@protonmail.com>
Tue, 4 Aug 2020 22:30:40 +0000 (18:30 -0400)
committerShane Jaroch <nutratracker@protonmail.com>
Tue, 4 Aug 2020 22:30:40 +0000 (18:30 -0400)
data/process.py
data/tables.sql

index e254ea13e581078c52701573d59466f2b41b48b4..83a2f1fa6167fb28057be19ead3775fd85eee608 100644 (file)
@@ -78,7 +78,7 @@ def main(args):
     process_nutr_def()
     process_food_des()
     process_data_srcs()
-    process_nut_data()
+    process_nut_data()
 
     for fname in output_files:
         print(fname)
@@ -213,7 +213,7 @@ def process_nut_data():
         rows = list(reader)
         # Add to final solution
         for row in rows:
-            result.append(row[:3])
+            result.append(row)
 
     # Special interests DB
     for dir in special_interests_dirs:
@@ -224,7 +224,17 @@ def process_nut_data():
             rows = list(reader)
             # Add to final solution
             for row in rows[1:]:
-                result.append(row[:3])
+                _row = None * 17
+                _row[0] = row[0]  # food_id
+                _row[1] = row[1]  # nutr_id
+                _row[2] = row[2]  # nutr_val
+                _row[3] = row[4]  # num_data_pts
+                _row[4] = row[3]  # std_err / std_dev
+                _row[5] = row[8]  # data_src_id
+                _row[10] = row[5]  # min
+                _row[11] = row[6]  # max
+                _row[?] = row[7]  # CC
+                result.append(_row)
 
     #########################
     # Write out result
index 1c5c4c5973406fd53505cf106abae3d44fa37dc5..c8d226f1d4cdb07dfd3ec0901ef64c6b44b4da1d 100644 (file)
@@ -60,23 +60,23 @@ CREATE TABLE deriv_cd (
 );
 
 CREATE TABLE nut_data (
-  NDB_No text,
-  Nutr_No text,
-  Nutr_Val double,
-  Num_Data_Pts int,
-  Std_Error double,
-  Src_Cd text,
-  Deriv_Cd text,
-  Ref_NDB_No text,
-  Add_Nutr_Mark text,
-  Num_Studies LONG,
-  Min double,
-  Max double,
-  DF LONG,
-  Low_EB double,
-  Up_EB double,
-  Stat_Cmt text,
-  AddMod_Date text
+  food_id int,
+  nutr_id int,
+  nutr_val float,
+  num_data_pts int,
+  std_err float,
+  src_cd text,
+  reriv_cd text,
+  ref_food_id int,
+  add_nutr_mark text,
+  num_studies int,
+  min float,
+  max float,
+  df LONG,
+  low_eb float,
+  up_eb float,
+  stat_cmt text,
+  add_mod_date date
 );
 
 CREATE TABLE lang_desc (