* * mm/dd/yy a_rb fast "fast" arb glu "wgt" weight systolic "/" diastolic "-" pulse * (after new scale --) bf nn.n h2o nn.n bone n.n bmi nn.n (added) &TRACE = 0 output('debug',2,128,'debug2.txt') TRACE('bone') TRACE('totbonemo') TRACE('totbone') TRACE('avgbone') TRACE('cntbmi') DEFINE('CVT_DAYS(yr,mo,da),I,ndays','CVT_DAYSENTRY') DEFINE('MOD_DJD(M,N)','MOD_ENTRY') last_day_check = 0 day_check = 0 found = 0 first = 1 * cnt1 < 2 hrs * cnt2 < 4 hrs * cnt3 < 6 hrs * cnt4 < 8 hrs * cnt5 < 10 hrs * cnt6 < 12 hrs * cnt7 other * cnt all combined cnt = 0 cntwgt = 0 cntbp = 0 tot = 0.0 cntmo = 0 cntwgtmo = 0 cntbpmo = 0 cntbmi = 0 cntbmimo = 0 totwgt = 0.0 totmo = 0.0 totwgtmo = 0.0 cntbp = 0 sys = 0.0 dia = 0.0 pul = 0.0 bf = 0.0 h2o = 0.0 bone = 0.0 bmi = 0.0 totsys = 0.0 totdia = 0.0 totpul = 0.0 totbf = 0.0 toth2o = 0.0 totbone = 0.0 totbmi = 0.0 totsysmo = 0.0 totdiamo = 0.0 totpulmo = 0.0 totbfmo = 0.0 toth2omo = 0.0 totbonemo = 0.0 totbmimo = 0.0 cnt1 = 0 cnt2 = 0 cnt3 = 0 cnt4 = 0 cnt5 = 0 cnt6 = 0 cnt7 = 0 cnt1mo = 0 cnt2mo = 0 cnt3mo = 0 cnt4mo = 0 cnt5mo = 0 cnt6mo = 0 cnt7mo = 0 tot1 = 0.0 tot2 = 0.0 tot3 = 0.0 tot4 = 0.0 tot5 = 0.0 tot6 = 0.0 tot7 = 0.0 tot1mo = 0.0 tot2mo = 0.0 tot3mo = 0.0 tot4mo = 0.0 tot5mo = 0.0 tot6mo = 0.0 tot7mo = 0.0 * output = "CC tot4mo " tot4mo " tot5mo " tot5mo * output = "CC cnt4mo " cnt4mo " cnt5mo " cnt5mo digits = '0123456789' digits2 = digits '.' digits3 = digits2 '-' lastmo = '0' lastda = '0' lastyr = '0' daysinmo = ARRAY("1:12") daysinmo[1] = 31 daysinmo[2] = 28 daysinmo[3] = 31 daysinmo[4] = 30 daysinmo[5] = 31 daysinmo[6] = 30 daysinmo[7] = 31 daysinmo[8] = 31 daysinmo[9] = 30 daysinmo[10] = 31 daysinmo[11] = 30 daysinmo[12] = 31 done_flag = 0 part1 = "Month Wgt Glu Fast Fast Fast " part1b = " Fast Fast Fast Fast" part1c = " BP BP Pulse" part2 = " Avg <2 <4 <6 " part2b = " <8 <10 <12 other" part2c = " Systolic Diastolic" part1d = " % Body % h20 Bone BMI" part2d = " Fat Density " OUTPUT = part1 part1b part1c part1d OUTPUT = part2 part2b part2c part2d LOOP in = INPUT :F(DONE1) foundbp = 0 foundbmi = 0 in FENCE break('/') . mo arb . rest rpos(0) :F(LOOP) * MATCHED Month * output = 'mo = ' mo rest FENCE '/' break('/') . da '/' arb . rest rpos(0) :F(LOOP) * MATCHED Day * output = 'da = ' da rest FENCE span(digits) . yr span(' ') arb . rest rpos(0) :F(LOOP) * MATCHED Year * output = 'yr = ' yr rest FENCE arb ('fast' | 'FAST') arb . rest rpos(0) :F(LOOP) rest FENCE span(' ') span(digits2) . fast span(' ') arb . rest rpos(0) :F(LOOP) * output = 'mo = ' mo ' da = ' da 'yr = ' yr 'fast = ' fast rest FENCE arb span(digits) . glu span(' ') 'wgt' arb . rest rpos(0) :f(LOOP) * Add 5 lbs for old scale rest FENCE span(' ') span(digits2) . wgt arb . rest rpos(0) :f(loop) * wgt = wgt + 5.0 rest FENCE break(digits) break('/') . sys "/" span(digits) . dia arb . rest rpos(0) :f(jump1) rest FENCE break("-") "-" span(" ") span(digits) . pul arb . rest rpos(0) :f(jump1) foundbp = 1 day_check = CVT_DAYS(yr,mo,da) LT(day_check, last_day_check) :s(ERROUT1) * output = "day_check = " day_check " yr = " yr " mo = " mo " da = " da last_day_check = day_check * output = 'mo = ' mo ' da = ' da 'yr = ' yr 'fast' rest FENCE break("bf") "bf" span(" ") span(digits2) . bf break("h2o") "h2o" span(" ") span(digits2) . h2o break("bone") "bone" span(" ") span(digits2) . bone break("bmi") "bmi" span(" ") span(digits2) . bmi :f(jump1) foundbmi = 1 * subtract back out for new scale * wgt = wgt - 5.0 jump1 * output = 'mo = ' mo ' da = ' da 'yr = ' yr 'glu = ' glu * output = 'mo = ' mo ' da = ' da 'yr = ' yr 'wgt = ' wgt * OUTPUT = mo "/" da "/" yr eq(lastmo,0) :s(NEXT) eq(lastmo,mo) eq(lastyr,yr) :f(newmo) NEXT lastmo = mo * output = 'HERE lastmo = ' lastmo ' mo = ' mo lastda = da lastyr = yr eq(foundbp,0) :s(jump2) cntbp = cntbp + 1 cntbpmo = cntbpmo + 1 totsys = totsys + sys totdia = totdia + dia totpul = totpul + pul totsysmo = totsysmo + sys totdiamo = totdiamo + dia totpulmo = totpulmo + pul eq(foundbmi,0) :s(jump2) cntbmi = cntbmi + 1 cntbmimo = cntbmimo + 1 totbf = totbf + bf toth2o = toth2o + h2o totbone = totbone + bone totbmi = totbmi + bmi totbfmo = totbfmo + bf toth2omo = toth2omo + h2o totbonemo = totbonemo + bone totbmimo = totbmimo + bmi * if 0 did not test -- fingers getting damaged from testing so much (2/19/2017) jump2 totwgt = totwgt + wgt totwgtmo = totwgtmo + wgt cntwgt = cntwgt + 1 cntwgtmo = cntwgtmo + 1 eq(glu,0.0) :s(skip2) tot = tot + glu totmo = totmo + glu cnt = cnt + 1 cntmo = cntmo + 1 ge(fast,2) :s(to2) cnt1 = cnt1 + 1 cnt1mo = cnt1mo + 1 tot1mo = tot1mo + glu tot1 = tot1 + glu :(skip2) to2 ge(fast,4) :s(to4) cnt2 = cnt2 + 1 cnt2mo = cnt2mo + 1 tot2mo = tot2mo + glu tot2 = tot2 + glu :(skip2) to4 ge(fast,6) :s(to6) cnt3 = cnt3 + 1 cnt3mo = cnt3mo + 1 tot3mo = tot3mo + glu tot3 = tot3 + glu :(skip2) to6 ge(fast,8) :s(to8) cnt4 = cnt4 + 1 cnt4mo = cnt4mo + 1 tot4mo = tot4mo + glu * output = "DD tot4mo " tot4mo " tot5mo " tot5mo " fast " fast * output = "DD cnt4mo " cnt4mo " cnt5mo " cnt5mo tot4 = tot4 + glu :(skip2) to8 ge(fast,10) :s(to10) cnt5 = cnt5 + 1 cnt5mo = cnt5mo + 1 tot5mo = tot5mo + glu * output = "EE tot4mo " tot4mo " tot5mo " tot5mo "fast " fast * output = "EE cnt4mo " cnt4mo " cnt5mo " cnt5mo tot5 = tot5 + glu :(skip2) to10 ge(fast,12) :s(to12) cnt6 = cnt6 + 1 cnt6mo = cnt6mo + 1 tot6mo = tot6mo + glu tot6 = tot6 + glu :(skip2) to12 cnt7 = cnt7 + 1 cnt7mo = cnt7mo + 1 tot7mo = tot7mo + glu tot7 = tot7 + glu skip2 :(LOOP) newmo avgwgt = " NA " avg = " NA " avg1 = " NA " avg2 = " NA " avg3 = " NA " avg4 = " NA " avg5 = " NA " avg6 = " NA " avg7 = " NA " avgsys = " NA " avgdia = " NA " avgpul = " NA " avgbf = " NA " avgh2o = " NA " avgbone = " NA " avgbmi = " NA " eq(cntbpmo,0) :s(skc0) avgsys = (totsysmo / cntbpmo) + 0.0001 avgdia = (totdiamo / cntbpmo) + 0.0001 avgpul = (totpulmo / cntbpmo) + 0.0001 eq(cntbmimo,0) :s(skc0) avgbf = (totbfmo / cntbmimo) + 0.0001 avgh2o = (toth2omo / cntbmimo) + 0.0001 avgbone = (totbonemo / cntbmimo) + 0.0001 avgbmi = (totbmimo / cntbmimo) + 0.0001 skc0 eq(cntwgtmo,0) :s(skc7) avgwgt = (totwgtmo / cntwgtmo) '00000' eq(cntmo,0) :s(skc7) avg = (totmo / cntmo) '00000' * output = "HERE HERE totsysmo = " totsysmo " cntmo = " cntmo eq(cnt1mo,0) :s(skc1) avg1 = (tot1mo / cnt1mo) '00000' skc1 eq(cnt2mo,0) :s(skc2) avg2 = (tot2mo / cnt2mo) '00000' skc2 eq(cnt3mo,0) :s(skc3) avg3 = (tot3mo / cnt3mo) '00000' skc3 eq(cnt4mo,0) :s(skc4) avg4 = (tot4mo / cnt4mo) '00000' skc4 eq(cnt5mo,0) :s(skc5) avg5 = (tot5mo / cnt5mo) '00000' skc5 eq(cnt6mo,0) :s(skc6) avg6 = (tot6mo / cnt6mo) '00000' skc6 eq(cnt7mo,0) :s(skc7) avg7 = (tot7mo / cnt7mo) '00000' skc7 avgwgt len(5) . ow avg len(5) . o avg1 len(5) . o1 avg2 len(5) . o2 avg3 len(5) . o3 avg4 len(5) . o4 avg5 len(5) . o5 avg6 len(5) . o6 avg7 len(5) . o7 avgsys len(5) . sy avgdia len(4) . di avgpul len(4) . pu avgbf len(4) . b_bf avgh2o len(4) . b_h2o avgbone len(3) . b_bone avgbmi len(4) . b_bmi b_bf = b_bf " " b_h2o = b_h2o " " b_bone = b_bone " " b_bmi = b_bmi " " c = " (" cntmo ") " cw = " (" cntwgtmo ") " cbp = " (" cntbpmo ") " c1 = " (" cnt1mo ") " c2 = " (" cnt2mo ") " c3 = " (" cnt3mo ") " c4 = " (" cnt4mo ") " c5 = " (" cnt5mo ") " c6 = " (" cnt6mo ") " c7 = " (" cnt7mo ") " cbmi = " (" cntbmimo ") " c len(11) . c cw len(11) . cw cbp len(12) . cbp c1 len(7) . c1 c2 len(7) . c2 c3 len(7) . c3 c4 len(7) . c4 c5 len(7) . c5 c6 len(7) . c6 c7 len(7) . c7 cbmi len(7) . cbmi pt1 = " " ow cw o c o1 c1 o2 c2 o3 c3 o4 c4 o5 c5 o6 c6 o7 c7 pt2 = " " sy " " di " " pu cbp b_bf b_h2o b_bone b_bmi cbmi mnth = rpad( lastmo "/" lastyr , 7, " ") output = mnth pt1 pt2 totmo = 0.0 totwgtmo = 0.0 cntmo = 0 cntwgtmo = 0 cntbpmo = 0 cntbmimo = 0 totbfmo = 0.0 toth2omo = 0.0 totbonemo = 0.0 totbmimo = 0.0 cnt1mo = 0 cnt2mo = 0 cnt3mo = 0 cnt4mo = 0 cnt5mo = 0 cnt6mo = 0 cnt7mo = 0 tot1mo = 0.0 tot2mo = 0.0 tot3mo = 0.0 tot4mo = 0.0 tot5mo = 0.0 tot6mo = 0.0 tot7mo = 0.0 totsysmo = 0.0 totdiamo = 0.0 totpulmo = 0.0 * mnth = rpad( lastmo "/" lastyr , 7, " ") * output = mnth pt1 pt2 lastmo = mo lastda = da lastyr = yr eq(done_flag,0) :s(NEXT)f(DONE2) DONE1 done_flag = 1 :(newmo) DONE2 avgwgt = " NA " avg = " NA " avg1 = " NA " avg2 = " NA " avg3 = " NA " avg4 = " NA " avg5 = " NA " avg6 = " NA " avg7 = " NA " avgsys = " NA " avgdia = " NA " avgpul = " NA " avgbf = " NA " avgh2o = " NA " avgbone = " NA " avgbmi = " NA " eq(cntbp,0) :s(skc0t) avgsys = (totsys / cntbp) + 0.0001 avgdia = (totdia / cntbp) + 0.0001 avgpul = (totpul / cntbp) + 0.0001 eq(cntbmi,0) :s(skc0t) avgbf = (totbf / cntbmi) + 0.0001 avgh2o = (toth2o / cntbmi) + 0.0001 avgbone = (totbone / cntbmi) + 0.0001 avgbmi = (totbmi / cntbmi) + 0.0001 skc0t eq(cntwgt,0) :s(skc7t) avgwgt = (totwgt / cntwgt) + 0.0001 avg = (tot / cnt) + 0.0001 eq(cnt1,0) :s(skc1t) avg1 = (tot1 / cnt1) + 0.0001 skc1t eq(cnt2,0) :s(skc2t) avg2 = (tot2 / cnt2) + 0.0001 skc2t eq(cnt3,0) :s(skc3t) avg3 = (tot3 / cnt3) + 0.0001 skc3t eq(cnt4,0) :s(skc4t) avg4 = (tot4 / cnt4) + 0.0001 skc4t eq(cnt5,0) :s(skc5t) avg5 = (tot5 / cnt5) + 0.0001 skc5t eq(cnt6,0) :s(skc6t) avg6 = (tot6 / cnt6) + 0.0001 skc6t eq(cnt7,0) :s(skc7t) avg7 = (tot7 / cnt7) + 0.0001 skc7t avgwgt len(5) . ow avg len(5) . o avg1 len(5) . o1 avg2 len(5) . o2 avg3 len(5) . o3 avg4 len(5) . o4 avg5 len(5) . o5 avg6 len(5) . o6 avg7 len(5) . o7 avgsys len(5) . sy avgdia len(4) . di avgpul len(4) . pu avgbf len(4) . b_bf avgh2o len(4) . b_h2o avgbone len(3) . b_bone avgbmi len(4) . b_bmi b_bf = b_bf " " b_h2o = b_h2o " " b_bone = b_bone " " b_bmi = b_bmi " " c = " (" cnt ") " cw = " (" cntwgt ") " cbp = " (" cntbp ") " c1 = " (" cnt1 ") " c2 = " (" cnt2 ") " c3 = " (" cnt3 ") " c4 = " (" cnt4 ") " c5 = " (" cnt5 ") " c6 = " (" cnt6 ") " c7 = " (" cnt7 ") " cbmi = " (" cntbmi ") " cbp len(12) . cbp c len(11) . c cw len(11) . cw c1 len(7) . c1 c2 len(7) . c2 c3 len(7) . c3 c4 len(7) . c4 c5 len(7) . c5 c6 len(7) . c6 c7 len(7) . c7 cbmi len(7) . cbmi * avgsys len(5) . sy * avgdia len(4) . di * avgpul len(4) . pu * * avgbf len(5) . b_bf * avgh2o len(5) . b_h2o * avgbone len(4) . b_bone * avgbmi len(5) . b_bmi pt1 = " " ow cw o c o1 c1 o2 c2 o3 c3 o4 c4 o5 c5 o6 c6 o7 c7 pt2 = " " sy " " di " " pu cbp b_bf b_h2o b_bone b_bmi cbmi output = "Totals " pt1 pt2 :(END) MOD_ENTRY MOD_DJD = M - (M / N) * N :(RETURN) CVT_DAYSENTRY I = 2000 ndays = 0 cvtloop EQ(I,YR) :s(cvtsk5) it22 = MOD_DJD(I,4) * ERROR NEXT SECTION - FIXED 2/7/2020 EQ(it22,0) :f(cvtsk1) ndays = ndays + 366 I = LT(I, yr) I + 1 :s(cvtloop)f(cvtsk5) cvtsk1 ndays = ndays + 365 I = LT(I, yr) I + 1 :s(cvtloop)f(cvtsk5) cvtsk5 it22 = MOD_DJD(yr,4) EQ(it22,0) :f(cvtsk6) eq(mo,1) :f(lp_mo2) ndays = ndays + da :(retcvt) lp_mo2 eq(mo,2) :f(lp_mo3) ndays = ndays + da + 31 :(retcvt) lp_mo3 eq(mo,3) :f(lp_mo4) ndays = ndays + da + 31 + 29 :(retcvt) lp_mo4 eq(mo,4) :f(lp_mo5) ndays = ndays + da + 31 + 29 + 31 :(retcvt) lp_mo5 eq(mo,5) :f(lp_mo6) ndays = ndays + da + 31 + 29 + 31 + 30 :(retcvt) lp_mo6 eq(mo,6) :f(lp_mo7) ndays = ndays + da + 31 + 29 + 31 + 30 + 31 :(retcvt) lp_mo7 eq(mo,7) :f(lp_mo8) ndays = ndays + da + 31 + 29 + 31 + 30 + 31 + 30 :(retcvt) lp_mo8 eq(mo,8) :f(lp_mo9) ndays = ndays + da + 31 + 29 + 31 + 30 + 31 + 30 + 31 :(retcvt) lp_mo9 eq(mo,9) :f(lp_mo10) ndays = ndays + da + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 :(retcvt) lp_mo10 eq(mo,10) :f(lp_mo11) ndays = ndays + da + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 :(retcvt) lp_mo11 eq(mo,11) :f(lp_mo12) ndays = ndays + da + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 :(retcvt) lp_mo12 ndays = ndays + da + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 :(retcvt) cvtsk6 eq(mo,1) :f(rg_mo2) ndays = ndays + da :(retcvt) rg_mo2 eq(mo,2) :f(rg_mo3) ndays = ndays + da + 31 :(retcvt) rg_mo3 eq(mo,3) :f(rg_mo4) ndays = ndays + da + 31 + 28 :(retcvt) rg_mo4 eq(mo,4) :f(rg_mo5) ndays = ndays + da + 31 + 28 + 31 :(retcvt) rg_mo5 eq(mo,5) :f(rg_mo6) ndays = ndays + da + 31 + 28 + 31 + 30 :(retcvt) rg_mo6 eq(mo,6) :f(rg_mo7) ndays = ndays + da + 31 + 28 + 31 + 30 + 31 :(retcvt) rg_mo7 eq(mo,7) :f(rg_mo8) ndays = ndays + da + 31 + 28 + 31 + 30 + 31 + 30 :s(retcvt) rg_mo8 eq(mo,8) :f(rg_mo9) ndays = ndays + da + 31 + 28 + 31 + 30 + 31 + 30 + 31 :(retcvt) rg_mo9 eq(mo,9) :f(rg_mo10) ndays = ndays + da + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 :s(retcvt) rg_mo10 eq(mo,10) :f(rg_mo11) ndays = ndays + da + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 :(retcvt) rg_mo11 eq(mo,11) :f(rg_mo12) ndays = ndays + da + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 :(retcvt) rg_mo12 ndays = ndays + da + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 :(retcvt) retcvt cvt_days = ndays :(return) ERROUT1 OUTPUT = "ERROR in DATE YR = " YR " MO = " MO " DA = " DA output = "day_check = " day_check " yr = " yr " mo = " mo " da = " da END