From: Shane Jaroch Date: Tue, 4 Aug 2020 22:30:40 +0000 (-0400) Subject: wip X-Git-Tag: 0.0.1~6 X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=59e0ddf6cadc3544953e82388417cc958efbc84b;p=nutratech%2Fusda-sqlite.git wip --- diff --git a/data/process.py b/data/process.py index e254ea1..83a2f1f 100644 --- a/data/process.py +++ b/data/process.py @@ -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 diff --git a/data/tables.sql b/data/tables.sql index 1c5c4c5..c8d226f 100644 --- a/data/tables.sql +++ b/data/tables.sql @@ -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 (