<jupyter_start><jupyter_text>A Cohort Study of Myopia Amoung Taiwan Elementary School Students---* Population : one of elementary school students at Taiwan New Taipei city* Tracking Time period : 2011 - 2016> Description :> This mimi project use python module Bokeh to create interactive charts for insight the Myopia progress among elementary school students    Import modules<jupyter_code>from bokeh.plotting import figure, gridplot, output_file, show, vplot
from bokeh.models import HoverTool, layouts<jupyter_output><empty_output><jupyter_text>A Cohort Study of Myopia Amoung Taiwan Elementary School Students<jupyter_code>output_file("out1.html", title="A Cohort Study of Myopia Amoung Taiwan Elementary School Students")

# add a line renderer with a NaN
NaN = float('nan') 

# Set X-Y
Sem =["2011 S1","2011 S2","2012 S1","2012 S2","2013 S1","2013 S2","2014 S1","2014 S2","2015 S1","2015 S2","2016 S1"]

y6G = {'val': [48.9, 58.5, 39.6, 37.5, 44.4, 50.5, 54.9, 58.8, 60, 59, 65.4], 'color' : "black", 'legend':'2011 Entered Current G6'}
y5G = {'val': [NaN, NaN, 20.4, 21.4, 21.5, 36.1, 39.8, 43.4, 46, 49.6, 51.3], 'color' : "firebrick", 'legend':'2012 Entered Current G5'}
y4G = {'val': [NaN, NaN, NaN, NaN, 24.8, 25.7, 29, 40.2, 40, 42.3, 48.2], 'color' : "navy", 'legend':'2013 Entered Current G4'}
y3G = {'val': [NaN, NaN, NaN, NaN, NaN, NaN, 23.4, 29.7, 31, 34.5, 35], 'color' : "green", 'legend':'2014 Entered Current G3'}
y2G = {'val': [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 25.3, 23, 33.3], 'color' : "purple", 'legend':'2015 Entered Current G2'}
y1G = {'val': [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 37.2], 'color' : "pink", 'legend':'2016 Entered Current G1'}

iterate = [y6G,y5G,y4G,y3G,y2G,y1G]

# Set Figure Structure
st1 = figure(title="Student Myopia Cohort by Current Study Grades",
             x_axis_label='Study Years - Semesters',
             y_axis_label='Average Vision',
             x_range=Sem,
             width=1000,
             height=500,
             tools="")

st1.title.text_font_size = '25pt'

# Set plot type for each Grade
for G in iterate:
    po1 = st1.line(Sem, G['val'], line_color=G['color'], line_width=8, legend=G['legend'])
    st1.circle(Sem, G['val'], fill_color=G['color'], size=16 , legend=G['legend'])
    st1.legend.location="bottom_left"
    st1.legend.border_line_color = "gray"
    st1.add_tools(HoverTool(renderers=[po1], tooltips={"Average Vision":"$y", "Year-Semester":"$x"}))
 
#show(st1)<jupyter_output><empty_output><jupyter_text>A Cohort Study of Myopia Amoung Taiwan Elementary School Students<jupyter_code>output_file("out2.html", title="A Cohort Study of Myopia Amoung Taiwan Elementary School Students")

# add a line renderer with a NaN
NaN = float('nan') 
Y2011_S1 = {'val': [48.9, NaN, NaN, NaN, NaN, NaN], 'color' : "#000000", 'legend':'2011 Semester 1'}
Y2011_S2 = {'val': [58.5, NaN, NaN, NaN, NaN, NaN], 'color' : "#000033", 'legend':'2011 Semester 2'}
Y2012_S1 = {'val': [39.6, 20.4, NaN, NaN, NaN, NaN], 'color' : "#000066", 'legend':'2012 Semester 1'}
Y2012_S2 = {'val': [37.5, 21.4, NaN, NaN, NaN, NaN], 'color' : "#000099", 'legend':'2012 Semester 2'}
Y2013_S1 = {'val': [44.4, 21.5, 24.8, NaN, NaN, NaN], 'color' : "#0000cc", 'legend':'2013 Semester 1'}
Y2013_S2 = {'val': [50.5, 36.1, 25.7, NaN, NaN, NaN], 'color' : "#0000ff", 'legend':'2013 Semester 2'}
Y2014_S1 = {'val': [54.9, 39.8, 29, 23.4, NaN, NaN], 'color' : "#3333ff", 'legend':'2014 Semester 1'}
Y2014_S2 = {'val': [58.8, 43.4, 40.2, 29.7, NaN, NaN], 'color' : "#6666ff", 'legend':'2014 Semester 2'}
Y2015_S1 = {'val': [60, 46, 40, 31, 25.3, NaN], 'color' : "#9999ff", 'legend':'2015 Semester 1'}
Y2015_S2 = {'val': [59, 49.6, 42.3, 34.5, 23, NaN], 'color' : "#ccccff", 'legend':'2015 Semester 2'}
Y2016_S1 = {'val': [65.4, 51.3, 48.2, 35, 33.3, 37.2], 'color' : "#e6e6ff", 'legend':'2016 Semester 1'}

Grade =["Grade 6","Grade 5", "Grade 4", "Grade 3", "Grade 2", "Grade 1"]
iterate = [Y2011_S1, Y2011_S2, Y2012_S1, Y2012_S2, Y2013_S1, Y2013_S2,
           Y2014_S1, Y2014_S2, Y2015_S1, Y2015_S2, Y2016_S1]

# Set Figure Structure
st2 = figure(title="Snapshot Student Myopia Cohort by Each Semesters",
             x_axis_label='Grades',
             y_axis_label='Average Vision',
             x_range=Grade,
             width=1000,
             height=580,
             tools="")

st2.title.text_font_size = '25pt'

# Set plot type for each Semester
for S in iterate:
    po2 = st2.line(Grade, S['val'], line_color=S['color'], line_width=8, legend=S['legend'])
    st2.circle(Grade, S['val'], fill_color=S['color'], size=16 , legend=S['legend'])
    st2.legend.border_line_color = "gray"
    st2.add_tools(HoverTool(renderers=[po2], tooltips={"Average Vision":"$y", "Grade":"$x"}))
    
#show(st2)<jupyter_output><empty_output><jupyter_text>Combine two interactive charts<jupyter_code>output_file("Students Myopia Cohort.html")

# put all the plots in a VBox
a = layouts.Column(st1, st2)

# show the results
show(a)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18419477150269406, 'fraction_numerical': 0.11355018958291759, 'mean_word_length': 4.507692307692308, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '247453', 'license': 'MIT', 'n_tokens_mistral': 2399, 'n_tokens_neox': 1884, 'n_words': 533, 'path': 'Visualization Students Myopia Cohort/A Cohort Study of Myopia Amoung Taiwan Elementary School Students.ipynb', 'repo_name': 'iamshihshan/Project', 'size': '5011'}