This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, gold 20Aug2020
Title: Demo for TCL table format V2
gold 20aug2020 Here are some calculations for converting HbA1c measurement to average blood glucose mg/dl over a 3 month period. Console program outputs data as table in TCL table format and comma delimited spreadsheet.
Here are TCL calculations on the equation converting HbA1c to Average Blood Glucose mg/dl. Console program example demo was written on Windows 10, working under TCL version 8.6 20aug2020. Each HbA1c reading usually from limits of 4.0 to 11 has an equivalent average blood glucose over a 3 month period. ADA formula from Diabetes Care, 2012. As peg point, 5 HbA1c units converts to 100 mg/dl abbreviation for milligrams per deciliter. Note. This Diabetes Care field is rapidly changing, one needs to check in at ADA professional.diabetes.org for the latest up to date info.
ADA Quotes. Therefore, to change glucose from mg/dL to mmol/L, one divides by 18.016 (usually rounded off to 18), and values are multiplied by 18 to switch from mmol/L to mg/dL. For example, 126 mg/dL is equivalent to 7.0 mmol/L, and 40 mg/dL is 2.2 mmol/L.
ADA Quotes. Developing an HbA1c-Based Equation to Estimate Blood Glucose in Maintenance Hemodialysis Patients,2013. Some equations showing a good correlation between HbA1c and average BG (AG) levels.The Diabetes Control and Complications Trial DCCT formula is Average Blood Glucose = expr { 35.6 * HbA1c − 77.3} < in milligrams per deciliter>.
# pretty print from autoindent and ased editor # Convert HbA1c to Average Blood Glucose mg/dl V2 # Console program example demo # written on Windows 10 on TCL # working under TCL version 8.6 # gold on TCL Club , 20aug2020 # Each HbA1c reading usually from # limits of 4.0 to 11 # has an equivalent average blood glucose # over a 3 month period. # formula from Diabetes Care, 2012. # Roughly 5 HbA1c converts to 100 # mg/dl abbrev. for milligrams per deciliter # mmol/L abbrev. for milligrams per Liter package require Tk package require math::numtheory package require math::constants package require math::trig package require math namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants } set tclprecision 17 console show # following dresses up console output to easy eye console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} set tclprecision 17 # hbA1c_convert_to_average_blood_glucose mg/dl HbA1c proc a1c hbA1c { expr { 35.6*$hbA1c -77.3} } # convert mg/dl to mmol/L average blood glucose # some papers round off 18.016 to mgdl/18. proc mgdl_to_mmoll mgdl { expr { $mgdl/18.0 } } # convert mmol/L to mg/dl average blood glucose proc mmoll_to_mgdl mmoll { expr { $mmoll*18.0 } } # proc precisionx used to round off floating point numbers proc precisionx {precision float} { # tcl:wiki:Floating-point formatting, <AM> # select numbers only, not used on every number. set x [ expr {round( 10 ** $precision * $float) / (10.0 ** $precision)} ] # rounded or clipped to nearest 5ird significant figure set x [ format "%#.5g" $x ] return $x } proc table_format_out n { set sum 0 # initial hbA1c level set count 4.0 puts "%| table| | printed in|TCL format |% " puts "%| HbA1c units | mg/dl units |conv. mmol/L units |comment, if any|% " # adapted proc from <RS> # printout in TCL WIKI format table for { set i 1 } { $i <= $n } { incr i } { set count [+ $count .1] set mgdl5 [ precisionx 3 [ a1c $count ]] set mmoll [ precisionx 3 [mgdl_to_mmoll [ a1c $count ]]] puts "&| [ precisionx 3 $count ] | $mgdl5 | $mmoll | |&" incr sum $i } return $sum } proc comma_delimit_format n { set sum 0 # initial hbA1c level set count 4.0 puts "table, , printed in, TCL format " puts "HbA1c units , mg/dl units , conv. mmol/L units, comment, if any " # adapted proc from <RS> # printout in TCL comma delimited format for { set i 1 } { $i <= $n } { incr i } { set count [+ $count .1] set mgdl5 [ precisionx 3 [ a1c $count ]] set mmoll [ precisionx 3 [mgdl_to_mmoll [ a1c $count ]]] puts "[ precisionx 3 $count ] , $mgdl5, $mmoll , ," incr sum $i } return $sum } table_format_out 90 comma_delimit_format 90
Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, gold 12Aug2020
Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |