#include #include double dta(double x,double y); struct health_rec_out { double yr; double mo; double wgt; double glu_avg; double cnt; double glu_02; double cnt_02; double glu_04; double cnt_04; double glu_06; double cnt_06; double glu_08; double cnt_08; double glu_10; double cnt_10; double glu_12; double cnt_12; double glu_other; double cnt_other; double sys; double dia; double pul; double cnt_bp; double bf; double h2o; double bone; double bmi; double cnt_bmi; double cal; double fat; double sat; double poly; double mono; double chol; double sod; double pot; double carb; double fib; double sugar; double prot; double water; double first_sleep; double second_sleep; double second_occurs; double total_sleep; double days; double days_extra; double days_none; double miles_walk; double miles_bike; double min_yoga; double neck_perc; double stretch_perc; double bed_time; double chronotype; double delta_yr; double delta_mo; double delta_wgt; double delta_glu_avg; double delta_cnt; double delta_glu_02; double delta_cnt_02; double delta_glu_04; double delta_cnt_04; double delta_glu_06; double delta_cnt_06; double delta_glu_08; double delta_cnt_08; double delta_glu_10; double delta_cnt_10; double delta_glu_12; double delta_cnt_12; double delta_glu_other; double delta_cnt_other; double delta_sys; double delta_dia; double delta_pul; double delta_cnt_bp; double delta_bf; double delta_h2o; double delta_bone; double delta_bmi; double delta_cnt_bmi; double delta_cal; double delta_fat; double delta_sat; double delta_poly; double delta_mono; double delta_chol; double delta_sod; double delta_pot; double delta_carb; double delta_fib; double delta_sugar; double delta_prot; double delta_water; double delta_first_sleep; double delta_second_sleep; double delta_second_occurs; double delta_total_sleep; double delta_days; double delta_days_extra; double delta_days_none; double delta_miles_walk; double delta_miles_bike; double delta_min_yoga; double delta_neck_perc; double delta_stretch_perc; double delta_bed_time; double delta_chronotype; double dom1; double fast; double a1c; double sodium; double potassium; double chloride; double carbon_dioxide; double bun; double creatnine; double gfr; double ast; double alt; double bilirubin_tot; double alk_phosphatase; double protein_total; double albumin; double calcium; double glucose; double triglycerides; double cholesterol; double hdl; double ldl; double ldl_hdl_ratio; double chol_hdl_ratio; double alb_creat_ratio; double psa; double ammonia; double agap; } health_rec; main(int argc, char *argv[]) { int first = 1; FILE *fd_in; FILE *fd_out; int rec_cnt; int io_cnt; float yr,mo,wgt,glu_avg,cnt,glu_02,cnt_02,glu_04,cnt_04,glu_06,cnt_06,glu_08,cnt_08,glu_10,cnt_10,glu_12,cnt_12,glu_other,cnt_other,sys,dia,pul,cnt_bp,bf,h2o,bone,bmi,cnt_bmi,cal,fat,sat,poly,mono,chol,sod,pot,carb,fib,sugar,prot,water,first_sleep,second_sleep,second_occurs,total_sleep,days,days_extra,days_none,miles_walk,miles_bike,min_yoga,neck_perc,stretch_perc,bed_time,chronotype,dom1,fast,a1c,sodium,potassium,chloride,carbon_dioxide,bun,creatnine,gfr,ast,alt,bilirubin_tot,alk_phosphatase,protein_total,albumin,calcium,glucose,triglycerides,cholesterol,hdl,ldl,ldl_hdl_ratio,chol_hdl_ratio,alb_creat_ratio,psa,ammonia,agap; float old_yr, old_mo, old_wgt, old_glu_avg, old_cnt, old_glu_02, old_cnt_02, old_glu_04, old_cnt_04, old_glu_06, old_cnt_06, old_glu_08, old_cnt_08, old_glu_10, old_cnt_10, old_glu_12, old_cnt_12, old_glu_other, old_cnt_other, old_sys, old_dia, old_pul, old_cnt_bp, old_bf, old_h2o, old_bone, old_bmi, old_cnt_bmi, old_cal, old_fat, old_sat, old_poly, old_mono, old_chol, old_sod, old_pot, old_carb, old_fib, old_sugar, old_prot, old_water, old_first_sleep, old_second_sleep, old_second_occurs, old_total_sleep, old_days, old_days_extra, old_days_none, old_miles_walk, old_miles_bike, old_min_yoga, old_neck_perc, old_stretch_perc, old_bed_time, old_chronotype; float delta_yr, delta_mo, delta_wgt, delta_glu_avg, delta_cnt, delta_glu_02, delta_cnt_02, delta_glu_04, delta_cnt_04, delta_glu_06, delta_cnt_06, delta_glu_08, delta_cnt_08, delta_glu_10, delta_cnt_10, delta_glu_12, delta_cnt_12, delta_glu_other, delta_cnt_other, delta_sys, delta_dia, delta_pul, delta_cnt_bp, delta_bf, delta_h2o, delta_bone, delta_bmi, delta_cnt_bmi, delta_cal, delta_fat, delta_sat, delta_poly, delta_mono, delta_chol, delta_sod, delta_pot, delta_carb, delta_fib, delta_sugar, delta_prot, delta_water, delta_first_sleep, delta_second_sleep, delta_second_occurs, delta_total_sleep, delta_days, delta_days_extra, delta_days_none, delta_miles_walk, delta_miles_bike, delta_min_yoga, delta_neck_perc, delta_stretch_perc, delta_bed_time, delta_chronotype; const char *fname_in="/cygdrive/c/users/dennis/documents/dennisdarland/html/health3/healthoutnum2.txt"; const char *fname_out="/cygdrive/c/users/dennis/documents/dennisdarland/html/health3/healthoutbin2.dat"; fd_in = fopen(fname_in,"r"); fd_out = fopen(fname_out,"w"); rec_cnt = 0; while (io_cnt = fscanf(fd_in,"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n", &yr, // 01 &mo, // 02 &wgt, // 03 &glu_avg, // 04 &cnt, //05 &glu_02, //06 &cnt_02, // 07 &glu_04, // 08 &cnt_04, // 09 &glu_06, // 10 &cnt_06, // 11 &glu_08, // 12 &cnt_08, // 13 &glu_10, // 14 &cnt_10, // 15 &glu_12, // 16 &cnt_12, // 17 &glu_other, // 18 &cnt_other, // 19 &sys, // 20 &dia, // 21 &pul, // 22 &cnt_bp, // 23 &bf, // 24 &h2o, // 25 &bone, // 26 &bmi, // 27 &cnt_bmi, // 28 &cal, // 29 &fat, // 30 &sat, // 31 &poly, // 32 &mono, // 33 &chol, // 34 &sod, // 35 &pot, // 36 &carb, // 37 &fib, // 38 &sugar, // 39 &prot, // 40 &water, // 41 &first_sleep, // 42 &second_sleep, // 43 &second_occurs, // 44 &total_sleep, // 45 &days, // 46 &days_extra, // 47 &days_none, // 48 &miles_walk, // 49 &miles_bike, // 50 &min_yoga, // 51 &neck_perc, // 52 &stretch_perc, // 53 &bed_time, // 54 &chronotype, // 55 &dom1, // 56 &fast, // 57 &a1c, // 58 &sodium, // 59 &potassium, // 60 &chloride, // 61 &carbon_dioxide, // 62 &bun, // 63 &creatnine, // 64 &gfr, // 65 &ast, // 66 &alt, // 67 &bilirubin_tot, // 68 &alk_phosphatase, // 69 &protein_total, // 70 &albumin, // 71 &calcium, // 72 &glucose, // 73 &triglycerides, // 74 &cholesterol, // 75 &hdl, // 76 &ldl, // 77 &ldl_hdl_ratio, // 78 &chol_hdl_ratio, // 79 &alb_creat_ratio, // 80 &psa, // 81 &ammonia, // 82 &agap) > 0) { // 83 printf("01yr=%f 02mo=%f 03wgt=%f 04glu_avg=%f 05cnt=%f 06glu_02=%f 07cnt_02=%f 08glu_04=%f 09cnt_04=%f 10glu_06=%f 11cnt_06=%f 12glu_08_=%f 13cnt_08=%f 14glu_10=%f 15cnt_10=%f 16glu_12=%f 17cnt_12=%f 18glu_other=%f 19cnt_other=%f 20sys=%f 21dia=%f 22pul=%f 23cnt_bp=%f 24bf=%f 25h2o=%f 26bone=%f 27bmi=%f 28cnt_bmi=%f 29cal=%f 30fat=%f 31sat=%f 32poly=%f 33mono=%f 34chol=%f 35sod=%f 36pot=%f 37carb=%f 38fib=%f 39sugar=%f 40prot=%f 41water=%f 42first_sleep=%f 43second_sleep=%f 44second_occurs=%f 45total_sleep=%f 46days=%f 47days_extra=%f 48days_none=%f 49miles_walk=%f 50miles_bike=%f 51min_yoga=%f 52nexk_perc=%f 53stretch_perc=%f 54bed_time=%f 55chronotype=%f 56dom1=%f 57fast=%f 58a1c=%f 59sodium=%f 60potassium=%f 61chloride=%f 62carbon_dioxide=%f 63bun=%f 64creatnine=%f 65gfr=%f 66ast=%f 67alt=%f 68bilirubin_tot=%f 69alk_phosphatase=%f 70protean_tot=%f 71albumin=%f 72calcium=%f 73glucose=%f 74triglicerides=%f 75cholesterol=%f 76hdl=%f 77ldl=%f 78ldl_hdl_ratio=%f 79chol_hdl_ratio=%f 80alb_creat_ratio=%f 81psa=%f 82ammonia=%f 83agap=%f\n", yr, // 01 mo, // 02 wgt, // 03 glu_avg, // 04 cnt, //05 glu_02, //06 cnt_02, // 07 glu_04, // 08 cnt_04, // 09 glu_06, // 10 cnt_06, // 11 glu_08, // 12 cnt_08, // 13 glu_10, // 14 cnt_10, // 15 glu_12, // 16 cnt_12, // 17 glu_other, // 18 cnt_other, // 19 sys, // 20 dia, // 21 pul, // 22 cnt_bp, // 23 bf, // 24 h2o, // 25 bone, // 26 bmi, // 27 cnt_bmi, // 28 cal, // 29 fat, // 30 sat, // 31 poly, // 32 mono, // 33 chol, // 34 sod, // 35 pot, // 36 carb, // 37 fib, // 38 sugar, // 39 prot, // 40 water, // 41 first_sleep, // 42 second_sleep, // 43 second_occurs, // 44 total_sleep, // 45 days, // 46 days_extra, // 47 days_none, // 48 miles_walk, // 49 miles_bike, // 50 min_yoga, // 51 neck_perc, // 52 stretch_perc, // 53 bed_time, // 54 chronotype, // 55 dom1, // 56 fast, // 57 a1c, // 58 sodium, // 59 potassium, // 60 chloride, // 61 carbon_dioxide, // 62 bun, // 63 creatnine, // 64 gfr, // 65 ast, // 66 alt, // 67 bilirubin_tot, // 68 alk_phosphatase, // 69 protein_total, // 70 albumin, // 71 calcium, // 72 glucose, // 73 triglycerides, // 74 cholesterol, // 75 hdl, // 76 ldl, // 77 ldl_hdl_ratio, // 78 chol_hdl_ratio, // 79 alb_creat_ratio, // 80 psa, // 81 ammonia, // 82 agap); // 83 if (!first) { delta_yr = dta(yr , old_yr); delta_mo = dta(mo , old_mo); delta_wgt =dta( wgt , old_wgt); delta_glu_avg = dta(glu_avg , old_glu_avg); delta_cnt = dta(cnt , old_cnt); delta_glu_02 = dta(glu_02 , old_glu_02); delta_cnt_02 = dta(cnt_02 , old_cnt_02); delta_glu_04 = dta(glu_04 , old_glu_04); delta_glu_04 = dta(glu_04 , old_cnt_04); delta_glu_06 = dta(glu_06 , old_glu_06); delta_cnt_06 = dta(cnt_06 , old_cnt_06); delta_glu_08 = dta(glu_08 , old_glu_08); delta_cnt_08 = dta(cnt_08 , old_cnt_08); delta_glu_10 = dta(glu_10 , old_glu_10); delta_cnt_10 = dta(cnt_10 , old_cnt_10); delta_glu_12 = dta(glu_12 , old_glu_12); delta_cnt_12 = dta(cnt_12 , old_cnt_12); delta_glu_other = dta(glu_other , old_glu_other); delta_cnt_other = dta(cnt_other , old_cnt_other); delta_sys = dta(sys , old_sys); delta_dia = dta(dia , old_dia); delta_pul = dta(pul , old_pul); delta_cnt_bp = dta(cnt_bp , old_cnt_bp); delta_bf = dta(bf , old_bf); delta_h2o = dta(h2o , old_h2o); delta_bone = dta(bone , old_bone); delta_bmi = dta(bmi , old_bmi); delta_cnt_bmi = dta(cnt_bmi , old_cnt_bmi); delta_cal = dta(cal , old_cal); delta_fat = dta(fat , old_fat); delta_sat = dta(sat , old_sat); delta_poly = dta(poly , old_poly); delta_mono = dta(mono , old_mono); delta_chol = dta(chol , old_chol); delta_sod = dta(sod , old_sod); delta_pot = dta(pot , old_pot); delta_carb = dta(carb , old_carb); delta_fib = dta(fib , old_fib); delta_sugar = dta(sugar , old_sugar); delta_prot = dta(prot , old_prot); delta_water = dta(water , old_water); delta_first_sleep = dta(first_sleep , old_first_sleep); delta_second_sleep = dta(second_sleep , old_second_sleep); delta_second_occurs = dta(second_occurs , old_second_occurs); delta_total_sleep = dta(total_sleep , old_total_sleep); delta_days = dta(days , old_days); delta_days_extra = dta(days_extra , old_days_extra); delta_days_none = dta(days_none , old_days_none); delta_miles_walk = dta(miles_walk , old_miles_walk); delta_miles_bike = dta(miles_bike , old_miles_bike); delta_min_yoga = dta(min_yoga , old_min_yoga); delta_neck_perc = dta(neck_perc , old_neck_perc); delta_stretch_perc = dta(stretch_perc , old_stretch_perc); delta_bed_time = dta(bed_time , old_bed_time); delta_chronotype = dta(chronotype , old_chronotype); } else { delta_yr = -9999.9; delta_mo = -9999.9; delta_wgt = -9999.9; delta_glu_avg = -9999.9; delta_cnt = -9999.9; delta_glu_02 = -9999.9; delta_cnt_02 = -9999.9; delta_glu_04 = -9999.9; delta_glu_04 = -9999.9; delta_glu_06 = -9999.9; delta_cnt_06 = -9999.9; delta_glu_08 = -9999.9; delta_cnt_08 = -9999.9; delta_glu_10 = -9999.9; delta_cnt_10 = -9999.9; delta_glu_12 = -9999.9; delta_cnt_12 = -9999.9; delta_glu_other = -9999.9; delta_cnt_other = -9999.9; delta_sys = -9999.9; delta_dia = -9999.9; delta_pul = -9999.9; delta_cnt_bp = -9999.9; delta_bf = -9999.9; delta_h2o = -9999.9; delta_bone = -9999.9; delta_bmi = -9999.9; delta_cnt_bmi = -9999.9; delta_cal = -9999.9; delta_fat = -9999.9; delta_sat = -9999.9; delta_poly = -9999.9; delta_mono = -9999.9; delta_chol = -9999.9; delta_sod = -9999.9; delta_pot = -9999.9; delta_carb = -9999.9; delta_fib = -9999.9; delta_sugar = -9999.9; delta_prot = -9999.9; delta_water = -9999.9; delta_first_sleep = -9999.9; delta_second_sleep = -9999.9; delta_second_occurs = -9999.9; delta_total_sleep = -9999.9; delta_days = -9999.9; delta_days_extra = -9999.9; delta_days_none = -9999.9; delta_miles_walk = -9999.9; delta_miles_bike = -9999.9; delta_min_yoga = -9999.9; delta_neck_perc = -9999.9; delta_stretch_perc = -9999.9; delta_bed_time = -9999.9; delta_chronotype = -9999.9; first = 0; } health_rec.yr = yr; health_rec.mo = mo; health_rec.wgt = wgt; health_rec.glu_avg = glu_avg; health_rec.cnt = cnt; health_rec.glu_02 = glu_02; health_rec.cnt_02 = cnt_02; health_rec.glu_04 = glu_04; health_rec.cnt_04 = cnt_04; health_rec.glu_06 = glu_06; health_rec.cnt_06 = cnt_06; health_rec.glu_08 = glu_08; health_rec.cnt_08 = cnt_08; health_rec.glu_10 = glu_10; health_rec.cnt_10 = cnt_10; health_rec.glu_12 = glu_12; health_rec.cnt_12 = cnt_12; health_rec.glu_other = glu_other; health_rec.cnt_other = cnt_other; health_rec.sys = sys; health_rec.dia = dia; health_rec.pul = pul; health_rec.cnt_bp = cnt_bp; health_rec.bf = bf; health_rec.h2o = h2o; health_rec.bone = bone; health_rec.bmi = bmi; health_rec.cnt_bmi = cnt_bmi; health_rec.cal = cal; health_rec.fat = fat; health_rec.sat = sat; health_rec.poly = poly; health_rec.mono = mono; health_rec.chol = chol; health_rec.sod = sod; health_rec.pot = pot; health_rec.carb = carb; health_rec.fib = fib; health_rec.sugar = sugar; health_rec.prot = prot; health_rec.water = water; health_rec.first_sleep = first_sleep; health_rec.second_sleep = second_sleep; health_rec.second_occurs = second_occurs; health_rec.total_sleep = total_sleep; health_rec.days = days; health_rec.days_extra = days_extra; health_rec.days_none = days_none; health_rec.miles_walk = miles_walk; health_rec.miles_bike = miles_bike; health_rec.min_yoga = min_yoga; health_rec.neck_perc = neck_perc; health_rec.stretch_perc = stretch_perc; health_rec.bed_time = bed_time; health_rec.chronotype = chronotype; // health_rec.dom = dom; health_rec.fast = fast; health_rec.a1c= a1c; health_rec.sodium = sodium; health_rec.potassium = potassium; health_rec.chloride = chloride; health_rec.carbon_dioxide = carbon_dioxide; health_rec.bun = bun; health_rec.creatnine = creatnine; health_rec.gfr = gfr; health_rec.ast = ast; health_rec.alt = alt; health_rec.bilirubin_tot = bilirubin_tot; health_rec.alk_phosphatase = alk_phosphatase; health_rec.protein_total = protein_total; health_rec.albumin = albumin; health_rec.calcium = calcium; health_rec.glucose = glucose; health_rec.triglycerides = triglycerides; health_rec.cholesterol = cholesterol; health_rec.hdl = hdl; health_rec.ldl = ldl; health_rec.ldl_hdl_ratio = ldl_hdl_ratio; health_rec.chol_hdl_ratio = chol_hdl_ratio; health_rec.alb_creat_ratio = alb_creat_ratio; health_rec.psa = psa; health_rec.ammonia = ammonia; health_rec.agap = agap; health_rec.delta_yr = delta_yr; health_rec.delta_mo = delta_mo ; health_rec.delta_wgt = delta_wgt ; health_rec.delta_glu_avg = delta_glu_avg ; health_rec.delta_cnt = delta_cnt ; health_rec.delta_glu_02 = delta_glu_02 ; health_rec.delta_cnt_02 = delta_cnt_02 ; health_rec.delta_glu_04 = delta_glu_04 ; health_rec.delta_cnt_04 = delta_cnt_04 ; health_rec.delta_glu_06 = delta_glu_04; health_rec.delta_cnt_06 = delta_cnt_06 ; health_rec.delta_glu_08 = delta_glu_08 ; health_rec.delta_cnt_08 = delta_cnt_08 ; health_rec.delta_glu_10 = delta_glu_10 ; health_rec.delta_cnt_10 = delta_cnt_10 ; health_rec.delta_glu_12 = delta_glu_12 ; health_rec.delta_cnt_12 = delta_cnt_12 ; health_rec.delta_glu_other = delta_glu_other ; health_rec.delta_cnt_other = delta_cnt_other ; health_rec.delta_sys = delta_sys ; health_rec.delta_dia = delta_dia ; health_rec.delta_pul = delta_pul ; health_rec.delta_cnt_bp = delta_cnt_bp ; health_rec.delta_bf = delta_bf ; health_rec.delta_h2o = delta_h2o ; health_rec.delta_bone = delta_bone ; health_rec.delta_bmi = delta_bmi ; health_rec.cnt_bmi = delta_cnt_bmi ; health_rec.delta_cal = delta_cal ; health_rec.delta_fat = delta_fat ; health_rec.delta_sat = delta_sat ; health_rec.delta_poly = delta_poly ; health_rec.delta_mono = delta_mono ; health_rec.delta_chol = delta_chol ; health_rec.delta_sod = delta_sod ; health_rec.delta_pot = delta_pot ; health_rec.delta_carb = delta_carb ; health_rec.fib = delta_fib ; health_rec.delta_sugar = delta_sugar ; health_rec.delta_prot = delta_prot ; health_rec.delta_water = delta_water ; health_rec.delta_first_sleep = delta_first_sleep ; health_rec.delta_second_sleep = delta_second_sleep ; health_rec.delta_second_occurs = delta_second_occurs ; health_rec.delta_total_sleep = delta_total_sleep ; health_rec.delta_days = delta_days ; health_rec.delta_days_extra = delta_days_extra ; health_rec.delta_days_none = delta_days_none ; health_rec.delta_miles_walk = delta_miles_walk ; health_rec.delta_miles_bike = delta_miles_bike ; health_rec.delta_min_yoga = delta_min_yoga ; health_rec.delta_neck_perc = delta_neck_perc ; health_rec.delta_stretch_perc = delta_stretch_perc ; health_rec.delta_bed_time = delta_bed_time ; health_rec.delta_chronotype = delta_chronotype ; fwrite(&health_rec,sizeof(health_rec),1,fd_out); printf("items=%d\n",sizeof(health_rec)/sizeof(double)); old_yr = yr ; old_mo = mo; old_wgt = wgt; old_glu_avg = glu_avg; old_cnt = cnt; old_glu_02 = glu_02; old_cnt_02 = cnt_02; old_glu_04 = glu_04; old_glu_04 = glu_04; old_glu_06 = glu_06; old_cnt_06 = cnt_06; old_glu_08 = glu_08; old_cnt_08 = cnt_08; old_glu_10 = glu_10; old_cnt_10 = cnt_10; old_glu_12 = glu_12; old_cnt_12 = cnt_12; old_glu_other = glu_other; old_cnt_other = cnt_other; old_sys = sys; old_dia = dia; old_pul = pul; old_cnt_bp = cnt_bp; old_bf = bf; old_h2o = h2o; old_bone = bone; old_bmi = bmi; old_cnt_bmi = cnt_bmi; old_cal = cal; old_fat = fat; old_sat = sat; old_poly = poly; old_mono = mono; old_chol = chol; old_sod = sod; old_pot = pot; old_carb = carb; old_fib = fib; old_sugar = sugar; old_prot = prot; old_water = water; old_first_sleep = first_sleep; old_second_sleep = second_sleep; old_second_occurs = second_occurs; old_total_sleep = total_sleep; old_days = days; old_days_extra = days_extra; old_days_none = days_none; old_miles_walk = miles_walk; old_miles_bike = miles_bike; old_min_yoga = min_yoga; old_neck_perc = neck_perc; old_stretch_perc = stretch_perc; old_bed_time = bed_time; old_chronotype = chronotype; rec_cnt += 1; printf("rec_cnt = %d io_cnt = %d size = %d wgt=%lg old_wgt=%lg delta_wgt=%lg first=%d\n",rec_cnt,io_cnt,sizeof(health_rec),wgt,old_wgt,delta_wgt,first); } printf("rec_cnt = %d io_cnt = %d size = %d\n",rec_cnt,io_cnt,sizeof(health_rec)); fclose(fd_in); fclose(fd_out); } double dta(double x,double y) { double ret; if (x > -999 && y > -999) ret = x-y; else ret = -9999.9; return ret; }