import%20marimo%0A%0A__generated_with%20%3D%20%220.17.0%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20pandas%20as%20pd%0A%20%20%20%20import%20plotly.express%20as%20px%0A%20%20%20%20import%20plotly.graph_objects%20as%20go%0A%20%20%20%20from%20pathlib%20import%20Path%0A%20%20%20%20return%20Path%2C%20go%2C%20mo%2C%20pd%2C%20px%0A%0A%0A%40app.cell%0Adef%20_(Path)%3A%0A%20%20%20%20%23%20File%20paths%0A%20%20%20%20project_dir%20%3D%20Path(%22%2FUsers%2Fprahlaad%2FDocuments%2FProjects%2FGlucose%20Monitor%20Project%22)%0A%20%20%20%20abbott_csv%20%3D%20project_dir%20%2F%20%22abbott_clean.csv%22%0A%20%20%20%20stelo_csv%20%3D%20project_dir%20%2F%20%22stelo_clean.csv%22%0A%20%20%20%20return%20abbott_csv%2C%20stelo_csv%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%20Glucose%20Monitor%20Data%20Analysis%0A%0A%20%20%20%20Comparative%20analysis%20of%20glucose%20monitoring%20data%20from%20two%20CGM%20systems%20with%20aligned%20time%20ranges%3A%0A%20%20%20%20-%20**Abbott%20Lingo**%3A%20Over-the-counter%20CGM%20system%0A%20%20%20%20-%20**Dexcom%20Stelo**%3A%20Over-the-counter%20CGM%20system%0A%0A%20%20%20%20**Note**%3A%20Both%20datasets%20have%20been%20filtered%20to%20cover%20the%20same%20overlapping%20time%20period%20(March%2022%20-%20April%202%2C%202025).%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(abbott_csv%2C%20pd)%3A%0A%20%20%20%20%23%20Load%20Abbott%20data%0A%20%20%20%20df_abbott%20%3D%20pd.read_csv(abbott_csv)%0A%20%20%20%20df_abbott%5B'Timestamp_EST'%5D%20%3D%20pd.to_datetime(df_abbott%5B'Timestamp_EST'%5D)%0A%20%20%20%20df_abbott%5B'Date'%5D%20%3D%20pd.to_datetime(df_abbott%5B'Date'%5D)%0A%20%20%20%20df_abbott%5B'Hour'%5D%20%3D%20df_abbott%5B'Timestamp_EST'%5D.dt.hour%0A%20%20%20%20df_abbott%5B'DayOfWeek'%5D%20%3D%20df_abbott%5B'Timestamp_EST'%5D.dt.day_name()%0A%20%20%20%20return%20(df_abbott%2C)%0A%0A%0A%40app.cell%0Adef%20_(pd%2C%20stelo_csv)%3A%0A%20%20%20%20%23%20Load%20Stelo%20data%0A%20%20%20%20df_stelo%20%3D%20pd.read_csv(stelo_csv)%0A%20%20%20%20df_stelo%5B'Timestamp_EST'%5D%20%3D%20pd.to_datetime(df_stelo%5B'Timestamp_EST'%5D)%0A%20%20%20%20df_stelo%5B'Date'%5D%20%3D%20pd.to_datetime(df_stelo%5B'Date'%5D)%0A%20%20%20%20df_stelo%5B'Hour'%5D%20%3D%20df_stelo%5B'Timestamp_EST'%5D.dt.hour%0A%20%20%20%20df_stelo%5B'DayOfWeek'%5D%20%3D%20df_stelo%5B'Timestamp_EST'%5D.dt.day_name()%0A%20%20%20%20return%20(df_stelo%2C)%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20df_stelo%2C%20mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%23%23%20Data%20Overview%0A%0A%20%20%20%20%23%23%23%20Abbott%20Lingo%0A%20%20%20%20-%20**Total%20Readings%3A**%20%7Blen(df_abbott)%3A%2C%7D%0A%20%20%20%20-%20**Date%20Range%20(EST)%3A**%20%7Bdf_abbott%5B'Timestamp_EST'%5D.min()%7D%20to%20%7Bdf_abbott%5B'Timestamp_EST'%5D.max()%7D%0A%20%20%20%20-%20**Average%20Glucose%3A**%20%7Bdf_abbott%5B'Glucose_mg_dL'%5D.mean()%3A.1f%7D%20mg%2FdL%0A%20%20%20%20-%20**Glucose%20Range%3A**%20%7Bdf_abbott%5B'Glucose_mg_dL'%5D.min()%3A.0f%7D%20-%20%7Bdf_abbott%5B'Glucose_mg_dL'%5D.max()%3A.0f%7D%20mg%2FdL%0A%0A%20%20%20%20%23%23%23%20Dexcom%20Stelo%0A%20%20%20%20-%20**Total%20Readings%3A**%20%7Blen(df_stelo)%3A%2C%7D%0A%20%20%20%20-%20**Date%20Range%20(EST)%3A**%20%7Bdf_stelo%5B'Timestamp_EST'%5D.min()%7D%20to%20%7Bdf_stelo%5B'Timestamp_EST'%5D.max()%7D%0A%20%20%20%20-%20**Average%20Glucose%3A**%20%7Bdf_stelo%5B'Glucose_mg_dL'%5D.mean()%3A.1f%7D%20mg%2FdL%0A%20%20%20%20-%20**Glucose%20Range%3A**%20%7Bdf_stelo%5B'Glucose_mg_dL'%5D.min()%3A.0f%7D%20-%20%7Bdf_stelo%5B'Glucose_mg_dL'%5D.max()%3A.0f%7D%20mg%2FdL%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20---%0A%0A%20%20%20%20%23%23%20Abbott%20Lingo%20Visualizations%0A%0A%20%20%20%20Interactive%20visualizations%20of%20Abbott%20Lingo%20glucose%20monitoring%20data.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20px)%3A%0A%20%20%20%20%23%20Abbott%20time%20series%0A%20%20%20%20fig_abbott_ts%20%3D%20px.line(%0A%20%20%20%20%20%20%20%20df_abbott%2C%0A%20%20%20%20%20%20%20%20x%3D'Timestamp_EST'%2C%0A%20%20%20%20%20%20%20%20y%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20title%3D'Abbott%20Lingo%3A%20Glucose%20Levels%20Over%20Time'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'Timestamp_EST'%3A%20'Date%20%26%20Time%20(EST)'%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_abbott_ts.add_hrect(y0%3D70%2C%20y1%3D180%2C%20fillcolor%3D%22green%22%2C%20opacity%3D0.1%2C%20line_width%3D0)%0A%20%20%20%20fig_abbott_ts.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%20(70)%22)%0A%20%20%20%20fig_abbott_ts.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%20(180)%22)%0A%20%20%20%20fig_abbott_ts.update_layout(height%3D500)%0A%20%20%20%20fig_abbott_ts%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20px)%3A%0A%20%20%20%20%23%20Abbott%20distribution%0A%20%20%20%20fig_abbott_dist%20%3D%20px.histogram(%0A%20%20%20%20%20%20%20%20df_abbott%2C%0A%20%20%20%20%20%20%20%20x%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20nbins%3D50%2C%0A%20%20%20%20%20%20%20%20title%3D'Abbott%20Lingo%3A%20Glucose%20Distribution'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'count'%3A%20'Frequency'%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_abbott_dist.add_vline(x%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%22)%0A%20%20%20%20fig_abbott_dist.add_vline(x%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%22)%0A%20%20%20%20fig_abbott_dist.add_vline(x%3Ddf_abbott%5B'Glucose_mg_dL'%5D.mean()%2C%20line_dash%3D%22dot%22%2C%20line_color%3D%22blue%22%2C%20annotation_text%3D%22Mean%22)%0A%20%20%20%20fig_abbott_dist.update_layout(height%3D400)%0A%20%20%20%20fig_abbott_dist%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20px)%3A%0A%20%20%20%20%23%20Abbott%20hourly%20patterns%0A%20%20%20%20fig_abbott_hourly%20%3D%20px.box(%0A%20%20%20%20%20%20%20%20df_abbott%2C%0A%20%20%20%20%20%20%20%20x%3D'Hour'%2C%0A%20%20%20%20%20%20%20%20y%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20title%3D'Abbott%20Lingo%3A%20Glucose%20Levels%20by%20Hour%20of%20Day'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'Hour'%3A%20'Hour%20of%20Day'%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_abbott_hourly.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_abbott_hourly.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_abbott_hourly.update_layout(height%3D450)%0A%20%20%20%20fig_abbott_hourly%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20px)%3A%0A%20%20%20%20%23%20Abbott%20daily%20patterns%0A%20%20%20%20day_order%20%3D%20%5B'Monday'%2C%20'Tuesday'%2C%20'Wednesday'%2C%20'Thursday'%2C%20'Friday'%2C%20'Saturday'%2C%20'Sunday'%5D%0A%20%20%20%20fig_abbott_daily%20%3D%20px.box(%0A%20%20%20%20%20%20%20%20df_abbott%2C%0A%20%20%20%20%20%20%20%20x%3D'DayOfWeek'%2C%0A%20%20%20%20%20%20%20%20y%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20title%3D'Abbott%20Lingo%3A%20Glucose%20Levels%20by%20Day%20of%20Week'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'DayOfWeek'%3A%20'Day'%7D%2C%0A%20%20%20%20%20%20%20%20category_orders%3D%7B'DayOfWeek'%3A%20day_order%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_abbott_daily.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_abbott_daily.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_abbott_daily.update_layout(height%3D450)%0A%20%20%20%20fig_abbott_daily%0A%20%20%20%20return%20(day_order%2C)%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20pd)%3A%0A%20%20%20%20%23%20Abbott%20time%20in%20range%0A%20%20%20%20total_abbott%20%3D%20len(df_abbott)%0A%20%20%20%20in_range_abbott%20%3D%20len(df_abbott%5B(df_abbott%5B'Glucose_mg_dL'%5D%20%3E%3D%2070)%20%26%20(df_abbott%5B'Glucose_mg_dL'%5D%20%3C%3D%20180)%5D)%0A%20%20%20%20below_range_abbott%20%3D%20len(df_abbott%5Bdf_abbott%5B'Glucose_mg_dL'%5D%20%3C%2070%5D)%0A%20%20%20%20above_range_abbott%20%3D%20len(df_abbott%5Bdf_abbott%5B'Glucose_mg_dL'%5D%20%3E%20180%5D)%0A%0A%20%20%20%20tir_abbott%20%3D%20pd.DataFrame(%7B%0A%20%20%20%20%20%20%20%20'Category'%3A%20%5B'In%20Range%20(70-180)'%2C%20'Below%20Range%20(%3C70)'%2C%20'Above%20Range%20(%3E180)'%5D%2C%0A%20%20%20%20%20%20%20%20'Count'%3A%20%5Bin_range_abbott%2C%20below_range_abbott%2C%20above_range_abbott%5D%2C%0A%20%20%20%20%20%20%20%20'Percentage'%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20(in_range_abbott%20%2F%20total_abbott%20*%20100)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(below_range_abbott%20%2F%20total_abbott%20*%20100)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(above_range_abbott%20%2F%20total_abbott%20*%20100)%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20above_range_abbott%2C%0A%20%20%20%20%20%20%20%20below_range_abbott%2C%0A%20%20%20%20%20%20%20%20in_range_abbott%2C%0A%20%20%20%20%20%20%20%20tir_abbott%2C%0A%20%20%20%20%20%20%20%20total_abbott%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20_(mo%2C%20tir_abbott)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%23%23%23%20Abbott%3A%20Time%20in%20Range%20Statistics%0A%0A%20%20%20%20%7Btir_abbott.to_markdown(index%3DFalse)%7D%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(px%2C%20tir_abbott)%3A%0A%20%20%20%20%23%20Abbott%20TIR%20pie%20chart%0A%20%20%20%20fig_abbott_tir%20%3D%20px.pie(%0A%20%20%20%20%20%20%20%20tir_abbott%2C%0A%20%20%20%20%20%20%20%20values%3D'Percentage'%2C%0A%20%20%20%20%20%20%20%20names%3D'Category'%2C%0A%20%20%20%20%20%20%20%20title%3D'Abbott%20Lingo%3A%20Time%20in%20Range%20Distribution'%2C%0A%20%20%20%20%20%20%20%20color%3D'Category'%2C%0A%20%20%20%20%20%20%20%20color_discrete_map%3D%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20'In%20Range%20(70-180)'%3A%20'green'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Below%20Range%20(%3C70)'%3A%20'red'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Above%20Range%20(%3E180)'%3A%20'orange'%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_abbott_tir.update_traces(textposition%3D'inside'%2C%20textinfo%3D'percent%2Blabel')%0A%20%20%20%20fig_abbott_tir.update_layout(height%3D400)%0A%20%20%20%20fig_abbott_tir%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20go)%3A%0A%20%20%20%20%23%20Abbott%20AGP%0A%20%20%20%20agp_abbott%20%3D%20df_abbott.groupby('Hour')%5B'Glucose_mg_dL'%5D.agg(%5B%0A%20%20%20%20%20%20%20%20('p5'%2C%20lambda%20x%3A%20x.quantile(0.05))%2C%0A%20%20%20%20%20%20%20%20('p25'%2C%20lambda%20x%3A%20x.quantile(0.25))%2C%0A%20%20%20%20%20%20%20%20('median'%2C%20'median')%2C%0A%20%20%20%20%20%20%20%20('p75'%2C%20lambda%20x%3A%20x.quantile(0.75))%2C%0A%20%20%20%20%20%20%20%20('p95'%2C%20lambda%20x%3A%20x.quantile(0.95))%0A%20%20%20%20%5D).reset_index()%0A%0A%20%20%20%20fig_agp_abbott%20%3D%20go.Figure()%0A%0A%20%20%20%20fig_agp_abbott.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'p95'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'95th%20percentile'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%2C%20showlegend%3DFalse%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_abbott.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'p5'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'5th-95th%20percentile'%2C%0A%20%20%20%20%20%20%20%20fill%3D'tonexty'%2C%20fillcolor%3D'rgba(135%2C%20206%2C%20250%2C%200.2)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_abbott.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'p75'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'75th%20percentile'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%2C%20showlegend%3DFalse%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_abbott.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'p25'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'25th-75th%20percentile%20(IQR)'%2C%0A%20%20%20%20%20%20%20%20fill%3D'tonexty'%2C%20fillcolor%3D'rgba(30%2C%20144%2C%20255%2C%200.3)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_abbott.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'median'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'Median'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'blue'%2C%20width%3D2)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_abbott.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%20(70)%22)%0A%20%20%20%20fig_agp_abbott.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%20(180)%22)%0A%0A%20%20%20%20fig_agp_abbott.update_layout(%0A%20%20%20%20%20%20%20%20title%3D'Abbott%20Lingo%3A%20Ambulatory%20Glucose%20Profile%20(AGP)%20-%20Daily%20Pattern'%2C%0A%20%20%20%20%20%20%20%20xaxis_title%3D'Hour%20of%20Day'%2C%0A%20%20%20%20%20%20%20%20yaxis_title%3D'Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%2C%0A%20%20%20%20%20%20%20%20height%3D500%2C%0A%20%20%20%20%20%20%20%20hovermode%3D'x%20unified'%0A%20%20%20%20)%0A%0A%20%20%20%20fig_agp_abbott%0A%20%20%20%20return%20(agp_abbott%2C)%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20---%0A%0A%20%20%20%20%23%23%20Dexcom%20Stelo%20Visualizations%0A%0A%20%20%20%20Interactive%20visualizations%20of%20Dexcom%20Stelo%20over-the-counter%20CGM%20data.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_stelo%2C%20px)%3A%0A%20%20%20%20%23%20Stelo%20time%20series%0A%20%20%20%20fig_stelo_ts%20%3D%20px.line(%0A%20%20%20%20%20%20%20%20df_stelo%2C%0A%20%20%20%20%20%20%20%20x%3D'Timestamp_EST'%2C%0A%20%20%20%20%20%20%20%20y%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20title%3D'Dexcom%20Stelo%3A%20Glucose%20Levels%20Over%20Time'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'Timestamp_EST'%3A%20'Date%20%26%20Time%20(EST)'%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_stelo_ts.add_hrect(y0%3D70%2C%20y1%3D180%2C%20fillcolor%3D%22green%22%2C%20opacity%3D0.1%2C%20line_width%3D0)%0A%20%20%20%20fig_stelo_ts.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%20(70)%22)%0A%20%20%20%20fig_stelo_ts.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%20(180)%22)%0A%20%20%20%20fig_stelo_ts.update_layout(height%3D500)%0A%20%20%20%20fig_stelo_ts%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_stelo%2C%20px)%3A%0A%20%20%20%20%23%20Stelo%20distribution%0A%20%20%20%20fig_stelo_dist%20%3D%20px.histogram(%0A%20%20%20%20%20%20%20%20df_stelo%2C%0A%20%20%20%20%20%20%20%20x%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20nbins%3D50%2C%0A%20%20%20%20%20%20%20%20title%3D'Dexcom%20Stelo%3A%20Glucose%20Distribution'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'count'%3A%20'Frequency'%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_stelo_dist.add_vline(x%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%22)%0A%20%20%20%20fig_stelo_dist.add_vline(x%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%22)%0A%20%20%20%20fig_stelo_dist.add_vline(x%3Ddf_stelo%5B'Glucose_mg_dL'%5D.mean()%2C%20line_dash%3D%22dot%22%2C%20line_color%3D%22blue%22%2C%20annotation_text%3D%22Mean%22)%0A%20%20%20%20fig_stelo_dist.update_layout(height%3D400)%0A%20%20%20%20fig_stelo_dist%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_stelo%2C%20px)%3A%0A%20%20%20%20%23%20Stelo%20hourly%20patterns%0A%20%20%20%20fig_stelo_hourly%20%3D%20px.box(%0A%20%20%20%20%20%20%20%20df_stelo%2C%0A%20%20%20%20%20%20%20%20x%3D'Hour'%2C%0A%20%20%20%20%20%20%20%20y%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20title%3D'Dexcom%20Stelo%3A%20Glucose%20Levels%20by%20Hour%20of%20Day'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'Hour'%3A%20'Hour%20of%20Day'%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_stelo_hourly.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_stelo_hourly.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_stelo_hourly.update_layout(height%3D450)%0A%20%20%20%20fig_stelo_hourly%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(day_order%2C%20df_stelo%2C%20px)%3A%0A%20%20%20%20%23%20Stelo%20daily%20patterns%0A%20%20%20%20fig_stelo_daily%20%3D%20px.box(%0A%20%20%20%20%20%20%20%20df_stelo%2C%0A%20%20%20%20%20%20%20%20x%3D'DayOfWeek'%2C%0A%20%20%20%20%20%20%20%20y%3D'Glucose_mg_dL'%2C%0A%20%20%20%20%20%20%20%20title%3D'Dexcom%20Stelo%3A%20Glucose%20Levels%20by%20Day%20of%20Week'%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'Glucose_mg_dL'%3A%20'Glucose%20(mg%2FdL)'%2C%20'DayOfWeek'%3A%20'Day'%7D%2C%0A%20%20%20%20%20%20%20%20category_orders%3D%7B'DayOfWeek'%3A%20day_order%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_stelo_daily.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_stelo_daily.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_stelo_daily.update_layout(height%3D450)%0A%20%20%20%20fig_stelo_daily%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_stelo%2C%20pd)%3A%0A%20%20%20%20%23%20Stelo%20time%20in%20range%0A%20%20%20%20total_stelo%20%3D%20len(df_stelo)%0A%20%20%20%20in_range_stelo%20%3D%20len(df_stelo%5B(df_stelo%5B'Glucose_mg_dL'%5D%20%3E%3D%2070)%20%26%20(df_stelo%5B'Glucose_mg_dL'%5D%20%3C%3D%20180)%5D)%0A%20%20%20%20below_range_stelo%20%3D%20len(df_stelo%5Bdf_stelo%5B'Glucose_mg_dL'%5D%20%3C%2070%5D)%0A%20%20%20%20above_range_stelo%20%3D%20len(df_stelo%5Bdf_stelo%5B'Glucose_mg_dL'%5D%20%3E%20180%5D)%0A%0A%20%20%20%20tir_stelo%20%3D%20pd.DataFrame(%7B%0A%20%20%20%20%20%20%20%20'Category'%3A%20%5B'In%20Range%20(70-180)'%2C%20'Below%20Range%20(%3C70)'%2C%20'Above%20Range%20(%3E180)'%5D%2C%0A%20%20%20%20%20%20%20%20'Count'%3A%20%5Bin_range_stelo%2C%20below_range_stelo%2C%20above_range_stelo%5D%2C%0A%20%20%20%20%20%20%20%20'Percentage'%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20(in_range_stelo%20%2F%20total_stelo%20*%20100)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(below_range_stelo%20%2F%20total_stelo%20*%20100)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(above_range_stelo%20%2F%20total_stelo%20*%20100)%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20above_range_stelo%2C%0A%20%20%20%20%20%20%20%20below_range_stelo%2C%0A%20%20%20%20%20%20%20%20in_range_stelo%2C%0A%20%20%20%20%20%20%20%20tir_stelo%2C%0A%20%20%20%20%20%20%20%20total_stelo%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20_(mo%2C%20tir_stelo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%23%23%23%20Stelo%3A%20Time%20in%20Range%20Statistics%0A%0A%20%20%20%20%7Btir_stelo.to_markdown(index%3DFalse)%7D%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(px%2C%20tir_stelo)%3A%0A%20%20%20%20%23%20Stelo%20TIR%20pie%20chart%0A%20%20%20%20fig_stelo_tir%20%3D%20px.pie(%0A%20%20%20%20%20%20%20%20tir_stelo%2C%0A%20%20%20%20%20%20%20%20values%3D'Percentage'%2C%0A%20%20%20%20%20%20%20%20names%3D'Category'%2C%0A%20%20%20%20%20%20%20%20title%3D'Dexcom%20Stelo%3A%20Time%20in%20Range%20Distribution'%2C%0A%20%20%20%20%20%20%20%20color%3D'Category'%2C%0A%20%20%20%20%20%20%20%20color_discrete_map%3D%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20'In%20Range%20(70-180)'%3A%20'green'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Below%20Range%20(%3C70)'%3A%20'red'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Above%20Range%20(%3E180)'%3A%20'orange'%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%0A%20%20%20%20)%0A%20%20%20%20fig_stelo_tir.update_traces(textposition%3D'inside'%2C%20textinfo%3D'percent%2Blabel')%0A%20%20%20%20fig_stelo_tir.update_layout(height%3D400)%0A%20%20%20%20fig_stelo_tir%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_stelo%2C%20go)%3A%0A%20%20%20%20%23%20Stelo%20AGP%0A%20%20%20%20agp_stelo%20%3D%20df_stelo.groupby('Hour')%5B'Glucose_mg_dL'%5D.agg(%5B%0A%20%20%20%20%20%20%20%20('p5'%2C%20lambda%20x%3A%20x.quantile(0.05))%2C%0A%20%20%20%20%20%20%20%20('p25'%2C%20lambda%20x%3A%20x.quantile(0.25))%2C%0A%20%20%20%20%20%20%20%20('median'%2C%20'median')%2C%0A%20%20%20%20%20%20%20%20('p75'%2C%20lambda%20x%3A%20x.quantile(0.75))%2C%0A%20%20%20%20%20%20%20%20('p95'%2C%20lambda%20x%3A%20x.quantile(0.95))%0A%20%20%20%20%5D).reset_index()%0A%0A%20%20%20%20fig_agp_stelo%20%3D%20go.Figure()%0A%0A%20%20%20%20fig_agp_stelo.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'p95'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'95th%20percentile'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%2C%20showlegend%3DFalse%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_stelo.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'p5'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'5th-95th%20percentile'%2C%0A%20%20%20%20%20%20%20%20fill%3D'tonexty'%2C%20fillcolor%3D'rgba(135%2C%20206%2C%20250%2C%200.2)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_stelo.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'p75'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'75th%20percentile'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%2C%20showlegend%3DFalse%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_stelo.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'p25'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'25th-75th%20percentile%20(IQR)'%2C%0A%20%20%20%20%20%20%20%20fill%3D'tonexty'%2C%20fillcolor%3D'rgba(30%2C%20144%2C%20255%2C%200.3)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(width%3D0)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_stelo.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'median'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'Median'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'blue'%2C%20width%3D2)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_stelo.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%20(70)%22)%0A%20%20%20%20fig_agp_stelo.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%20(180)%22)%0A%0A%20%20%20%20fig_agp_stelo.update_layout(%0A%20%20%20%20%20%20%20%20title%3D'Dexcom%20Stelo%3A%20Ambulatory%20Glucose%20Profile%20(AGP)%20-%20Daily%20Pattern'%2C%0A%20%20%20%20%20%20%20%20xaxis_title%3D'Hour%20of%20Day'%2C%0A%20%20%20%20%20%20%20%20yaxis_title%3D'Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%2C%0A%20%20%20%20%20%20%20%20height%3D500%2C%0A%20%20%20%20%20%20%20%20hovermode%3D'x%20unified'%0A%20%20%20%20)%0A%0A%20%20%20%20fig_agp_stelo%0A%20%20%20%20return%20(agp_stelo%2C)%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20---%0A%0A%20%20%20%20%23%23%20System%20Comparison%3A%20Abbott%20Lingo%20vs%20Dexcom%20Stelo%0A%0A%20%20%20%20Side-by-side%20comparison%20of%20both%20CGM%20systems%20over%20the%20same%20time%20period.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20df_stelo%2C%20mo%2C%20pd)%3A%0A%20%20%20%20%23%20Comparison%20table%0A%20%20%20%20comparison%20%3D%20pd.DataFrame(%7B%0A%20%20%20%20%20%20%20%20'Metric'%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20'Total%20Readings'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Date%20Range'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Average%20Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Min%20Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Max%20Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'Standard%20Deviation'%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20'Abbott%20Lingo'%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Blen(df_abbott)%3A%2C%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_abbott%5B'Date'%5D.min().strftime('%25Y-%25m-%25d')%7D%20to%20%7Bdf_abbott%5B'Date'%5D.max().strftime('%25Y-%25m-%25d')%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_abbott%5B'Glucose_mg_dL'%5D.mean()%3A.1f%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_abbott%5B'Glucose_mg_dL'%5D.min()%3A.0f%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_abbott%5B'Glucose_mg_dL'%5D.max()%3A.0f%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_abbott%5B'Glucose_mg_dL'%5D.std()%3A.1f%7D%22%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20'Dexcom%20Stelo'%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Blen(df_stelo)%3A%2C%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_stelo%5B'Date'%5D.min().strftime('%25Y-%25m-%25d')%7D%20to%20%7Bdf_stelo%5B'Date'%5D.max().strftime('%25Y-%25m-%25d')%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_stelo%5B'Glucose_mg_dL'%5D.mean()%3A.1f%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_stelo%5B'Glucose_mg_dL'%5D.min()%3A.0f%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_stelo%5B'Glucose_mg_dL'%5D.max()%3A.0f%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bdf_stelo%5B'Glucose_mg_dL'%5D.std()%3A.1f%7D%22%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D)%0A%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20%23%23%23%20System%20Comparison%20Summary%0A%0A%20%20%20%20%7Bcomparison.to_markdown(index%3DFalse)%7D%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(%0A%20%20%20%20above_range_abbott%2C%0A%20%20%20%20above_range_stelo%2C%0A%20%20%20%20below_range_abbott%2C%0A%20%20%20%20below_range_stelo%2C%0A%20%20%20%20go%2C%0A%20%20%20%20in_range_abbott%2C%0A%20%20%20%20in_range_stelo%2C%0A%20%20%20%20total_abbott%2C%0A%20%20%20%20total_stelo%2C%0A)%3A%0A%20%20%20%20%23%20Time%20in%20range%20comparison%0A%20%20%20%20fig_tir_comparison%20%3D%20go.Figure()%0A%0A%20%20%20%20categories%20%3D%20%5B'In%20Range%5Cn(70-180)'%2C%20'Below%20Range%5Cn(%3C70)'%2C%20'Above%20Range%5Cn(%3E180)'%5D%0A%20%20%20%20abbott_pct%20%3D%20%5B%0A%20%20%20%20%20%20%20%20(in_range_abbott%20%2F%20total_abbott%20*%20100)%2C%0A%20%20%20%20%20%20%20%20(below_range_abbott%20%2F%20total_abbott%20*%20100)%2C%0A%20%20%20%20%20%20%20%20(above_range_abbott%20%2F%20total_abbott%20*%20100)%0A%20%20%20%20%5D%0A%20%20%20%20stelo_pct%20%3D%20%5B%0A%20%20%20%20%20%20%20%20(in_range_stelo%20%2F%20total_stelo%20*%20100)%2C%0A%20%20%20%20%20%20%20%20(below_range_stelo%20%2F%20total_stelo%20*%20100)%2C%0A%20%20%20%20%20%20%20%20(above_range_stelo%20%2F%20total_stelo%20*%20100)%0A%20%20%20%20%5D%0A%0A%20%20%20%20fig_tir_comparison.add_trace(go.Bar(%0A%20%20%20%20%20%20%20%20name%3D'Abbott%20Lingo'%2C%0A%20%20%20%20%20%20%20%20x%3Dcategories%2C%0A%20%20%20%20%20%20%20%20y%3Dabbott_pct%2C%0A%20%20%20%20%20%20%20%20marker_color%3D%5B'green'%2C%20'red'%2C%20'orange'%5D%0A%20%20%20%20))%0A%0A%20%20%20%20fig_tir_comparison.add_trace(go.Bar(%0A%20%20%20%20%20%20%20%20name%3D'Dexcom%20Stelo'%2C%0A%20%20%20%20%20%20%20%20x%3Dcategories%2C%0A%20%20%20%20%20%20%20%20y%3Dstelo_pct%2C%0A%20%20%20%20%20%20%20%20marker_color%3D%5B'lightgreen'%2C%20'lightcoral'%2C%20'lightsalmon'%5D%0A%20%20%20%20))%0A%0A%20%20%20%20fig_tir_comparison.update_layout(%0A%20%20%20%20%20%20%20%20title%3D'Time%20in%20Range%20Comparison%3A%20Abbott%20Lingo%20vs%20Dexcom%20Stelo'%2C%0A%20%20%20%20%20%20%20%20yaxis_title%3D'Percentage%20(%25)'%2C%0A%20%20%20%20%20%20%20%20barmode%3D'group'%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%2C%0A%20%20%20%20%20%20%20%20height%3D450%0A%20%20%20%20)%0A%0A%20%20%20%20fig_tir_comparison%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20---%0A%0A%20%20%20%20%23%23%20Side-by-Side%20Visualizations%0A%0A%20%20%20%20Direct%20visual%20comparison%20of%20Abbott%20Lingo%20vs%20Dexcom%20Stelo%20glucose%20readings.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20df_stelo%2C%20go)%3A%0A%20%20%20%20%23%20Combined%20time%20series%20comparison%0A%20%20%20%20fig_combined_ts%20%3D%20go.Figure()%0A%0A%20%20%20%20fig_combined_ts.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Ddf_abbott%5B'Timestamp_EST'%5D%2C%0A%20%20%20%20%20%20%20%20y%3Ddf_abbott%5B'Glucose_mg_dL'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%0A%20%20%20%20%20%20%20%20name%3D'Abbott%20Lingo'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'blue'%2C%20width%3D1.5)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_combined_ts.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Ddf_stelo%5B'Timestamp_EST'%5D%2C%0A%20%20%20%20%20%20%20%20y%3Ddf_stelo%5B'Glucose_mg_dL'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%0A%20%20%20%20%20%20%20%20name%3D'Dexcom%20Stelo'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'red'%2C%20width%3D1.5)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_combined_ts.add_hrect(y0%3D70%2C%20y1%3D180%2C%20fillcolor%3D%22green%22%2C%20opacity%3D0.1%2C%20line_width%3D0)%0A%20%20%20%20fig_combined_ts.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22red%22%2C%20annotation_text%3D%22Low%20(70)%22)%0A%20%20%20%20fig_combined_ts.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22orange%22%2C%20annotation_text%3D%22High%20(180)%22)%0A%0A%20%20%20%20fig_combined_ts.update_layout(%0A%20%20%20%20%20%20%20%20title%3D'Glucose%20Levels%20Comparison%3A%20Abbott%20Lingo%20vs%20Dexcom%20Stelo'%2C%0A%20%20%20%20%20%20%20%20xaxis_title%3D'Date%20%26%20Time%20(EST)'%2C%0A%20%20%20%20%20%20%20%20yaxis_title%3D'Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%2C%0A%20%20%20%20%20%20%20%20height%3D600%2C%0A%20%20%20%20%20%20%20%20hovermode%3D'x%20unified'%2C%0A%20%20%20%20%20%20%20%20legend%3Ddict(yanchor%3D%22top%22%2C%20y%3D0.99%2C%20xanchor%3D%22left%22%2C%20x%3D0.01)%0A%20%20%20%20)%0A%0A%20%20%20%20fig_combined_ts%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(df_abbott%2C%20df_stelo%2C%20go)%3A%0A%20%20%20%20%23%20Side-by-side%20distribution%20comparison%0A%20%20%20%20fig_dist_comparison%20%3D%20go.Figure()%0A%0A%20%20%20%20fig_dist_comparison.add_trace(go.Histogram(%0A%20%20%20%20%20%20%20%20x%3Ddf_abbott%5B'Glucose_mg_dL'%5D%2C%0A%20%20%20%20%20%20%20%20name%3D'Abbott%20Lingo'%2C%0A%20%20%20%20%20%20%20%20opacity%3D0.7%2C%0A%20%20%20%20%20%20%20%20marker_color%3D'blue'%2C%0A%20%20%20%20%20%20%20%20nbinsx%3D50%0A%20%20%20%20))%0A%0A%20%20%20%20fig_dist_comparison.add_trace(go.Histogram(%0A%20%20%20%20%20%20%20%20x%3Ddf_stelo%5B'Glucose_mg_dL'%5D%2C%0A%20%20%20%20%20%20%20%20name%3D'Dexcom%20Stelo'%2C%0A%20%20%20%20%20%20%20%20opacity%3D0.7%2C%0A%20%20%20%20%20%20%20%20marker_color%3D'red'%2C%0A%20%20%20%20%20%20%20%20nbinsx%3D50%0A%20%20%20%20))%0A%0A%20%20%20%20fig_dist_comparison.update_layout(%0A%20%20%20%20%20%20%20%20title%3D'Glucose%20Distribution%20Comparison'%2C%0A%20%20%20%20%20%20%20%20xaxis_title%3D'Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20yaxis_title%3D'Frequency'%2C%0A%20%20%20%20%20%20%20%20barmode%3D'overlay'%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%2C%0A%20%20%20%20%20%20%20%20height%3D450%2C%0A%20%20%20%20%20%20%20%20legend%3Ddict(yanchor%3D%22top%22%2C%20y%3D0.99%2C%20xanchor%3D%22right%22%2C%20x%3D0.99)%0A%20%20%20%20)%0A%0A%20%20%20%20fig_dist_comparison%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(agp_abbott%2C%20agp_stelo%2C%20go)%3A%0A%20%20%20%20%23%20Side-by-side%20AGP%20comparison%0A%20%20%20%20fig_agp_comparison%20%3D%20go.Figure()%0A%0A%20%20%20%20%23%20Abbott%20Lingo%20traces%0A%20%20%20%20fig_agp_comparison.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'median'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'Abbott%20Lingo%20(Median)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'blue'%2C%20width%3D3)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_comparison.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'p75'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'Abbott%20(25th-75th)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'blue'%2C%20width%3D0)%2C%0A%20%20%20%20%20%20%20%20showlegend%3DFalse%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_comparison.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_abbott%5B'Hour'%5D%2C%20y%3Dagp_abbott%5B'p25'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20fill%3D'tonexty'%2C%0A%20%20%20%20%20%20%20%20fillcolor%3D'rgba(0%2C%200%2C%20255%2C%200.2)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'blue'%2C%20width%3D0)%2C%0A%20%20%20%20%20%20%20%20name%3D'Abbott%20IQR'%2C%0A%20%20%20%20%20%20%20%20showlegend%3DTrue%0A%20%20%20%20))%0A%0A%20%20%20%20%23%20Dexcom%20Stelo%20traces%0A%20%20%20%20fig_agp_comparison.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'median'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'Dexcom%20Stelo%20(Median)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'red'%2C%20width%3D3)%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_comparison.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'p75'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20name%3D'Stelo%20(25th-75th)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'red'%2C%20width%3D0)%2C%0A%20%20%20%20%20%20%20%20showlegend%3DFalse%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_comparison.add_trace(go.Scatter(%0A%20%20%20%20%20%20%20%20x%3Dagp_stelo%5B'Hour'%5D%2C%20y%3Dagp_stelo%5B'p25'%5D%2C%0A%20%20%20%20%20%20%20%20mode%3D'lines'%2C%20fill%3D'tonexty'%2C%0A%20%20%20%20%20%20%20%20fillcolor%3D'rgba(255%2C%200%2C%200%2C%200.2)'%2C%0A%20%20%20%20%20%20%20%20line%3Ddict(color%3D'red'%2C%20width%3D0)%2C%0A%20%20%20%20%20%20%20%20name%3D'Stelo%20IQR'%2C%0A%20%20%20%20%20%20%20%20showlegend%3DTrue%0A%20%20%20%20))%0A%0A%20%20%20%20fig_agp_comparison.add_hline(y%3D70%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22gray%22%2C%20opacity%3D0.5)%0A%20%20%20%20fig_agp_comparison.add_hline(y%3D180%2C%20line_dash%3D%22dash%22%2C%20line_color%3D%22gray%22%2C%20opacity%3D0.5)%0A%0A%20%20%20%20fig_agp_comparison.update_layout(%0A%20%20%20%20%20%20%20%20title%3D'AGP%20Comparison%3A%20Abbott%20Lingo%20vs%20Dexcom%20Stelo'%2C%0A%20%20%20%20%20%20%20%20xaxis_title%3D'Hour%20of%20Day'%2C%0A%20%20%20%20%20%20%20%20yaxis_title%3D'Glucose%20(mg%2FdL)'%2C%0A%20%20%20%20%20%20%20%20template%3D'plotly_white'%2C%0A%20%20%20%20%20%20%20%20height%3D550%2C%0A%20%20%20%20%20%20%20%20hovermode%3D'x%20unified'%2C%0A%20%20%20%20%20%20%20%20legend%3Ddict(yanchor%3D%22top%22%2C%20y%3D0.99%2C%20xanchor%3D%22left%22%2C%20x%3D0.01)%0A%20%20%20%20)%0A%0A%20%20%20%20fig_agp_comparison%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
91aff59ec12ee58fb94bb8c0b4991e4efa4536623990e82e67e4f77046501c51