File size: 48,266 Bytes
350cda1
 
 
 
efdf97d
350cda1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efdf97d
350cda1
 
 
 
 
 
 
 
 
fed3d99
a740be5
350cda1
 
 
 
 
efdf97d
350cda1
 
 
 
a740be5
350cda1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efdf97d
 
350cda1
 
efdf97d
 
350cda1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efdf97d
350cda1
 
 
 
 
 
 
4b273a0
efdf97d
 
 
 
 
9e3bbe8
efdf97d
9e3bbe8
 
 
 
 
 
 
efdf97d
350cda1
 
 
 
efdf97d
350cda1
 
 
3e7782f
efdf97d
9e3bbe8
 
efdf97d
9e3bbe8
efdf97d
9e3bbe8
efdf97d
 
fed3d99
9e3bbe8
fed3d99
 
 
9e3bbe8
350cda1
 
 
 
efdf97d
350cda1
fed3d99
 
 
 
 
 
 
 
 
 
 
 
efdf97d
fed3d99
 
 
 
 
 
9e3bbe8
fed3d99
 
 
 
 
 
9e3bbe8
a740be5
 
 
 
 
 
 
 
 
 
 
9e3bbe8
 
fed3d99
 
efdf97d
fed3d99
 
efdf97d
fed3d99
efdf97d
 
fed3d99
 
 
 
efdf97d
fed3d99
 
 
 
 
 
 
 
efdf97d
fed3d99
 
350cda1
3e7782f
fed3d99
 
 
 
 
 
350cda1
 
 
 
efdf97d
350cda1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: panel in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (1.3.8)\n",
      "Requirement already satisfied: pandas in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (2.2.0)\n",
      "Requirement already satisfied: numpy in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (1.26.3)\n",
      "Requirement already satisfied: matplotlib in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (3.8.2)\n",
      "Requirement already satisfied: hvplot in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (0.9.2)\n",
      "Requirement already satisfied: jupyter_bokeh in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (3.0.7)\n",
      "Requirement already satisfied: nbdev in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (2.3.13)\n",
      "Requirement already satisfied: bokeh<3.4.0,>=3.2.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (3.3.4)\n",
      "Requirement already satisfied: param<3.0,>=2.0.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (2.0.2)\n",
      "Requirement already satisfied: pyviz-comms>=2.0.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (3.0.1)\n",
      "Requirement already satisfied: xyzservices>=2021.09.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (2023.10.1)\n",
      "Requirement already satisfied: markdown in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (3.5.2)\n",
      "Requirement already satisfied: markdown-it-py in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (3.0.0)\n",
      "Requirement already satisfied: linkify-it-py in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (2.0.2)\n",
      "Requirement already satisfied: mdit-py-plugins in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (0.4.0)\n",
      "Requirement already satisfied: requests in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (2.31.0)\n",
      "Requirement already satisfied: tqdm>=4.48.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (4.66.1)\n",
      "Requirement already satisfied: bleach in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (6.1.0)\n",
      "Requirement already satisfied: typing-extensions in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from panel) (4.9.0)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from pandas) (2.8.2)\n",
      "Requirement already satisfied: pytz>=2020.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from pandas) (2024.1)\n",
      "Requirement already satisfied: tzdata>=2022.7 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from pandas) (2023.4)\n",
      "Requirement already satisfied: contourpy>=1.0.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (1.2.0)\n",
      "Requirement already satisfied: cycler>=0.10 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (0.12.1)\n",
      "Requirement already satisfied: fonttools>=4.22.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (4.47.2)\n",
      "Requirement already satisfied: kiwisolver>=1.3.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (1.4.5)\n",
      "Requirement already satisfied: packaging>=20.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (23.2)\n",
      "Requirement already satisfied: pillow>=8 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (10.2.0)\n",
      "Requirement already satisfied: pyparsing>=2.3.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from matplotlib) (3.1.1)\n",
      "Requirement already satisfied: colorcet>=2 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from hvplot) (3.0.1)\n",
      "Requirement already satisfied: holoviews>=1.11.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from hvplot) (1.18.1)\n",
      "Requirement already satisfied: ipywidgets==8.* in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from jupyter_bokeh) (8.0.4)\n",
      "Requirement already satisfied: Jinja2>=2.9 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from bokeh<3.4.0,>=3.2.0->panel) (3.1.3)\n",
      "Requirement already satisfied: PyYAML>=3.10 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from bokeh<3.4.0,>=3.2.0->panel) (6.0.1)\n",
      "Requirement already satisfied: tornado>=5.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from bokeh<3.4.0,>=3.2.0->panel) (6.3.3)\n",
      "Requirement already satisfied: ipykernel>=4.5.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipywidgets==8.*->jupyter_bokeh) (6.29.0)\n",
      "Requirement already satisfied: ipython>=6.1.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipywidgets==8.*->jupyter_bokeh) (8.21.0)\n",
      "Requirement already satisfied: traitlets>=4.3.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipywidgets==8.*->jupyter_bokeh) (5.14.1)\n",
      "Requirement already satisfied: widgetsnbextension~=4.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipywidgets==8.*->jupyter_bokeh) (4.0.9)\n",
      "Requirement already satisfied: jupyterlab-widgets~=3.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipywidgets==8.*->jupyter_bokeh) (3.0.9)\n",
      "Requirement already satisfied: fastcore>=1.5.27 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from nbdev) (1.5.29)\n",
      "Requirement already satisfied: execnb>=0.1.4 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from nbdev) (0.1.5)\n",
      "Requirement already satisfied: astunparse in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from nbdev) (1.6.3)\n",
      "Requirement already satisfied: ghapi>=1.0.3 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from nbdev) (1.0.4)\n",
      "Requirement already satisfied: watchdog in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from nbdev) (3.0.0)\n",
      "Requirement already satisfied: asttokens in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from nbdev) (2.4.1)\n",
      "Requirement already satisfied: pyct>=0.4.4 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from colorcet>=2->hvplot) (0.5.0)\n",
      "Requirement already satisfied: pip in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from fastcore>=1.5.27->nbdev) (23.3.1)\n",
      "Requirement already satisfied: six>=1.5 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n",
      "Requirement already satisfied: wheel<1.0,>=0.23.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from astunparse->nbdev) (0.41.2)\n",
      "Requirement already satisfied: webencodings in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from bleach->panel) (0.5.1)\n",
      "Requirement already satisfied: uc-micro-py in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from linkify-it-py->panel) (1.0.2)\n",
      "Requirement already satisfied: mdurl~=0.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from markdown-it-py->panel) (0.1.2)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from requests->panel) (3.3.2)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from requests->panel) (3.6)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from requests->panel) (2.2.0)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from requests->panel) (2024.2.2)\n",
      "Requirement already satisfied: appnope in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (0.1.3)\n",
      "Requirement already satisfied: comm>=0.1.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (0.2.1)\n",
      "Requirement already satisfied: debugpy>=1.6.5 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (1.6.7)\n",
      "Requirement already satisfied: jupyter-client>=6.1.12 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (8.6.0)\n",
      "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (5.5.0)\n",
      "Requirement already satisfied: matplotlib-inline>=0.1 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (0.1.6)\n",
      "Requirement already satisfied: nest-asyncio in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (1.6.0)\n",
      "Requirement already satisfied: psutil in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (5.9.0)\n",
      "Requirement already satisfied: pyzmq>=24 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (25.1.2)\n",
      "Requirement already satisfied: decorator in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (5.1.1)\n",
      "Requirement already satisfied: jedi>=0.16 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (0.19.1)\n",
      "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (3.0.42)\n",
      "Requirement already satisfied: pygments>=2.4.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (2.17.2)\n",
      "Requirement already satisfied: stack-data in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (0.6.2)\n",
      "Requirement already satisfied: pexpect>4.3 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (4.9.0)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from Jinja2>=2.9->bokeh<3.4.0,>=3.2.0->panel) (2.1.5)\n",
      "Requirement already satisfied: parso<0.9.0,>=0.8.3 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (0.8.3)\n",
      "Requirement already satisfied: platformdirs>=2.5 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel>=4.5.1->ipywidgets==8.*->jupyter_bokeh) (4.2.0)\n",
      "Requirement already satisfied: ptyprocess>=0.5 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from pexpect>4.3->ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (0.7.0)\n",
      "Requirement already satisfied: wcwidth in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (0.2.13)\n",
      "Requirement already satisfied: executing>=1.2.0 in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from stack-data->ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (2.0.1)\n",
      "Requirement already satisfied: pure-eval in /Users/jasonsuarez/miniconda3/envs/dataset/lib/python3.11/site-packages (from stack-data->ipython>=6.1.0->ipywidgets==8.*->jupyter_bokeh) (0.2.2)\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "%pip install panel pandas numpy matplotlib hvplot jupyter_bokeh nbdev"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "#|default_exp app\n",
    "# | export \n",
    "import panel as pn\n",
    "import hvplot.pandas\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import io\n",
    "import helpers.utils as utils\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n  var py_version = '3.3.4'.replace('rc', '-rc.').replace('.dev', '-dev.');\n  var reloading = true;\n  var Bokeh = root.Bokeh;\n\n  if (typeof (root._bokeh_timeout) === \"undefined\" || force) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks;\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, js_modules, js_exports, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n    if (js_modules == null) js_modules = [];\n    if (js_exports == null) js_exports = {};\n\n    root._bokeh_onload_callbacks.push(callback);\n\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n      run_callbacks();\n      return null;\n    }\n    if (!reloading) {\n      console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    }\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n    window._bokeh_on_load = on_load\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    var skip = [];\n    if (window.requirejs) {\n      window.requirejs.config({'packages': {}, 'paths': {'jspanel': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/jspanel', 'jspanel-modal': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/modal/jspanel.modal', 'jspanel-tooltip': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/tooltip/jspanel.tooltip', 'jspanel-hint': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/hint/jspanel.hint', 'jspanel-layout': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/layout/jspanel.layout', 'jspanel-contextmenu': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/contextmenu/jspanel.contextmenu', 'jspanel-dock': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/dock/jspanel.dock', 'gridstack': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack-all', 'notyf': 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min'}, 'shim': {'jspanel': {'exports': 'jsPanel'}, 'gridstack': {'exports': 'GridStack'}}});\n      require([\"jspanel\"], function(jsPanel) {\n\twindow.jsPanel = jsPanel\n\ton_load()\n      })\n      require([\"jspanel-modal\"], function() {\n\ton_load()\n      })\n      require([\"jspanel-tooltip\"], function() {\n\ton_load()\n      })\n      require([\"jspanel-hint\"], function() {\n\ton_load()\n      })\n      require([\"jspanel-layout\"], function() {\n\ton_load()\n      })\n      require([\"jspanel-contextmenu\"], function() {\n\ton_load()\n      })\n      require([\"jspanel-dock\"], function() {\n\ton_load()\n      })\n      require([\"gridstack\"], function(GridStack) {\n\twindow.GridStack = GridStack\n\ton_load()\n      })\n      require([\"notyf\"], function() {\n\ton_load()\n      })\n      root._bokeh_is_loading = css_urls.length + 9;\n    } else {\n      root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n    }\n\n    var existing_stylesheets = []\n    var links = document.getElementsByTagName('link')\n    for (var i = 0; i < links.length; i++) {\n      var link = links[i]\n      if (link.href != null) {\n\texisting_stylesheets.push(link.href)\n      }\n    }\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      if (existing_stylesheets.indexOf(url) !== -1) {\n\ton_load()\n\tcontinue;\n      }\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }    if (((window['jsPanel'] !== undefined) && (!(window['jsPanel'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/jspanel.js', 'https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/extensions/modal/jspanel.modal.js', 'https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/extensions/tooltip/jspanel.tooltip.js', 'https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/extensions/hint/jspanel.hint.js', 'https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/extensions/layout/jspanel.layout.js', 'https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/extensions/contextmenu/jspanel.contextmenu.js', 'https://cdn.holoviz.org/panel/1.3.8/dist/bundled/floatpanel/[email protected]/dist/extensions/dock/jspanel.dock.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    if (((window['GridStack'] !== undefined) && (!(window['GridStack'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/1.3.8/dist/bundled/gridstack/[email protected]/dist/gridstack-all.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    if (((window['Notyf'] !== undefined) && (!(window['Notyf'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/1.3.8/dist/bundled/notificationarea/notyf@3/notyf.min.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    var existing_scripts = []\n    var scripts = document.getElementsByTagName('script')\n    for (var i = 0; i < scripts.length; i++) {\n      var script = scripts[i]\n      if (script.src != null) {\n\texisting_scripts.push(script.src)\n      }\n    }\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      if (skip.indexOf(url) !== -1 || existing_scripts.indexOf(url) !== -1) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n    for (var i = 0; i < js_modules.length; i++) {\n      var url = js_modules[i];\n      if (skip.indexOf(url) !== -1 || existing_scripts.indexOf(url) !== -1) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      element.type = \"module\";\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n    for (const name in js_exports) {\n      var url = js_exports[name];\n      if (skip.indexOf(url) >= 0 || root[name] != null) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onerror = on_error;\n      element.async = false;\n      element.type = \"module\";\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      element.textContent = `\n      import ${name} from \"${url}\"\n      window.${name} = ${name}\n      window._bokeh_on_load()\n      `\n      document.head.appendChild(element);\n    }\n    if (!js_urls.length && !js_modules.length) {\n      on_load()\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  var js_urls = [];\n  var js_modules = [];\n  var js_exports = {};\n  var css_urls = [];\n  var inline_js = [    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n  ];\n\n  function run_inline_js() {\n    if ((root.Bokeh !== undefined) || (force === true)) {\n      for (var i = 0; i < inline_js.length; i++) {\n\ttry {\n          inline_js[i].call(root, root.Bokeh);\n\t} catch(e) {\n\t  if (!reloading) {\n\t    throw e;\n\t  }\n\t}\n      }\n      // Cache old bokeh versions\n      if (Bokeh != undefined && !reloading) {\n\tvar NewBokeh = root.Bokeh;\n\tif (Bokeh.versions === undefined) {\n\t  Bokeh.versions = new Map();\n\t}\n\tif (NewBokeh.version !== Bokeh.version) {\n\t  Bokeh.versions.set(NewBokeh.version, NewBokeh)\n\t}\n\troot.Bokeh = Bokeh;\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    }\n    root._bokeh_is_initializing = false\n  }\n\n  function load_or_wait() {\n    // Implement a backoff loop that tries to ensure we do not load multiple\n    // versions of Bokeh and its dependencies at the same time.\n    // In recent versions we use the root._bokeh_is_initializing flag\n    // to determine whether there is an ongoing attempt to initialize\n    // bokeh, however for backward compatibility we also try to ensure\n    // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n    // before older versions are fully initialized.\n    if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n      root._bokeh_is_initializing = false;\n      root._bokeh_onload_callbacks = undefined;\n      console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n      load_or_wait();\n    } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n      setTimeout(load_or_wait, 100);\n    } else {\n      root._bokeh_is_initializing = true\n      root._bokeh_onload_callbacks = []\n      var bokeh_loaded = Bokeh != null && (Bokeh.version === py_version || (Bokeh.versions !== undefined && Bokeh.versions.has(py_version)));\n      if (!reloading && !bokeh_loaded) {\n\troot.Bokeh = undefined;\n      }\n      load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n\tconsole.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n\trun_inline_js();\n      });\n    }\n  }\n  // Give older versions of the autoload script a head-start to ensure\n  // they initialize before we start loading newer version.\n  setTimeout(load_or_wait, 100)\n}(window));",
      "application/vnd.holoviews_load.v0+json": ""
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n  window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n    function JupyterCommManager() {\n    }\n\n    JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n      if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n        comm_manager.register_target(comm_id, function(comm) {\n          comm.on_msg(msg_handler);\n        });\n      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n        window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n          comm.onMsg = msg_handler;\n        });\n      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n        google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n          var messages = comm.messages[Symbol.asyncIterator]();\n          function processIteratorResult(result) {\n            var message = result.value;\n            console.log(message)\n            var content = {data: message.data, comm_id};\n            var buffers = []\n            for (var buffer of message.buffers || []) {\n              buffers.push(new DataView(buffer))\n            }\n            var metadata = message.metadata || {};\n            var msg = {content, buffers, metadata}\n            msg_handler(msg);\n            return messages.next().then(processIteratorResult);\n          }\n          return messages.next().then(processIteratorResult);\n        })\n      }\n    }\n\n    JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n      if (comm_id in window.PyViz.comms) {\n        return window.PyViz.comms[comm_id];\n      } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n        var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n        if (msg_handler) {\n          comm.on_msg(msg_handler);\n        }\n      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n        var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n        comm.open();\n        if (msg_handler) {\n          comm.onMsg = msg_handler;\n        }\n      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n        var comm_promise = google.colab.kernel.comms.open(comm_id)\n        comm_promise.then((comm) => {\n          window.PyViz.comms[comm_id] = comm;\n          if (msg_handler) {\n            var messages = comm.messages[Symbol.asyncIterator]();\n            function processIteratorResult(result) {\n              var message = result.value;\n              var content = {data: message.data};\n              var metadata = message.metadata || {comm_id};\n              var msg = {content, metadata}\n              msg_handler(msg);\n              return messages.next().then(processIteratorResult);\n            }\n            return messages.next().then(processIteratorResult);\n          }\n        }) \n        var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n          return comm_promise.then((comm) => {\n            comm.send(data, metadata, buffers, disposeOnDone);\n          });\n        };\n        var comm = {\n          send: sendClosure\n        };\n      }\n      window.PyViz.comms[comm_id] = comm;\n      return comm;\n    }\n    window.PyViz.comm_manager = new JupyterCommManager();\n    \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n  var div = document.createElement(\"div\");\n  var script = document.createElement(\"script\");\n  node.appendChild(div);\n  node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n  var output_area = handle.output_area;\n  var output = handle.output;\n  if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n    return\n  }\n  var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n  var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n  if (id !== undefined) {\n    var nchildren = toinsert.length;\n    var html_node = toinsert[nchildren-1].children[0];\n    html_node.innerHTML = output.data[HTML_MIME_TYPE];\n    var scripts = [];\n    var nodelist = html_node.querySelectorAll(\"script\");\n    for (var i in nodelist) {\n      if (nodelist.hasOwnProperty(i)) {\n        scripts.push(nodelist[i])\n      }\n    }\n\n    scripts.forEach( function (oldScript) {\n      var newScript = document.createElement(\"script\");\n      var attrs = [];\n      var nodemap = oldScript.attributes;\n      for (var j in nodemap) {\n        if (nodemap.hasOwnProperty(j)) {\n          attrs.push(nodemap[j])\n        }\n      }\n      attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n      newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n      oldScript.parentNode.replaceChild(newScript, oldScript);\n    });\n    if (JS_MIME_TYPE in output.data) {\n      toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n    }\n    output_area._hv_plot_id = id;\n    if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n      window.PyViz.plot_index[id] = Bokeh.index[id];\n    } else {\n      window.PyViz.plot_index[id] = null;\n    }\n  } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n    var bk_div = document.createElement(\"div\");\n    bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n    var script_attrs = bk_div.children[0].attributes;\n    for (var i = 0; i < script_attrs.length; i++) {\n      toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n    }\n    // store reference to server id on output_area\n    output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n  }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n  var id = handle.cell.output_area._hv_plot_id;\n  var server_id = handle.cell.output_area._bokeh_server_id;\n  if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n  var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n  if (server_id !== null) {\n    comm.send({event_type: 'server_delete', 'id': server_id});\n    return;\n  } else if (comm !== null) {\n    comm.send({event_type: 'delete', 'id': id});\n  }\n  delete PyViz.plot_index[id];\n  if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n    var doc = window.Bokeh.index[id].model.document\n    doc.clear();\n    const i = window.Bokeh.documents.indexOf(doc);\n    if (i > -1) {\n      window.Bokeh.documents.splice(i, 1);\n    }\n  }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n  delete PyViz.comms[\"hv-extension-comm\"];\n  window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n  handle_clear_output(event, {cell: {output_area: handle.output_area}})\n  handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n  function append_mime(data, metadata, element) {\n    // create a DOM node to render to\n    var toinsert = this.create_output_subarea(\n    metadata,\n    CLASS_NAME,\n    EXEC_MIME_TYPE\n    );\n    this.keyboard_manager.register_events(toinsert);\n    // Render to node\n    var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n    render(props, toinsert[0]);\n    element.append(toinsert);\n    return toinsert\n  }\n\n  events.on('output_added.OutputArea', handle_add_output);\n  events.on('output_updated.OutputArea', handle_update_output);\n  events.on('clear_output.CodeCell', handle_clear_output);\n  events.on('delete.Cell', handle_clear_output);\n  events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n  OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n    safe: true,\n    index: 0\n  });\n}\n\nif (window.Jupyter !== undefined) {\n  try {\n    var events = require('base/js/events');\n    var OutputArea = require('notebook/js/outputarea').OutputArea;\n    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n      register_renderer(events, OutputArea);\n    }\n  } catch(err) {\n  }\n}\n",
      "application/vnd.holoviews_load.v0+json": ""
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<style>*[data-root-id],\n",
       "*[data-root-id] > * {\n",
       "  box-sizing: border-box;\n",
       "  font-family: var(--jp-ui-font-family);\n",
       "  font-size: var(--jp-ui-font-size1);\n",
       "  color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
       "}\n",
       "\n",
       "/* Override VSCode background color */\n",
       ".cell-output-ipywidget-background:has(\n",
       "    > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
       "  ),\n",
       ".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
       "  background-color: transparent !important;\n",
       "}\n",
       "</style>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.holoviews_exec.v0+json": "",
      "text/html": [
       "<div id='47b7f385-2612-4021-ba32-2e0662cc69c2'>\n",
       "  <div id=\"dd1dba1a-24a3-44d0-a3fe-4c74c6918ce6\" data-root-id=\"47b7f385-2612-4021-ba32-2e0662cc69c2\" style=\"display: contents;\"></div>\n",
       "</div>\n",
       "<script type=\"application/javascript\">(function(root) {\n",
       "  var docs_json = {\"be89b814-37fc-44ff-8da4-cbe089391503\":{\"version\":\"3.3.4\",\"title\":\"Bokeh Application\",\"roots\":[{\"type\":\"object\",\"name\":\"panel.models.browser.BrowserInfo\",\"id\":\"47b7f385-2612-4021-ba32-2e0662cc69c2\"},{\"type\":\"object\",\"name\":\"panel.models.comm_manager.CommManager\",\"id\":\"946dcaa4-ac8d-4da3-bf76-bc66a00dbcd3\",\"attributes\":{\"plot_id\":\"47b7f385-2612-4021-ba32-2e0662cc69c2\",\"comm_id\":\"cefa7797254446b19ad6fac18db19a9d\",\"client_comm_id\":\"6ea4e02ae9074fc096f31fe1976a6cd5\"}}],\"defs\":[{\"type\":\"model\",\"name\":\"ReactiveHTML1\"},{\"type\":\"model\",\"name\":\"FlexBox1\",\"properties\":[{\"name\":\"align_content\",\"kind\":\"Any\",\"default\":\"flex-start\"},{\"name\":\"align_items\",\"kind\":\"Any\",\"default\":\"flex-start\"},{\"name\":\"flex_direction\",\"kind\":\"Any\",\"default\":\"row\"},{\"name\":\"flex_wrap\",\"kind\":\"Any\",\"default\":\"wrap\"},{\"name\":\"justify_content\",\"kind\":\"Any\",\"default\":\"flex-start\"}]},{\"type\":\"model\",\"name\":\"FloatPanel1\",\"properties\":[{\"name\":\"config\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"contained\",\"kind\":\"Any\",\"default\":true},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"right-top\"},{\"name\":\"offsetx\",\"kind\":\"Any\",\"default\":null},{\"name\":\"offsety\",\"kind\":\"Any\",\"default\":null},{\"name\":\"theme\",\"kind\":\"Any\",\"default\":\"primary\"},{\"name\":\"status\",\"kind\":\"Any\",\"default\":\"normalized\"}]},{\"type\":\"model\",\"name\":\"GridStack1\",\"properties\":[{\"name\":\"mode\",\"kind\":\"Any\",\"default\":\"warn\"},{\"name\":\"ncols\",\"kind\":\"Any\",\"default\":null},{\"name\":\"nrows\",\"kind\":\"Any\",\"default\":null},{\"name\":\"allow_resize\",\"kind\":\"Any\",\"default\":true},{\"name\":\"allow_drag\",\"kind\":\"Any\",\"default\":true},{\"name\":\"state\",\"kind\":\"Any\",\"default\":[]}]},{\"type\":\"model\",\"name\":\"drag1\",\"properties\":[{\"name\":\"slider_width\",\"kind\":\"Any\",\"default\":5},{\"name\":\"slider_color\",\"kind\":\"Any\",\"default\":\"black\"},{\"name\":\"value\",\"kind\":\"Any\",\"default\":50}]},{\"type\":\"model\",\"name\":\"click1\",\"properties\":[{\"name\":\"terminal_output\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"debug_name\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"clears\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"copy_to_clipboard1\",\"properties\":[{\"name\":\"fill\",\"kind\":\"Any\",\"default\":\"none\"},{\"name\":\"value\",\"kind\":\"Any\",\"default\":null}]},{\"type\":\"model\",\"name\":\"FastWrapper1\",\"properties\":[{\"name\":\"object\",\"kind\":\"Any\",\"default\":null},{\"name\":\"style\",\"kind\":\"Any\",\"default\":null}]},{\"type\":\"model\",\"name\":\"NotificationAreaBase1\",\"properties\":[{\"name\":\"js_events\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"bottom-right\"},{\"name\":\"_clear\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"NotificationArea1\",\"properties\":[{\"name\":\"js_events\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"notifications\",\"kind\":\"Any\",\"default\":[]},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"bottom-right\"},{\"name\":\"_clear\",\"kind\":\"Any\",\"default\":0},{\"name\":\"types\",\"kind\":\"Any\",\"default\":[{\"type\":\"map\",\"entries\":[[\"type\",\"warning\"],[\"background\",\"#ffc107\"],[\"icon\",{\"type\":\"map\",\"entries\":[[\"className\",\"fas fa-exclamation-triangle\"],[\"tagName\",\"i\"],[\"color\",\"white\"]]}]]},{\"type\":\"map\",\"entries\":[[\"type\",\"info\"],[\"background\",\"#007bff\"],[\"icon\",{\"type\":\"map\",\"entries\":[[\"className\",\"fas fa-info-circle\"],[\"tagName\",\"i\"],[\"color\",\"white\"]]}]]}]}]},{\"type\":\"model\",\"name\":\"Notification\",\"properties\":[{\"name\":\"background\",\"kind\":\"Any\",\"default\":null},{\"name\":\"duration\",\"kind\":\"Any\",\"default\":3000},{\"name\":\"icon\",\"kind\":\"Any\",\"default\":null},{\"name\":\"message\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"notification_type\",\"kind\":\"Any\",\"default\":null},{\"name\":\"_destroyed\",\"kind\":\"Any\",\"default\":false}]},{\"type\":\"model\",\"name\":\"TemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"BootstrapTemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"MaterialTemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]}]}};\n",
       "  var render_items = [{\"docid\":\"be89b814-37fc-44ff-8da4-cbe089391503\",\"roots\":{\"47b7f385-2612-4021-ba32-2e0662cc69c2\":\"dd1dba1a-24a3-44d0-a3fe-4c74c6918ce6\"},\"root_ids\":[\"47b7f385-2612-4021-ba32-2e0662cc69c2\"]}];\n",
       "  var docs = Object.values(docs_json)\n",
       "  if (!docs) {\n",
       "    return\n",
       "  }\n",
       "  const py_version = docs[0].version.replace('rc', '-rc.').replace('.dev', '-dev.')\n",
       "  function embed_document(root) {\n",
       "    var Bokeh = get_bokeh(root)\n",
       "    Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "    for (const render_item of render_items) {\n",
       "      for (const root_id of render_item.root_ids) {\n",
       "\tconst id_el = document.getElementById(root_id)\n",
       "\tif (id_el.children.length && (id_el.children[0].className === 'bk-root')) {\n",
       "\t  const root_el = id_el.children[0]\n",
       "\t  root_el.id = root_el.id + '-rendered'\n",
       "\t}\n",
       "      }\n",
       "    }\n",
       "  }\n",
       "  function get_bokeh(root) {\n",
       "    if (root.Bokeh === undefined) {\n",
       "      return null\n",
       "    } else if (root.Bokeh.version !== py_version) {\n",
       "      if (root.Bokeh.versions === undefined || !root.Bokeh.versions.has(py_version)) {\n",
       "\treturn null\n",
       "      }\n",
       "      return root.Bokeh.versions.get(py_version);\n",
       "    } else if (root.Bokeh.version === py_version) {\n",
       "      return root.Bokeh\n",
       "    }\n",
       "    return null\n",
       "  }\n",
       "  function is_loaded(root) {\n",
       "    var Bokeh = get_bokeh(root)\n",
       "    return (Bokeh != null && Bokeh.Panel !== undefined)\n",
       "  }\n",
       "  if (is_loaded(root)) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (is_loaded(root)) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else if (document.readyState == \"complete\") {\n",
       "        attempts++;\n",
       "        if (attempts > 200) {\n",
       "          clearInterval(timer);\n",
       "\t  var Bokeh = get_bokeh(root)\n",
       "\t  if (Bokeh == null || Bokeh.Panel == null) {\n",
       "            console.warn(\"Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing\");\n",
       "\t  } else {\n",
       "\t    console.warn(\"Panel: WARNING: Attempting to render but not all required libraries could be resolved.\")\n",
       "\t    embed_document(root)\n",
       "\t  }\n",
       "        }\n",
       "      }\n",
       "    }, 25, root)\n",
       "  }\n",
       "})(window);</script>"
      ]
     },
     "metadata": {
      "application/vnd.holoviews_exec.v0+json": {
       "id": "47b7f385-2612-4021-ba32-2e0662cc69c2"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# | export\n",
    "pn.extension(\n",
    "    \n",
    ")\n",
    "template = pn.template.FastListTemplate(title=\"Dataset Analyser\", site=\"Dashboard\", main=[],    \n",
    "   \n",
    "   \n",
    ")\n",
    "template.sidebar.append(pn.Column(\n",
    "    pn.pane.Markdown(\n",
    "        \"\"\"\n",
    "        # Welcome to the Interactive Data App\n",
    "\n",
    "        This app allows you to interact with the data in a number of ways.\n",
    "        \"\"\"\n",
    "    )\n",
    "));"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "# | export\n",
    "template.sidebar.append(pn.Column(\n",
    "    pn.pane.Markdown(\n",
    "        \"\"\"\n",
    "        ## Load Data\n",
    "\n",
    "        You can load the data from a URL or upload a file.\n",
    "        \"\"\"\n",
    "    )\n",
    "));\n",
    "\n",
    "switch = pn.widgets.Switch(name=\"URL - FILE\", value=False)\n",
    "url = pn.widgets.TextAreaInput(name=\"url\", placeholder=\"Enter the url of the dataset\", value=\"https://raw.githubusercontent.com/holoviz/panel/main/examples/assets/occupancy.csv\");\n",
    "file = pn.widgets.FileInput(\n",
    "    accept=\".csv\", name=\"Upload a CSV file\",\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [],
   "source": [
    "# | export\n",
    "def show_input_widget(switch: pn.widgets.Switch):\n",
    "    if not switch:\n",
    "       return pn.Row(url);\n",
    "    else:\n",
    "       return pn.Row(file);\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [],
   "source": [
    "# | export\n",
    "\n",
    "def get_data(switch: pn.widgets.Switch, url: pn.widgets.TextAreaInput, file: pn.widgets.FileInput):\n",
    "    df = None\n",
    "    if not switch:\n",
    "        df = pd.read_csv(url)\n",
    "    else:\n",
    "        if file is None:\n",
    "            return \"No file selected\"\n",
    "        df = pd.read_csv(io.BytesIO(file))\n",
    "    \n",
    "    visualizations = utils.Visualizations(df, pn)\n",
    "    high_level_widget = visualizations.high_level_visualization()\n",
    "    shape_widget = visualizations.data_shape_visualization()\n",
    "    nature_widget = visualizations.nature_visualization()\n",
    "    distribution_widget = visualizations.distribution_visualization()\n",
    "    \n",
    "    return pn.Column(\n",
    "        high_level_widget,\n",
    "        pn.Row(shape_widget,\n",
    "        nature_widget,\n",
    "        distribution_widget)\n",
    "    )\n",
    "    \n",
    "\n",
    "bound_data = pn.bind(get_data, switch=switch, url=url, file=file)\n",
    "template.sidebar.append(pn.Column(\n",
    "    pn.Row(switch),\n",
    "    pn.Row(pn.bind(show_input_widget, switch)),\n",
    "    ));\n",
    "\n",
    "template.main.append(bound_data)    \n",
    "template.servable();"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [],
   "source": [
    "# | export\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [],
   "source": [
    "# | export\n",
    "# dataset = None\n",
    "# if file:\n",
    "#     dataset = pd.read_csv(file)\n",
    "# else:\n",
    "#     dataset = pd.read_csv(url.value)\n",
    "# pn.Row(dataset.head().hvplot().opts(width=800, height=400)).servable(target=\"main\");"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [],
   "source": [
    "from nbdev.export import nb_export\n",
    "# Check if there is an app.py file in the current directory, if so remove it\n",
    "import os\n",
    "if os.path.exists('app.py'):\n",
    "    os.remove('app.py')\n",
    "\n",
    "\n",
    "nb_export('app.ipynb', '.')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}