-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1813 lines (1695 loc) · 118 KB
/
index.html
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en"><head>
<script src="index_files/libs/clipboard/clipboard.min.js"></script>
<script src="index_files/libs/quarto-html/tabby.min.js"></script>
<script src="index_files/libs/quarto-html/popper.min.js"></script>
<script src="index_files/libs/quarto-html/tippy.umd.min.js"></script>
<link href="index_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="index_files/libs/quarto-html/quarto-html.min.css" rel="stylesheet" data-mode="light">
<link href="index_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="generator" content="quarto-1.2.231">
<title>index</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="index_files/libs/revealjs/dist/reset.css">
<link rel="stylesheet" href="index_files/libs/revealjs/dist/reveal.css">
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #767676;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #767676; padding-left: 4px; }
div.sourceCode
{ color: #545454; background-color: #fefefe; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span { color: #545454; } /* Normal */
code span.al { color: #7928a1; } /* Alert */
code span.an { color: #696969; } /* Annotation */
code span.at { color: #a55a00; } /* Attribute */
code span.bn { color: #7928a1; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #d91e18; } /* ControlFlow */
code span.ch { color: #008000; } /* Char */
code span.cn { color: #d91e18; } /* Constant */
code span.co { color: #696969; } /* Comment */
code span.cv { color: #696969; font-style: italic; } /* CommentVar */
code span.do { color: #696969; font-style: italic; } /* Documentation */
code span.dt { color: #7928a1; } /* DataType */
code span.dv { color: #7928a1; } /* DecVal */
code span.er { color: #7928a1; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #a55a00; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #696969; } /* Information */
code span.kw { color: #d91e18; } /* Keyword */
code span.op { color: #00769e; } /* Operator */
code span.ot { color: #d91e18; } /* Other */
code span.pp { color: #7928a1; } /* Preprocessor */
code span.sc { color: #00769e; } /* SpecialChar */
code span.ss { color: #008000; } /* SpecialString */
code span.st { color: #008000; } /* String */
code span.va { color: #a55a00; } /* Variable */
code span.vs { color: #008000; } /* VerbatimString */
code span.wa { color: #696969; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="index_files/libs/revealjs/dist/theme/quarto.css" id="theme">
<link href="index_files/libs/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/all.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-chalkboard/style.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
<style type="text/css">
.callout {
margin-top: 1em;
margin-bottom: 1em;
border-radius: .25rem;
}
.callout.callout-style-simple {
padding: 0em 0.5em;
border-left: solid #acacac .3rem;
border-right: solid 1px silver;
border-top: solid 1px silver;
border-bottom: solid 1px silver;
display: flex;
}
.callout.callout-style-default {
border-left: solid #acacac .3rem;
border-right: solid 1px silver;
border-top: solid 1px silver;
border-bottom: solid 1px silver;
}
.callout .callout-body-container {
flex-grow: 1;
}
.callout.callout-style-simple .callout-body {
font-size: 1rem;
font-weight: 400;
}
.callout.callout-style-default .callout-body {
font-size: 0.9rem;
font-weight: 400;
}
.callout.callout-captioned.callout-style-simple .callout-body {
margin-top: 0.2em;
}
.callout:not(.callout-captioned) .callout-body {
display: flex;
}
.callout:not(.no-icon).callout-captioned.callout-style-simple .callout-content {
padding-left: 1.6em;
}
.callout.callout-captioned .callout-header {
padding-top: 0.2em;
margin-bottom: -0.2em;
}
.callout.callout-captioned .callout-caption p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.callout.callout-captioned.callout-style-simple .callout-content p {
margin-top: 0;
}
.callout.callout-captioned.callout-style-default .callout-content p {
margin-top: 0.7em;
}
.callout.callout-style-simple div.callout-caption {
border-bottom: none;
font-size: .9rem;
font-weight: 600;
opacity: 75%;
}
.callout.callout-style-default div.callout-caption {
border-bottom: none;
font-weight: 600;
opacity: 85%;
font-size: 0.9rem;
padding-left: 0.5em;
padding-right: 0.5em;
}
.callout.callout-style-default div.callout-content {
padding-left: 0.5em;
padding-right: 0.5em;
}
.callout.callout-style-simple .callout-icon::before {
height: 1rem;
width: 1rem;
display: inline-block;
content: "";
background-repeat: no-repeat;
background-size: 1rem 1rem;
}
.callout.callout-style-default .callout-icon::before {
height: 0.9rem;
width: 0.9rem;
display: inline-block;
content: "";
background-repeat: no-repeat;
background-size: 0.9rem 0.9rem;
}
.callout-caption {
display: flex
}
.callout-icon::before {
margin-top: 1rem;
padding-right: .5rem;
}
.callout.no-icon::before {
display: none !important;
}
.callout.callout-captioned .callout-body > .callout-content > :last-child {
margin-bottom: 0.5rem;
}
.callout.callout-captioned .callout-icon::before {
margin-top: .5rem;
padding-right: .5rem;
}
.callout:not(.callout-captioned) .callout-icon::before {
margin-top: 1rem;
padding-right: .5rem;
}
/* Callout Types */
div.callout-note {
border-left-color: #4582ec !important;
}
div.callout-note .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEU0lEQVRYCcVXTWhcVRQ+586kSUMMxkyaElstCto2SIhitS5Ek8xUKV2poatCcVHtUlFQk8mbaaziwpWgglJwVaquitBOfhQXFlqlzSJpFSpIYyXNjBNiTCck7x2/8/LeNDOZxDuEkgOXe++553zfefee+/OYLOXFk3+1LLrRdiO81yNqZ6K9cG0P3MeFaMIQjXssE8Z1JzLO9ls20MBZX7oG8w9GxB0goaPrW5aNMp1yOZIa7Wv6o2ykpLtmAPs/vrG14Z+6d4jpbSKuhdcSyq9wGMPXjonwmESXrriLzFGOdDBLB8Y6MNYBu0dRokSygMA/mrun8MGFN3behm6VVAwg4WR3i6FvYK1T7MHo9BK7ydH+1uurECoouk5MPRyVSBrBHMYwVobG2aOXM07sWrn5qgB60rc6mcwIDJtQrnrEr44kmy+UO9r0u9O5/YbkS9juQckLed3DyW2XV/qWBBB3ptvI8EUY3I9p/67OW+g967TNr3Sotn3IuVlfMLVnsBwH4fsnebJvyGm5GeIUA3jljERmrv49SizPYuq+z7c2H/jlGC+Ghhupn/hcapqmcudB9jwJ/3jvnvu6vu5lVzF1fXyZuZZ7U8nRmVzytvT+H3kilYvH09mLWrQdwFSsFEsxFVs5fK7A0g8gMZjbif4ACpKbjv7gNGaD8bUrlk8x+KRflttr22JEMRUbTUwwDQScyzPgedQHZT0xnx7ujw2jfVfExwYHwOsDTjLdJ2ebmeQIlJ7neo41s/DrsL3kl+W2lWvAga0tR3zueGr6GL78M3ifH0rGXrBC2aAR8uYcIA5gwV8zIE8onoh8u0Fca/ciF7j1uOzEnqcIm59sEXoGc0+z6+H45V1CvAvHcD7THztu669cnp+L0okAeIc6zjbM/24LgGM1gZk7jnRu1aQWoU9sfUOuhrmtaPIO3YY1KLLWZaEO5TKUbMY5zx8W9UJ6elpLwKXbsaZ4EFl7B4bMtDv0iRipKoDQT2sNQI9b1utXFdYisi+wzZ/ri/1m7QfDgEuvgUUEIJPq3DhX/5DWNqIXDOweC2wvIR90Oq3lDpdMIgD2r0dXvGdsEW5H6x6HLRJYU7C69VefO1x8Gde1ZFSJLfWS1jbCnhtOPxmpfv2LXOA2Xk2tvnwKKPFuZ/oRmwBwqRQDcKNeVQkYcOjtWVBuM/JuYw5b6isojIkYxyYAFn5K7ZBF10fea52y8QltAg6jnMqNHFBmGkQ1j+U43HMi2xMar1Nv0zGsf1s8nUsmUtPOOrbFIR8bHFDMB5zL13Gmr/kGlCkUzedTzzmzsaJXhYawnA3UmARpiYj5ooJZiUoxFRtK3X6pgNPv+IZVPcnwbOl6f+aBaO1CNvPW9n9LmCp01nuSaTRF2YxHqZ8DYQT6WsXT+RD6eUztwYLZ8rM+rcPxamv1VQzFUkzFXvkiVrySGQgJNvXHJAxiU3/NwiC03rSf05VBaPtu/Z7/B8Yn/w7eguloAAAAAElFTkSuQmCC');
}
div.callout-note.callout-style-default .callout-caption {
background-color: #dae6fb
}
div.callout-important {
border-left-color: #d9534f !important;
}
div.callout-important .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEKklEQVRYCcVXTWhcVRS+575MJym48A+hSRFr00ySRQhURRfd2HYjk2SSTokuBCkU2o0LoSKKraKIBTcuFCoidGFD08nkBzdREbpQ1EDNIv8qSGMFUboImMSZd4/f9zJv8ibJMC8xJQfO3HPPPef7zrvvvnvviIkpC9nsw0UttFunbUhpFzFtarSd6WJkStVMw5xyVqYTvkwfzuf/5FgtkVoB0729j1rjXwThS7Vio+Mo6DNnvLfahoZ+i/o32lULuJ3NNiz7q6+pyAUkJaFF6JwaM2lUJlV0MlnQn5aTRbEu0SEqHUa0A4AdiGuB1kFXRfVyg5d87+Dg4DL6m2TLAub60ilj7A1Ec4odSAc8X95sHh7+ZRPCFo6Fnp7HfU/fBng/hi10CjCnWnJjsxvDNxWw0NfV6Rv5GgP3I3jGWXumdTD/3cbEOP2ZbOZp69yniG3FQ9z1jD7bnBu9Fc2tKGC2q+uAJOQHBDRiZX1x36o7fWBs7J9ownbtO+n0/qWkvW7UPIfc37WgT6ZGR++EOJyeQDSb9UB+DZ1G6DdLDzyS+b/kBCYGsYgJbSQHuThGKRcw5xdeQf8YdNHsc6ePXrlSYMBuSIAFTGAtQo+VuALo4BX83N190NWZWbynBjhOHsmNfFWLeL6v+ynsA58zDvvAC8j5PkbOcXCMg2PZFk3q8MjI7WAG/Dp9AwP7jdGBOOQkAvlFUB+irtm16I1Zw9YBcpGTGXYmk3kQIC/Cds55l+iMI3jqhjAuaoe+am2Jw5GT3Nbz3CkE12NavmzN5+erJW7046n/CH1RO/RVa8lBLozXk9uqykkGAyRXLWlLv5jyp4RFsG5vGVzpDLnIjTWgnRy2Rr+tDKvRc7Y8AyZq10jj8DqXdnIRNtFZb+t/ZRtXcDiVnzpqx8mPcDWxgARUqx0W1QB9MeUZiNrV4qP+Ehc+BpNgATsTX8ozYKL2NtFYAHc84fG7ndxUPr+AR/iQSns7uSUufAymwDOb2+NjK27lEFocm/EE2WpyIy/Hi66MWuMKJn8RvxIcj87IM5Vh9663ziW36kR0HNenXuxmfaD8JC7tfKbrhFr7LiZCrMjrzTeGx+PmkosrkNzW94ObzwocJ7A1HokLolY+AvkTiD/q1H0cN48c5EL8Crkttsa/AXQVDmutfyku0E7jShx49XqV3MFK8IryDhYVbj7Sj2P2eBxwcXoe8T8idsKKPRcnZw1b+slFTubwUwhktrfnAt7J++jwQtLZcm3sr9LQrjRzz6cfMv9aLvgmnAGvpoaGLxM4mAEaLV7iAzQ3oU0IvD5x9ix3yF2RAAuYAOO2f7PEFWCXZ4C9Pb2UsgDeVnFSpbFK7/IWu7TPTvBqzbGdCHOJQSxiEjt6IyZmxQyEJHv6xyQsYk//moVFsN2zP6fRImjfq7/n/wFDguUQFNEwugAAAABJRU5ErkJggg==');
}
div.callout-important.callout-style-default .callout-caption {
background-color: #f7dddc
}
div.callout-warning {
border-left-color: #f0ad4e !important;
}
div.callout-warning .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAETklEQVRYCeVWW2gcVRg+58yaTUnizqbipZeX4uWhBEniBaoUX1Ioze52t7sRq6APio9V9MEaoWlVsFasRq0gltaAPuxms8lu0gcviE/FFOstVbSIxgcv6SU7EZqmdc7v9+9mJtNks51NTUH84ed889/PP+cmxP+d5FIbMJmNbpREu4WUkiTtCicKny0l1pIKmBzovF2S+hIJHX8iEu3hZJ5lNZGqyRrGSIQpq15AzF28jgpeY6yk6GVdrfFqdrD6Iw+QlB8g0YS2g7dyQmXM/IDhBhT0UCiRf59lfqmmDvzRt6kByV/m4JjtzuaujMUM2c5Z2d6JdKrRb3K2q6mA+oYVz8JnDdKPmmNthzkAk/lN63sYPgevrguc72aZX/L9C6x09GYyxBgCX4NlvyGUHOKELlm5rXeR1kchuChJt4SSwyddZRXgvwMGvYo4QSlk3/zkHD8UHxwVJA6zjZZqP8v8kK8OWLnIZtLyCAJagYC4rTGW/9Pqj92N/c+LUaAj27movwbi19tk/whRCIE7Q9vyI6yvRpftAKVTdUjOW40X3h5OXsKCdmFcx0xlLJoSuQngnrJe7Kcjm4OMq9FlC7CMmScQANuNvjfP3PjGXDBaUQmbp296S5L4DrpbrHN1T87ZVEZVCzg1FF0Ft+dKrlLukI+/c9ENo+TvlTDbYFvuKPtQ9+l052rXrgKoWkDAFnvh0wTOmYn8R5f4k/jN/fZiCM1tQx9jQQ4ANhqG4hiL0qIFTGViG9DKB7GYzgubnpofgYRwO+DFjh0Zin2m4b/97EDkXkc+f6xYAPX0KK2I/7fUQuwzuwo/L3AkcjugPNixC8cHf0FyPjWlItmLxWw4Ou9YsQCr5fijMGoD/zpdRy95HRysyXA74MWOnscpO4j2y3HAVisw85hX5+AFBRSHt4ShfLFkIMXTqyKFc46xdzQM6XbAi702a7sy04J0+feReMFKp5q9esYLCqAZYw/k14E/xcLLsFElaornTuJB0svMuJINy8xkIYuL+xPAlWRceH6+HX7THJ0djLUom46zREu7tTkxwmf/FdOZ/sh6Q8qvEAiHpm4PJ4a/doJe0gH1t+aHRgCzOvBvJedEK5OFE5jpm4AGP2a8Dxe3gGJ/pAutug9Gp6he92CsSsWBaEcxGx0FHytmIpuqGkOpldqNYQK8cSoXvd+xLxXADw0kf6UkJNFtdo5MOgaLjiQOQHcn+A6h5NuL2s0qsC2LOM75PcF3yr5STuBSAcGG+meA14K/CI21HcS4LBT6tv0QAh8Dr5l93AhZzG5ZJ4VxAqdZUEl9z7WJ4aN+svMvwHHL21UKTd1mqvChH7/Za5xzXBBKrUcB0TQ+Ulgkfbi/H/YT5EptrGzsEK7tR1B7ln9BBwckYfMiuSqklSznIuoIIOM42MQO+QnduCoFCI0bpkzjCjddHPN/F+2Yu+sd9bKNpVwHhbS3LluK/0zgfwD0xYI5dXuzlQAAAABJRU5ErkJggg==');
}
div.callout-warning.callout-style-default .callout-caption {
background-color: #fcefdc
}
div.callout-tip {
border-left-color: #02b875 !important;
}
div.callout-tip .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAADr0lEQVRYCe1XTWgTQRj9ZjZV8a9SPIkKgj8I1bMHsUWrqYLVg4Ue6v9BwZOxSYsIerFao7UiUryIqJcqgtpimhbBXoSCVxUFe9CTiogUrUp2Pt+3aUI2u5vdNh4dmMzOzHvvezuz8xNFM0mjnbXaNu1MvFWRXkXEyE6aYOYJpdW4IXuA4r0fo8qqSMDBU0v1HJUgVieAXxzCsdE/YJTdFcVIZQNMyhruOMJKXYFoLfIfIvVIMWdsrd+Rpd86ZmyzzjJmLStqRn0v8lzkb4rVIXvnpScOJuAn2ACC65FkPzEdEy4TPWRLJ2h7z4cArXzzaOdKlbOvKKX25Wl00jSnrwVxAg3o4dRxhO13RBSdNvH0xSARv3adTXbBdTf64IWO2vH0LT+cv4GR1DJt+DUItaQogeBX/chhbTBxEiZ6gftlDNXTrvT7co4ub5A6gp9HIcHvzTa46OS5fBeP87Qm0fQkr4FsYgVQ7Qg+ZayaDg9jhg1GkWj8RG6lkeSacrrHgDaxdoBiZPg+NXV/KifMuB6//JmYH4CntVEHy/keA6x4h4CU5oFy8GzrBS18cLJMXcljAKB6INjWsRcuZBWVaS3GDrqB7rdapVIeA+isQ57Eev9eCqzqOa81CY05VLd6SamW2wA2H3SiTbnbSxmzfp7WtKZkqy4mdyAlGx7ennghYf8voqp9cLSgKdqNfa6RdRsAAkPwRuJZNbpByn+RrJi1RXTwdi8RQF6ymDwGMAtZ6TVE+4uoKh+MYkcLsT0Hk8eAienbiGdjJHZTpmNjlbFJNKDVAp2fJlYju6IreQxQ08UJDNYdoLSl6AadO+fFuCQqVMB1NJwPm69T04Wv5WhfcWyfXQB+wXRs1pt+nCknRa0LVzSA/2B+a9+zQJadb7IyyV24YAxKp2Jqs3emZTuNnKxsah+uabKbMk7CbTgJx/zIgQYErIeTKRQ9yD9wxVof5YolPHqaWo7TD6tJlh7jQnK5z2n3+fGdggIOx2kaa2YI9QWarc5Ce1ipNWMKeSG4DysFF52KBmTNMmn5HqCFkwy34rDg05gDwgH3bBi+sgFhN/e8QvRn8kbamCOhgrZ9GJhFDgfcMHzFb6BAtjKpFhzTjwv1KCVuxHvCbsSiEz4CANnj84cwHdFXAbAOJ4LTSAawGWFn5tDhLMYz6nWeU2wJfIhmIJBefcd/A5FWQWGgrWzyORZ3Q6HuV+Jf0Bj+BTX69fm1zWgK7By1YTXchFDORywnfQ7GpzOo6S+qECrsx2ifVQAAAABJRU5ErkJggg==');
}
div.callout-tip.callout-style-default .callout-caption {
background-color: #ccf1e3
}
div.callout-caution {
border-left-color: #fd7e14 !important;
}
div.callout-caution .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAACV0lEQVRYCdVWzWoUQRCuqp2ICBLJXgITZL1EfQDBW/bkzUMUD7klD+ATSHBEfAIfQO+iXsWDxJsHL96EHAwhgzlkg8nBg25XWb0zIb0zs9muYYWkoKeru+vn664fBqElyZNuyh167NXJ8Ut8McjbmEraKHkd7uAnAFku+VWdb3reSmRV8PKSLfZ0Gjn3a6Xlcq9YGb6tADjn+lUfTXtVmaZ1KwBIvFI11rRXlWlatwIAAv2asaa9mlB9wwygiDX26qaw1yYPzFXg2N1GgG0FMF8Oj+VIx7E/03lHx8UhvYyNZLN7BwSPgekXXLribw7w5/c8EF+DBK5idvDVYtEEwMeYefjjLAdEyQ3M9nfOkgnPTEkYU+sxMq0BxNR6jExrAI31H1rzvLEfRIdgcv1XEdj6QTQAS2wtstEALLG1yEZ3QhH6oDX7ExBSFEkFINXH98NTrme5IOaaA7kIfiu2L8A3qhH9zRbukdCqdsA98TdElyeMe5BI8Rs2xHRIsoTSSVFfCFCWGPn9XHb4cdobRIWABNf0add9jakDjQJpJ1bTXOJXnnRXHRf+dNL1ZV1MBRCXhMbaHqGI1JkKIL7+i8uffuP6wVQAzO7+qVEbF6NbS0LJureYcWXUUhH66nLR5rYmva+2tjRFtojkM2aD76HEGAD3tPtKM309FJg5j/K682ywcWJ3PASCcycH/22u+Bh7Aa0ehM2Fu4z0SAE81HF9RkB21c5bEn4Dzw+/qNOyXr3DCTQDMBOdhi4nAgiFDGCinIa2owCEChUwD8qzd03PG+qdW/4fDzjUMcE1ZpIAAAAASUVORK5CYII=');
}
div.callout-caution.callout-style-default .callout-caption {
background-color: #ffe5d0
}
</style>
<style type="text/css">
.reveal div.sourceCode {
margin: 0;
overflow: auto;
}
.reveal div.hanging-indent {
margin-left: 1em;
text-indent: -1em;
}
.reveal .slide:not(.center) {
height: 100%;
}
.reveal .slide.scrollable {
overflow-y: auto;
}
.reveal .footnotes {
height: 100%;
overflow-y: auto;
}
.reveal .slide .absolute {
position: absolute;
display: block;
}
.reveal .footnotes ol {
counter-reset: ol;
list-style-type: none;
margin-left: 0;
}
.reveal .footnotes ol li:before {
counter-increment: ol;
content: counter(ol) ". ";
}
.reveal .footnotes ol li > p:first-child {
display: inline-block;
}
.reveal .slide ul,
.reveal .slide ol {
margin-bottom: 0.5em;
}
.reveal .slide ul li,
.reveal .slide ol li {
margin-top: 0.4em;
margin-bottom: 0.2em;
}
.reveal .slide ul[role="tablist"] li {
margin-bottom: 0;
}
.reveal .slide ul li > *:first-child,
.reveal .slide ol li > *:first-child {
margin-block-start: 0;
}
.reveal .slide ul li > *:last-child,
.reveal .slide ol li > *:last-child {
margin-block-end: 0;
}
.reveal .slide .columns:nth-child(3) {
margin-block-start: 0.8em;
}
.reveal blockquote {
box-shadow: none;
}
.reveal .tippy-content>* {
margin-top: 0.2em;
margin-bottom: 0.7em;
}
.reveal .tippy-content>*:last-child {
margin-bottom: 0.2em;
}
.reveal .slide > img.stretch.quarto-figure-center,
.reveal .slide > img.r-stretch.quarto-figure-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-left,
.reveal .slide > img.r-stretch.quarto-figure-left {
display: block;
margin-left: 0;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-right,
.reveal .slide > img.r-stretch.quarto-figure-right {
display: block;
margin-left: auto;
margin-right: 0;
}
</style>
<script src="index_files/libs/htmlwidgets-1.5.4/htmlwidgets.js"></script><script src="index_files/libs/d3-bundle-5.16.0/d3-bundle.min.js"></script><script src="index_files/libs/d3-lasso-0.0.5/d3-lasso.min.js"></script><script src="index_files/libs/save-svg-as-png-1.4.17/save-svg-as-png.min.js"></script><link href="index_files/libs/ggiraphjs-0.4.2/ggiraphjs.min.css" rel="stylesheet">
<script src="index_files/libs/ggiraphjs-0.4.2/ggiraphjs.min.js"></script><script src="index_files/libs/girafe-binding-0.8.3/girafe.js"></script>
</head>
<body class="quarto-light">
<div class="reveal">
<div class="slides">
<section class="slide level2"><h1>
Getting Started With APIs
</h1>
<h2>
<span class="altred"><em>the ELI5 edition, featuring</em> <code>plumber</code></span>
</h2>
<hr>
<h4>
2022-10-21
</h4>
<p><br></p>
<h3>
Katie Masiello, Solutions Engineer at
</h3>
<p><img data-src="https://www.rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png" class="absolute" style="top: 425px; left: 1072px; height: 95px; "></p>
<p><br></p>
<h3>
<svg aria-hidden="true" role="img" viewbox="0 0 496 512" style="height:1em;width:0.97em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:black;overflow:visible;position:relative;"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg><a href="https://github.com/kmasiello/getting-started-apis">github.com/kmasiello/getting-started-apis</a>
</h3>
<p><img data-src="images/plumber.png" class="absolute" style="top: 525px; left: 1400px; width: 500px; "></p>
<aside class="notes"><p>This talk is personal, it’s for me 4 years ago.</p>
<ul>
<li>working in propulsion safety and risk analysis group</li>
<li>download CSV data from ACTS database - fleet info, line number, delivery date, engine type</li>
<li>grated on me to manually download and read in data. I wanted it all to be programmatic and streamlined, like those commercials</li>
<li>read about APIs but couldn’t figure it out. Google didn’t help.</li>
<li>ran into plumber and got even more confused. I didn’t know if I was supposed to use plumber to call the database or which end was up.</li>
<li>Now it’s 4 years later, I’m in a different place in my career working as a solutions engineer at RStudio</li>
<li>I hope today I can untangle and clarify APIs for anyone who is in this same place that I was</li>
</ul><style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="what-is-an-api" class="slide level2"><h2>What is an API?</h2>
<p>Wikipedia says:</p>
<blockquote>
<p>An application programming interface (API) is a way for two or more computer programs to communicate with each other.</p>
</blockquote>
<div class="fragment">
<p><br> 🤔 <em>I’m not a computer… so what’s that got to do with me?</em></p>
</div>
<div class="fragment">
<p>Katie says:</p>
</div>
<div class="fragment">
<blockquote>
<p>An API is just a fancy way of accessing a function, from any system, and you don’t have to access that function using the same language it was written in.</p>
</blockquote>
</div>
<div class="fragment">
<p>Katie’s corollary:</p>
<blockquote>
<p>If you can write a function, you can write an API.</p>
</blockquote>
<aside class="notes"><p>What you may have heard before, right? It’s how machines talk to one another. You’re using an API just to call up a website like cnn. 🔽</p>
<p>in my mind you write a function to do something.<br>
an API becomes a way to access that. 🔽</p>
<p>and if you can write a function, you can create an api.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</div>
</section><section id="systems-as-black-boxes" class="slide level2"><h2>Systems as Black Boxes</h2>
<img data-src="images/black_boxes.png" alt="Two black box systems. The left system asks for fleet data, the right system responds with data." class="r-stretch quarto-figure-center"><div class="fragment">
<div class="columns">
<div class="column" style="width:50%;">
<h3 id="whats-inside-my-system">What’s inside my system?</h3>
<div class="fragment">
<ul>
<li>R?</li>
<li>Python?</li>
<li>Excel?</li>
<li>Tableau?</li>
</ul>
</div>
</div><div class="column" style="width:50%;">
<h3 id="whats-inside-the-other-system">What’s inside the other system?</h3>
<div class="fragment">
<ul>
<li>JavaScript?</li>
<li>Python?</li>
<li>R?</li>
<li>Scratch? ;)</li>
</ul>
</div>
</div>
</div>
<aside class="notes"><p>Let’s talk systems analysis.<br>
We’ve got two black boxes here, each representing some kind of system. and we need to communicate between them. In the example I mentioned earlier, I was working in R and i wanted data from another system. What I wanted was to request this data programmatically and have it sent to me.</p>
<p>Let’s think about what’s inside. What do we have here? 🔽</p>
<p>In this illustration, I might be working in Python or R. Maybe it’s an excel workbook or tableau dashboard for example.</p>
<p>What do I need to connect with? It could be anything. 🔽</p>
<p>Javascript? R, python? I joek around but it could be something written in BASIC or Scratch. We likely don’t even KNOW what the other system is. But does it matter? 🔽</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</div>
</section><section id="systems-as-black-boxes-1" class="slide level2"><h2>Systems as Black Boxes</h2>
<img data-src="images/black_boxes.png" alt="Two black box systems. The left system asks for data, the right system responds with data." class="r-stretch quarto-figure-center"><div class="columns">
<div class="column" style="width:50%;">
<h3 id="whats-inside-my-system-1">What’s inside my system?</h3>
</div><div class="column" style="width:50%;">
<h3 id="whats-inside-the-other-system-1">What’s inside the other system?</h3>
</div>
</div>
<p><br></p>
<div class="fragment fade-up">
<div style="text-align: center;">
<h2>
🎉 <br>It doesn’t matter as long as we agree on a standard way to communicate between systems!
</h2>
</div>
</div>
<aside class="notes"><p>No. 🔽 Here’s the important thing. It does not matter what’s INSIDE the boxes as long as we can standardize on a means to communicate between the boxes.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="systems-as-black-boxes-2" class="slide level2"><h2>Systems as Black Boxes</h2>
<img data-src="images/restful.png" alt="Two black box systems. The left system asks for data, the right system responds with data." class="r-stretch quarto-figure-center"><p>If the other system’s external interfaces are exposed as “API endpoints,” and if my system can formulate a REST-based API call, we can communicate.</p>
<aside class="notes"><p>This is the beauty of APIs. Formally we call these REST-based APIs because they follow a defined standard called REST. The way these RESTful APIs communicate is via HTTP which is why people talk about using API calls when you browse the web.</p>
<p>In essence, as long as the system you are using can formulate a REST-based API call, and the receiving end is exposing its interfaces as what are called API endpoints, we can communicate.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="lets-see-it-in-action" class="slide level2"><h2>Let’s See it in Action 🌧️</h2>
<p>How’s the weather at Paine Field?</p>
<p><a href="https://api.open-meteo.com/v1/forecast?latitude=47.9&longitude=-122.3&hourly=temperature_2m,rain,windspeed_10m&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch&timezone=America%2FLos_Angeles">https://api.open-meteo.com/v1/forecast?latitude=47.9&longitude=-122.3&hourly=temperature_2m, rain,windspeed_10m&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch& timezone=America%2FLos_Angeles</a></p>
<div class="cell" data-hash="index_cache/revealjs/unnamed-chunk-1_dce2863955527a001e7423562bee386c">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="fu">library</span>(httr)</span>
<span id="cb1-2"><a href="#cb1-2"></a>httr<span class="sc">::</span><span class="fu">GET</span>(<span class="st">"https://api.open-meteo.com/v1/forecast?latitude=47.9&longitude=-122.3&hourly=temperature_2m,rain,windspeed_10m&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch&timezone=America%2FLos_Angeles"</span>) <span class="sc">|></span> </span>
<span id="cb1-3"><a href="#cb1-3"></a> <span class="fu">content</span>(<span class="at">as =</span> <span class="st">"text"</span>) <span class="sc">|></span> </span>
<span id="cb1-4"><a href="#cb1-4"></a> jsonlite<span class="sc">::</span><span class="fu">fromJSON</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>$latitude
[1] 47.875
$longitude
[1] -122.25
$generationtime_ms
[1] 0.6719828
$utc_offset_seconds
[1] -25200
$timezone
[1] "America/Los_Angeles"
$timezone_abbreviation
[1] "PDT"
$elevation
[1] 156
$hourly_units
$hourly_units$time
[1] "iso8601"
$hourly_units$temperature_2m
[1] "°F"
$hourly_units$rain
[1] "inch"
$hourly_units$windspeed_10m
[1] "mp/h"
$hourly
$hourly$time
[1] "2022-10-17T00:00" "2022-10-17T01:00" "2022-10-17T02:00"
[4] "2022-10-17T03:00" "2022-10-17T04:00" "2022-10-17T05:00"
[7] "2022-10-17T06:00" "2022-10-17T07:00" "2022-10-17T08:00"
[10] "2022-10-17T09:00" "2022-10-17T10:00" "2022-10-17T11:00"
[13] "2022-10-17T12:00" "2022-10-17T13:00" "2022-10-17T14:00"
[16] "2022-10-17T15:00" "2022-10-17T16:00" "2022-10-17T17:00"
[19] "2022-10-17T18:00" "2022-10-17T19:00" "2022-10-17T20:00"
[22] "2022-10-17T21:00" "2022-10-17T22:00" "2022-10-17T23:00"
[25] "2022-10-18T00:00" "2022-10-18T01:00" "2022-10-18T02:00"
[28] "2022-10-18T03:00" "2022-10-18T04:00" "2022-10-18T05:00"
[31] "2022-10-18T06:00" "2022-10-18T07:00" "2022-10-18T08:00"
[34] "2022-10-18T09:00" "2022-10-18T10:00" "2022-10-18T11:00"
[37] "2022-10-18T12:00" "2022-10-18T13:00" "2022-10-18T14:00"
[40] "2022-10-18T15:00" "2022-10-18T16:00" "2022-10-18T17:00"
[43] "2022-10-18T18:00" "2022-10-18T19:00" "2022-10-18T20:00"
[46] "2022-10-18T21:00" "2022-10-18T22:00" "2022-10-18T23:00"
[49] "2022-10-19T00:00" "2022-10-19T01:00" "2022-10-19T02:00"
[52] "2022-10-19T03:00" "2022-10-19T04:00" "2022-10-19T05:00"
[55] "2022-10-19T06:00" "2022-10-19T07:00" "2022-10-19T08:00"
[58] "2022-10-19T09:00" "2022-10-19T10:00" "2022-10-19T11:00"
[61] "2022-10-19T12:00" "2022-10-19T13:00" "2022-10-19T14:00"
[64] "2022-10-19T15:00" "2022-10-19T16:00" "2022-10-19T17:00"
[67] "2022-10-19T18:00" "2022-10-19T19:00" "2022-10-19T20:00"
[70] "2022-10-19T21:00" "2022-10-19T22:00" "2022-10-19T23:00"
[73] "2022-10-20T00:00" "2022-10-20T01:00" "2022-10-20T02:00"
[76] "2022-10-20T03:00" "2022-10-20T04:00" "2022-10-20T05:00"
[79] "2022-10-20T06:00" "2022-10-20T07:00" "2022-10-20T08:00"
[82] "2022-10-20T09:00" "2022-10-20T10:00" "2022-10-20T11:00"
[85] "2022-10-20T12:00" "2022-10-20T13:00" "2022-10-20T14:00"
[88] "2022-10-20T15:00" "2022-10-20T16:00" "2022-10-20T17:00"
[91] "2022-10-20T18:00" "2022-10-20T19:00" "2022-10-20T20:00"
[94] "2022-10-20T21:00" "2022-10-20T22:00" "2022-10-20T23:00"
[97] "2022-10-21T00:00" "2022-10-21T01:00" "2022-10-21T02:00"
[100] "2022-10-21T03:00" "2022-10-21T04:00" "2022-10-21T05:00"
[103] "2022-10-21T06:00" "2022-10-21T07:00" "2022-10-21T08:00"
[106] "2022-10-21T09:00" "2022-10-21T10:00" "2022-10-21T11:00"
[109] "2022-10-21T12:00" "2022-10-21T13:00" "2022-10-21T14:00"
[112] "2022-10-21T15:00" "2022-10-21T16:00" "2022-10-21T17:00"
[115] "2022-10-21T18:00" "2022-10-21T19:00" "2022-10-21T20:00"
[118] "2022-10-21T21:00" "2022-10-21T22:00" "2022-10-21T23:00"
[121] "2022-10-22T00:00" "2022-10-22T01:00" "2022-10-22T02:00"
[124] "2022-10-22T03:00" "2022-10-22T04:00" "2022-10-22T05:00"
[127] "2022-10-22T06:00" "2022-10-22T07:00" "2022-10-22T08:00"
[130] "2022-10-22T09:00" "2022-10-22T10:00" "2022-10-22T11:00"
[133] "2022-10-22T12:00" "2022-10-22T13:00" "2022-10-22T14:00"
[136] "2022-10-22T15:00" "2022-10-22T16:00" "2022-10-22T17:00"
[139] "2022-10-22T18:00" "2022-10-22T19:00" "2022-10-22T20:00"
[142] "2022-10-22T21:00" "2022-10-22T22:00" "2022-10-22T23:00"
[145] "2022-10-23T00:00" "2022-10-23T01:00" "2022-10-23T02:00"
[148] "2022-10-23T03:00" "2022-10-23T04:00" "2022-10-23T05:00"
[151] "2022-10-23T06:00" "2022-10-23T07:00" "2022-10-23T08:00"
[154] "2022-10-23T09:00" "2022-10-23T10:00" "2022-10-23T11:00"
[157] "2022-10-23T12:00" "2022-10-23T13:00" "2022-10-23T14:00"
[160] "2022-10-23T15:00" "2022-10-23T16:00" "2022-10-23T17:00"
[163] "2022-10-23T18:00" "2022-10-23T19:00" "2022-10-23T20:00"
[166] "2022-10-23T21:00" "2022-10-23T22:00" "2022-10-23T23:00"
$hourly$temperature_2m
[1] 49.0 48.1 47.3 46.8 46.3 45.4 44.8 44.1 43.6 48.8 56.0 60.3 62.7 64.6 65.7
[16] 65.7 64.6 62.6 58.7 55.2 53.5 52.1 50.5 49.2 48.1 47.8 47.6 47.2 46.3 45.0
[31] 44.3 44.2 44.5 45.2 50.3 56.2 60.6 62.3 63.6 64.5 64.5 63.3 59.2 55.5 53.9
[46] 51.7 50.9 49.6 48.4 47.7 47.2 45.6 44.5 44.2 44.3 45.3 46.0 47.3 49.6 53.6
[61] 57.0 59.5 61.0 61.9 61.5 59.9 56.2 52.6 51.1 50.3 49.5 47.9 47.2 46.9 45.6
[76] 46.4 47.2 47.1 47.0 46.7 46.9 48.8 54.1 59.6 60.3 59.8 58.7 58.2 57.7 56.9
[91] 56.2 55.5 54.7 54.2 53.6 53.2 53.2 53.5 53.3 52.3 50.9 49.3 48.6 48.1 48.0
[106] 48.5 49.5 50.5 50.8 50.8 50.7 50.2 49.6 48.8 48.2 47.8 47.2 46.8 46.4 46.2
[121] 46.1 46.0 45.9 45.8 45.7 45.6 45.5 45.4 45.4 45.5 45.9 46.6 47.6 48.9 49.9
[136] 50.1 49.9 48.9 47.5 45.8 43.5 41.9 40.5 39.1 38.5 38.3 38.1 37.5 36.9 36.4
[151] 36.1 36.0 37.3 40.1 44.0 48.5 50.5 51.7 52.7 52.8 52.3 51.4 50.6 49.7 48.6
[166] 48.1 47.6 47.2
$hourly$rain
[1] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[13] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[25] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[37] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[49] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[61] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[73] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[85] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[97] 0.008 0.008 0.008 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[109] 0.020 0.020 0.020 0.024 0.024 0.024 0.012 0.012 0.012 0.004 0.004 0.004
[121] 0.000 0.000 0.000 0.004 0.004 0.004 0.043 0.043 0.043 0.063 0.063 0.063
[133] 0.008 0.008 0.008 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[145] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[157] 0.000 0.000 0.000 0.000 0.000 0.000 0.004 0.004 0.004 0.008 0.008 0.008
$hourly$windspeed_10m
[1] 3.5 3.1 2.9 2.6 2.5 2.7 2.4 2.2 2.4 1.7 1.6 3.4 3.7 3.0 2.9 3.4 3.2 3.4
[19] 2.4 2.1 2.3 2.2 1.7 1.4 1.4 1.6 1.6 1.6 1.6 2.1 1.5 1.0 0.8 0.9 1.0 2.1
[37] 3.7 4.9 5.1 5.1 4.4 3.8 2.4 1.6 2.7 2.2 1.6 1.8 1.8 1.6 3.6 2.1 1.3 1.1
[55] 0.2 1.0 1.3 1.1 1.6 3.0 3.6 4.7 5.4 5.4 5.5 4.0 2.9 2.6 2.1 2.6 3.1 2.1
[73] 0.3 0.9 1.6 1.6 2.0 1.4 2.5 1.8 3.2 0.9 1.0 3.2 2.1 2.2 3.6 2.9 1.6 1.3
[91] 1.6 2.4 3.5 3.2 2.6 2.1 1.8 2.4 3.8 4.0 3.8 3.5 3.6 3.8 4.3 4.4 4.6 4.7
[109] 4.2 3.0 2.2 2.6 3.4 4.0 3.9 3.6 3.8 3.8 3.7 3.5 3.3 3.2 2.9 2.8 2.4 2.1
[127] 2.0 1.8 2.0 2.0 2.1 1.8 1.6 1.2 0.9 0.2 0.9 1.6 0.9 0.7 2.1 2.4 2.2 2.1
[145] 2.1 2.2 2.2 2.2 2.4 2.6 2.6 2.8 3.2 4.0 5.4 6.9 7.7 8.3 8.8 8.1 7.2 6.4
[163] 6.7 7.3 8.0 8.2 8.4 8.4</code></pre>
</div>
</div>
<aside class="notes"><p>Let’s see an API call. This is a weather API. It’s free and publicly available. If I click on it, or drop it in the chat window for you to click on, you’ll see the output in the browser.</p>
<p>It’s a bit messy but it’s readable. Or here is a code snippet for how I’d use this in R. I’ll use the <code>httr</code> package to formulate the API request and receive a response.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="think-of-apis-as-a-way-to-access-functions" class="slide level2"><h2>Think of APIs as a way to access functions</h2>
<p>General form of an API:</p>
<pre><code>http://hostname/api_endpoint/?parameter=value</code></pre>
<p>Example function:</p>
<div class="cell" data-hash="index_cache/revealjs/unnamed-chunk-2_e1ee29788767f72a785d93a452fc7b89">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a>my_function <span class="ot"><-</span> <span class="cf">function</span>(argument) {</span>
<span id="cb4-2"><a href="#cb4-2"></a> <span class="fu">some_kind_of_operation</span>(argument)</span>
<span id="cb4-3"><a href="#cb4-3"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>As an API:</p>
<pre><code>http://hostname/my_function/?argument=value</code></pre>
<aside class="notes"><p>I want to reiterate this concept of APIs as a way to access a function.</p>
<p>In general, api takes this form.</p>
<p>Here’s a function.</p>
<p>Here’s the function as an analogous API.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="parts-of-an-api" class="slide level2"><h2>Parts of an API</h2>
<ul>
<li>
<strong>Host:</strong>
<ul>
<li><span style="background-color:#f7f896"><code>http://api.hostname.io/</code></span></li>
</ul>
</li>
<li>
<strong>Endpoint:</strong>
<ul>
<li>Resource location (think of this as the function)</li>
<li>
<code>http://api.hostname.io/</code><span style="background-color:#9ef8f8"><code>endpoint</code></span>
</li>
</ul>
</li>
<li>
<strong>Parameters (optional):</strong>
<ul>
<li>Address varying parts of a request (think of these as the arguments)</li>
<li>
<code>http://api.hostname.io/endpoint/</code><span style="background-color:#f9ca9a"><code>?param1=valueA&param2=valueB</code></span>
</li>
</ul>
</li>
<li>
<strong>Headers & body (optional):</strong>
<ul>
<li>(not in URL) Associated (meta)data</li>
</ul>
</li>
</ul>
<p>The weather API:</p>
<p><span style="background-color:#f7f896"><code>https://api.open-meteo.com/</code></span><span style="background-color:#9ef8f8"><code>v1/forecast</code></span><span style="background-color:#f9ca9a"><code>?latitude=47.9&longitude=-122.3& hourly=temperature_2m,rain,windspeed_10m&temperature_unit=fahrenheit& windspeed_unit=mph&precipitation_unit=inch&timezone=America%2FLos_Angeles</code></span></p>
<aside class="notes"><p>Let’s talk a little vocabulary. Host Endpoint Parameters etc.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="api-requests" class="slide level2"><h2>API Requests</h2>
<ul>
<li><p>Each API endpoint has a different <strong>method</strong></p></li>
<li>
<p>GET</p>
<ul>
<li>Used to <em>retrieve</em> data. Parameters only. No body.</li>
<li>Everything is in the URL.</li>
<li>Don’t send sensitive data!</li>
</ul>
</li>
<li>
<p>POST</p>
<ul>
<li>Used for sending data (files or text).</li>
<li>Creating or modifying something.</li>
</ul>
</li>
<li>
<p>Other methods:</p>
<ul>
<li>PUT</li>
<li>DELETE (yikes!) ☠️</li>
<li>HEAD</li>
<li>and more</li>
</ul>
</li>
</ul>
<aside class="notes"><p>So we’ve seen the general form of an API. Let’s talk about the types of requests we can make.</p>
<p>Each endpoint has a <strong>method</strong> for how to interact with it. These methods describe the types of action the request does.</p>
<p>As you’re getting started, GET and POST will cover you.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="api-reponses" class="slide level2"><h2>API Reponses</h2>
<ul>
<li>
<p>Default response from an API is JSON object</p>
<ul>
<li>Human-readable (to an extent)</li>
<li>Familiar syntax for working with in R, Python</li>
</ul>
</li>
<li>
<p>Many frameworks support additional response types</p>
<ul>
<li>text, csv</li>
<li>images</li>
<li>htmlwidgets</li>
<li>specific file types (e.g., RDS, feather, parquet)</li>
<li>and more</li>
</ul>
</li>
</ul>
<aside class="notes"><p>And once we’ve made our request, an API response can take multiple forms.</p>
<p>The default is JSON.</p>
<p>Most frameworks support additional response types. In Plumber these are called the serializer. It’s how the data gets serialized in response.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="why-should-you-build-an-api" class="slide level2"><h2>Why Should <span class="darkyellow"><em>You</em></span> Build an API?</h2>
<p><span class="altred">What’s in your data science toolbox right now?</span></p>
<ul>
<li><p>Reports</p></li>
<li><p>Presentations</p></li>
<li><p>Spreadsheets</p></li>
<li><p>Interactive Dashboards</p></li>
</ul>
<p><span class="fragment"><em>all these tools are limited to <strong>end user consumption</strong></em></span></p>
<p><span class="fragment"><br> 😄 “I can enable an analytics pipeline with APIs.”</span></p>
<aside class="notes"><p>Now we’ve got a feel for what an API is. When can it be useful?</p>
<p>First I want you to consider what you’ve got in your toolbox right now.</p>
<p>if we look at the traditional data science toolbox it may include any number of these traditional things.</p>
<p>🔽 but they’re all limited to end user consumption.<br>
they require some kind of user interaction.</p>
<p>🔽 an API permits you to eliminate the human interaction.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="why-should-you-build-an-api-1" class="slide level2"><h2>Why Should <span class="darkyellow"><em>You</em></span> Build an API?</h2>
<p><span class="altred">Common pain points</span></p>
<ul>
<li><p>“I’ve created a Shiny beast!”</p></li>
<li><p>“We are replicating work in every project”</p></li>
<li><p>“How do we share this code with another system / group?”</p></li>
<li><p>“Your model is great, we’re going to hand it over to this other team to rebuild it in JavaScript.” 😭</p></li>
</ul>
<aside class="notes"><p>That’s cool. but what about these situations. these are some of the pain points I commonly hear that lead to good discussions around using APIs.</p>
<p>Sometimes you build out a solution but the solution itself becomes the problem in that it’s either difficult to maintain or update, or supporting it in production is unwieldy.</p>
<p>or you find you’re replicating work like what I was doing with my manual csv download and running it through the same data cleaning script.</p>
<p>Or you need to share your code with another group or system.</p>
<p>Or worse, I die a little inside when I hear this. A team says they have a great model but they handed it over to another team and they are rebuilding it in another language.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside></section><section id="okay-but-how" class="slide level2"><h2>Okay, but how?</h2>
<div class="columns">
<div class="column" style="width:50%;">
<h4 id="api-frameworks">API frameworks</h4>
<ul>
<li><p>R — plumber</p></li>
<li><p>Python — Flask, FastAPI</p></li>
<li><p>JavaScript — Node.js, Express.js</p></li>
</ul>
</div><div class="column" style="width:50%;">
<h4 id="deployment-options">Deployment options</h4>
<ul>
<li><p>RStudio Connect</p></li>
<li><p>Digital Ocean</p></li>
<li><p>Docker</p></li>
</ul>
</div>
</div>
</section><section id="our-chosen-tools-for-today" class="slide level2"><h2>Our Chosen Tools for Today</h2>
<div class="columns">
<div class="column" style="width:50%;">
<h4 id="api-frameworks-1">API frameworks</h4>
<ul>
<li><p><span class="darkyellow">R — plumber</span></p></li>
<li><p><span style="color:silver;">Python — Flask, FastAPI</span></p></li>
<li><p><span style="color:silver;">JavaScript — Node.js, Express.js</span></p></li>
</ul>
</div><div class="column" style="width:50%;">
<h4 id="deployment-options-1">Deployment options</h4>
<ul>
<li><p><span class="darkyellow">RStudio Connect</span></p></li>
<li><p><span style="color:silver;">Digital Ocean</span></p></li>
<li><p><span style="color:silver;">Docker</span></p></li>
</ul>
</div>
</div>
</section><section id="lets-get-to-work" class="slide level2 center bigger"><h2>Let’s Get to Work!</h2>
</section><section class="slide level2"><div class="left-column-impact">
<p><h7><span class="darkyellow" style="font-size: 275px;">4</span> <br>steps to making a plumber API</h7></p>
</div>
<div class="right-column-impact">
<p><br><img src="images/plumber.png" style="vertical-align:middle" height="350"><br></p>
<h3 id="make-a-function">1. Make a function</h3>
<h3 id="add-plumber-decorations">2. Add <code>plumber</code> decorations</h3>
<h3 id="save-as-plumber.r">3. ⚠️Save as <strong>“<code>plumber.r</code>”</strong>
</h3>
<h3 id="publish">4. Publish</h3>
</div>
</section><section id="start-simple-a-coin-toss-example" class="slide level2"><h2>Start Simple: A coin toss example</h2>
<p><strong>Function 1: coin toss</strong></p>
<div class="cell" data-hash="index_cache/revealjs/unnamed-chunk-3_e4ca04869b9d3600dae96e7c4ac50eb4">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a><span class="co">#Function 1: toss once and give me a heads or tails output </span></span>
<span id="cb6-2"><a href="#cb6-2"></a>coin_toss <span class="ot"><-</span> <span class="cf">function</span>() {</span>
<span id="cb6-3"><a href="#cb6-3"></a> <span class="fu">sample</span>(<span class="fu">c</span>(<span class="st">"heads"</span>, <span class="st">"tails"</span>), <span class="dv">1</span>, </span>
<span id="cb6-4"><a href="#cb6-4"></a> <span class="at">prob =</span> <span class="fu">c</span>(<span class="fl">0.5</span>, <span class="fl">0.5</span>), <span class="at">replace =</span> <span class="cn">TRUE</span>)</span>
<span id="cb6-5"><a href="#cb6-5"></a>}</span>
<span id="cb6-6"><a href="#cb6-6"></a><span class="fu">coin_toss</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "heads"</code></pre>
</div>
</div>
<p><strong>Function 2: multi toss</strong></p>
<div class="cell" data-hash="index_cache/revealjs/unnamed-chunk-4_035b15b972934324588287094b41e156">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1"></a><span class="co">#Function 2: toss multiple times and summarize output</span></span>
<span id="cb8-2"><a href="#cb8-2"></a>multi_toss <span class="ot"><-</span> <span class="cf">function</span>(n) {</span>
<span id="cb8-3"><a href="#cb8-3"></a> <span class="fu">table</span>(<span class="fu">sample</span>(<span class="fu">c</span>(<span class="st">"heads"</span>, <span class="st">"tails"</span>), n, </span>
<span id="cb8-4"><a href="#cb8-4"></a> <span class="at">prob =</span> <span class="fu">c</span>(<span class="fl">0.5</span>, <span class="fl">0.5</span>), <span class="at">replace =</span> <span class="cn">TRUE</span>)) <span class="sc">|></span> </span>
<span id="cb8-5"><a href="#cb8-5"></a> <span class="fu">as.data.frame</span>()</span>
<span id="cb8-6"><a href="#cb8-6"></a>}</span>
<span id="cb8-7"><a href="#cb8-7"></a><span class="fu">multi_toss</span>(<span class="dv">500</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> Var1 Freq
1 heads 239
2 tails 261</code></pre>
</div>
</div>
<div class="fragment fade-up">
<div class="columns">
<div class="column" style="width:40%;">
<p><br><br></p>
<h3 id="get-ready-to-decorate">Get Ready to Decorate!</h3>
</div><div class="column" style="width:60%;">
<p><img data-src="images/decorate.gif"></p>
</div>
</div>
</div>
<aside class="notes"><p>I’m going to run you through a simple example to get your feet wet. Then we’ll look at two additional examples.</p>
<p>we’ll begin with a coin toss. we can consider this a really simple model. I have two functions.</p>
<p>🔽 we’ve done step one. now we get to decorate.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;