-
Notifications
You must be signed in to change notification settings - Fork 0
/
tirads-calc.html
1021 lines (990 loc) · 51.1 KB
/
tirads-calc.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 xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.550">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Kittipos Sirivongrungson">
<meta name="dcterms.date" content="2024-03-31">
<title>ACR TI-RADS Calculator</title>
<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 -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for citations */
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging-indent div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script><script src="tirads-calc_files/libs/clipboard/clipboard.min.js"></script>
<script src="tirads-calc_files/libs/quarto-html/quarto.js"></script>
<script src="tirads-calc_files/libs/quarto-html/popper.min.js"></script>
<script src="tirads-calc_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="tirads-calc_files/libs/quarto-html/anchor.min.js"></script>
<link href="tirads-calc_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="tirads-calc_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="tirads-calc_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="tirads-calc_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="tirads-calc_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<meta name="shiny-dependency-placeholder" content="">
<link rel="apple-touch-icon" sizes="180x180" href="images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon/favicon-16x16.png">
<link rel="manifest" href="images/favicon/site.webmanifest">
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==" crossorigin="anonymous"></script>
<script type="application/javascript">define('jquery', [],function() {return window.jQuery;})</script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header id="title-block-header" class="quarto-title-block default page-columns page-full">
<div class="quarto-title-banner page-columns page-full">
<div class="quarto-title column-body">
<div class="quarto-title-block"><div><h1 class="title">ACR TI-RADS Calculator</h1><button type="button" class="btn code-tools-button" id="quarto-code-tools-source" data-quarto-source-url="https://github.com/Lightbridge-KS/tirads-calc-py"><i class="bi"></i> Code</button></div></div>
<p class="subtitle lead">A Calculator for Thyroid Imaging Reporting & Data System <img src="images/cover.png" align="right" height="90"></p>
</div>
</div>
<div class="quarto-title-meta">
<div>
<div class="quarto-title-meta-heading">Author</div>
<div class="quarto-title-meta-contents">
<p>Kittipos Sirivongrungson </p>
</div>
</div>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">March 31, 2024</p>
</div>
</div>
</div>
</header><div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#categories" id="toc-categories" class="nav-link active" data-scroll-target="#categories">Categories</a>
<ul class="collapse">
<li><a href="#composition" id="toc-composition" class="nav-link" data-scroll-target="#composition">Composition</a></li>
<li><a href="#echogenicity" id="toc-echogenicity" class="nav-link" data-scroll-target="#echogenicity">Echogenicity</a></li>
<li><a href="#shape" id="toc-shape" class="nav-link" data-scroll-target="#shape">Shape</a></li>
<li><a href="#sec-margin" id="toc-sec-margin" class="nav-link" data-scroll-target="#sec-margin">Margin</a></li>
<li><a href="#echogenic-foci" id="toc-echogenic-foci" class="nav-link" data-scroll-target="#echogenic-foci">Echogenic foci</a></li>
<li><a href="#size-cm" id="toc-size-cm" class="nav-link" data-scroll-target="#size-cm">Size (cm)</a></li>
</ul></li>
<li><a href="#results" id="toc-results" class="nav-link" data-scroll-target="#results">Results</a></li>
</ul>
</nav>
</div>
<main class="content quarto-banner-title-block" id="quarto-document-content">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
About
</div>
</div>
<div class="callout-body-container callout-body">
<p>This calculator was implemented from <a href="https://www.acr.org/Clinical-Resources/Reporting-and-Data-Systems/TI-RADS">ACR TI-RADS™</a> for thyroid ultrasound.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-2-contents" aria-controls="callout-2" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Expand to see TI-RADS Chart
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-2" class="callout-2-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<p>This calculator was implemented using the following <a href="#fig-tirads-chart" class="quarto-xref">Figure 1</a> algorithm.</p>
<div id="fig-tirads-chart" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tirads-chart-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="images/tirads-chart.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tirads-chart-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 1: ACR TI-RADS Chart to determine TI-RADS Level and Suggestions <span class="citation" data-cites="ACR-TIRADS-WhitePaper">[<a href="#ref-ACR-TIRADS-WhitePaper" role="doc-biblioref">1</a>]</span>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<section id="categories" class="level2">
<h2 class="anchored" data-anchor-id="categories">Categories</h2>
<p>Select your option from “✅” tab or see example images from “🏞” tab.</p>
<section id="composition" class="level3">
<h3 class="anchored" data-anchor-id="composition">Composition</h3>
<div class="tabset-margin-container"></div><div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-1-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-1" role="tab" aria-controls="tabset-1-1" aria-selected="true" href="">✅</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-1-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-2" role="tab" aria-controls="tabset-1-2" aria-selected="false" href="">🏞</a></li></ul>
<div class="tab-content">
<div id="tabset-1-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-1-1-tab">
<div id="8677d865" class="cell" data-execution_count="3">
<div class="cell-output cell-output-display" data-execution_count="27">
<div id="composition" style="width:400px;" class="form-group shiny-input-radiogroup shiny-input-container" role="radiogroup" aria-labelledby="composition-label">
<label class="control-label" id="composition-label" for="composition">Choose one:</label>
<div class="shiny-options-group">
<div class="radio">
<label><input type="radio" name="composition" value="cystic" checked="checked"> <span>Cystic or almost completely cystic (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="composition" value="spongiform"> <span>Spongiform (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="composition" value="mixed"> <span>Mixed cystic and solid (1)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="composition" value="solid"> <span>Solid or almost completely solid (2)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="composition" value="undetermined"> <span>Cannot be determined due to calcification (2)</span></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tabset-1-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-1-2-tab">
<div id="fig-composition" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-composition-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/composition-w-text.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-composition-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 2: <strong>Composition</strong> <span class="citation" data-cites="RadAssist ACR-TIRADS-Lexicon">[<a href="#ref-RadAssist" role="doc-biblioref">2</a>,<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>
</figcaption>
</figure>
</div>
<ul>
<li><strong>Cystic or almost completely cystic (0):</strong>
<ul>
<li><em>Cystic:</em> Entirely fluid filled.</li>
<li><em>Predominately cystic:</em> Composed of soft tissue components < 50% of the volume of the nodule.</li>
</ul></li>
<li><strong>Spongiform (0):</strong> aggregation of multiple microcystic components ≥ 50% of the volume of the nodule (akin to the fluid-filled spaces in a wet sponge <span class="citation" data-cites="ACR-TIRADS-UserGuide">[<a href="#ref-ACR-TIRADS-UserGuide" role="doc-biblioref">4</a>]</span>).</li>
<li><strong>Mixed cystic and solid (1):</strong> Combines two features from the lexicon, predominately solid and predominately cystic.
<ul>
<li><strong>High risk feature:</strong> Solid material that is eccentric and has an acute angle with the nodule’s wall is suspicious.</li>
<li>Base all other lexicon nodule characteristics on the solid component.</li>
</ul></li>
<li><strong>Solid or almost completely solid (2):</strong>
<ul>
<li><em>Solid:</em> Composed entirely or nearly entirely of soft tissue, with only a few tiny cystic spaces (< 5%).</li>
<li><em>Predominately solid:</em> Composed of soft tissue components ≥ 50% of the volume of the nodule.</li>
</ul></li>
</ul>
<p><strong>Note:</strong> Assign 2 points if composition cannot be determined because of calcification.</p>
</div>
</div>
</div>
</section>
<section id="echogenicity" class="level3">
<h3 class="anchored" data-anchor-id="echogenicity">Echogenicity</h3>
<div class="tabset-margin-container"></div><div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-2-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-2-1" role="tab" aria-controls="tabset-2-1" aria-selected="true" href="">✅</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-2-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-2-2" role="tab" aria-controls="tabset-2-2" aria-selected="false" href="">🏞</a></li></ul>
<div class="tab-content">
<div id="tabset-2-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-2-1-tab">
<div id="8ea4ebd7" class="cell" data-execution_count="4">
<div class="cell-output cell-output-display" data-execution_count="28">
<div id="echogenicity" style="width:400px;" class="form-group shiny-input-radiogroup shiny-input-container" role="radiogroup" aria-labelledby="echogenicity-label">
<label class="control-label" id="echogenicity-label" for="echogenicity">Choose one:</label>
<div class="shiny-options-group">
<div class="radio">
<label><input type="radio" name="echogenicity" value="an" checked="checked"> <span>Anechoic (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="echogenicity" value="hyper"> <span>Hyperechoic or Isoechoic (1)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="echogenicity" value="hypo"> <span>Hypoechoic (2)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="echogenicity" value="very-hypo"> <span>Very hypoechoic (3)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="echogenicity" value="undetermined"> <span>Can not be determined (1)</span></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tabset-2-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-2-2-tab">
<div id="fig-echogenicity" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-echogenicity-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/echogenicity-w-text.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-echogenicity-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 3: <strong>Echogenicity</strong> <span class="citation" data-cites="RadAssist RadKey-ThyroidCyst">[<a href="#ref-RadAssist" role="doc-biblioref">2</a>,<a href="#ref-RadKey-ThyroidCyst" role="doc-biblioref">5</a>]</span>
</figcaption>
</figure>
</div>
<ul>
<li><p><strong>Hyper (1), iso (1), hypoechoic (2):</strong> relative to surrounding <em>thyroid tissue</em> <span class="citation" data-cites="ACR-TIRADS-Lexicon">[<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>.</p></li>
<li><p><strong>Very hypoechoic (3):</strong> hypoechoic relative to adjacent <em>neck musculature</em> <span class="citation" data-cites="ACR-TIRADS-Lexicon">[<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>.</p></li>
</ul>
<p><strong>Note:</strong> Assign 1 point if echogenicity cannot be determined.</p>
</div>
</div>
</div>
</section>
<section id="shape" class="level3">
<h3 class="anchored" data-anchor-id="shape">Shape</h3>
<div class="tabset-margin-container"></div><div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-3-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-3-1" role="tab" aria-controls="tabset-3-1" aria-selected="true" href="">✅</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-3-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-3-2" role="tab" aria-controls="tabset-3-2" aria-selected="false" href="">🏞</a></li></ul>
<div class="tab-content">
<div id="tabset-3-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-3-1-tab">
<div id="839cfd17" class="cell" data-execution_count="5">
<div class="cell-output cell-output-display" data-execution_count="29">
<div id="shape" style="width:400px;" class="form-group shiny-input-radiogroup shiny-input-container" role="radiogroup" aria-labelledby="shape-label">
<label class="control-label" id="shape-label" for="shape">Choose one:</label>
<div class="shiny-options-group">
<div class="radio">
<label><input type="radio" name="shape" value="wider" checked="checked"> <span>Wider-than-tall (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="shape" value="taller"> <span>Taller-than-wide (3)</span></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tabset-3-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-3-2-tab">
<div id="fig-shape" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-shape-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/shape-w-text.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-shape-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 4: <strong>Shape: taller-than-wide</strong> <span class="citation" data-cites="ACR-TIRADS-Lexicon">[<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>
</figcaption>
</figure>
</div>
<ul>
<li><strong>taller-than-wide (3):</strong> ratio of <code>AP / horizontal diameter > 1</code>, when measured in the transverse plane <span class="citation" data-cites="ACR-TIRADS-Lexicon">[<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>. Highly specific of malignancy <span class="citation" data-cites="ACR-TIRADS-WhitePaper">[<a href="#ref-ACR-TIRADS-WhitePaper" role="doc-biblioref">1</a>]</span>.</li>
</ul>
</div>
</div>
</div>
</section>
<section id="sec-margin" class="level3">
<h3 class="anchored" data-anchor-id="sec-margin">Margin</h3>
<div class="tabset-margin-container"></div><div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-4-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-4-1" role="tab" aria-controls="tabset-4-1" aria-selected="true" href="">✅</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-4-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-4-2" role="tab" aria-controls="tabset-4-2" aria-selected="false" href="">🏞</a></li></ul>
<div class="tab-content">
<div id="tabset-4-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-4-1-tab">
<div id="bb6d165e" class="cell" data-execution_count="6">
<div class="cell-output cell-output-display" data-execution_count="30">
<div id="margin" style="width:400px;" class="form-group shiny-input-radiogroup shiny-input-container" role="radiogroup" aria-labelledby="margin-label">
<label class="control-label" id="margin-label" for="margin">Choose one:</label>
<div class="shiny-options-group">
<div class="radio">
<label><input type="radio" name="margin" value="undetermined" checked="checked"> <span>Can not be determined (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="margin" value="smooth"> <span>Smooth (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="margin" value="ill-defined"> <span>Ill-defined (0)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="margin" value="lob-irreg"> <span>Lobulated or Irregular (2)</span></label>
</div>
<div class="radio">
<label><input type="radio" name="margin" value="extra"> <span>Extrathyroidal extension (3)</span></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tabset-4-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-4-2-tab">
<div id="fig-margin" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-margin-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/margin-w-text.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-margin-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 5: <strong>Margin</strong> <span class="citation" data-cites="ACR-TIRADS-Lexicon ACR-TIRADS-UserGuide RadAssist">[<a href="#ref-RadAssist" role="doc-biblioref">2</a>–<a href="#ref-ACR-TIRADS-UserGuide" role="doc-biblioref">4</a>]</span>
</figcaption>
</figure>
</div>
<p><strong>Definition</strong> <span class="citation" data-cites="ACR-TIRADS-Lexicon">[<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span></p>
<ul>
<li><p><strong>Smooth (0):</strong> uninterrupted, well-defined, curvilinear edge typically forming a spherical or elliptical shape.</p></li>
<li><p><strong>Ill-defined (0):</strong> border of the nodule is difficult to distinguish from thyroid parenchyma; the nodule lacks irregular or lobulated margins.</p></li>
<li><p><strong>Irregular margin (2):</strong> spiculated, jagged, or with sharp angles with or without clear soft tissue protrusions into the parenchyma.</p></li>
<li><p><strong>Lobulated (2):</strong> border has focal rounded soft tissue protrusions that extend into the adjacent parenchyma.</p></li>
<li><p><strong>Extrathyroidal extension (ETE) (3):</strong> nodule extends through the thyroid capsule, a highly reliable sign of malignancy and is an unfavorable prognostic sign.</p></li>
</ul>
<div id="fig-margin-ete" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-margin-ete-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/margin-ete.png" class="img-fluid figure-img" style="width:70.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-margin-ete-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 6: <strong>Extrathyroidal extension (ETE)</strong> <span class="citation" data-cites="ACR-TIRADS-Atlas">[<a href="#ref-ACR-TIRADS-Atlas" role="doc-biblioref">6</a>]</span>
</figcaption>
</figure>
</div>
<p><strong>Note:</strong> If the margin cannot be determined for any reason, zero points should be assigned.</p>
</div>
</div>
</div>
</section>
<section id="echogenic-foci" class="level3">
<h3 class="anchored" data-anchor-id="echogenic-foci">Echogenic foci</h3>
<div class="tabset-margin-container"></div><div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-5-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-5-1" role="tab" aria-controls="tabset-5-1" aria-selected="true" href="">✅</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-5-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-5-2" role="tab" aria-controls="tabset-5-2" aria-selected="false" href="">🏞</a></li></ul>
<div class="tab-content">
<div id="tabset-5-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-5-1-tab">
<div id="afdeefae" class="cell" data-execution_count="7">
<div class="cell-output cell-output-display" data-execution_count="31">
<div id="echogenic_foci" style="width:400px;" class="form-group shiny-input-checkboxgroup shiny-input-container" role="group" aria-labelledby="echogenic_foci-label">
<label class="control-label" id="echogenic_foci-label" for="echogenic_foci">Choose All That Apply</label>
<div class="shiny-options-group">
<div class="checkbox">
<label><input type="checkbox" name="echogenic_foci" value="none-comet"> <span>None or Large comet-tail artifacts (0)</span></label>
</div>
<div class="checkbox">
<label><input type="checkbox" name="echogenic_foci" value="macro-calc"> <span>Macrocalcification (1)</span></label>
</div>
<div class="checkbox">
<label><input type="checkbox" name="echogenic_foci" value="rim-calc"> <span>Rim calcification (2)</span></label>
</div>
<div class="checkbox">
<label><input type="checkbox" name="echogenic_foci" value="punctate"> <span>Punctate echogenic foci (3)</span></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="tabset-5-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-5-2-tab">
<div id="fig-echogenic-foci" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-echogenic-foci-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/echogenic-foci-w-text.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-echogenic-foci-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 7: <strong>Echogenic foci</strong> <span class="citation" data-cites="ACR-TIRADS-Lexicon RadAssist">[<a href="#ref-RadAssist" role="doc-biblioref">2</a>,<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>
</figcaption>
</figure>
</div>
<p><strong>Definition</strong> <span class="citation" data-cites="ACR-TIRADS-Lexicon ACR-TIRADS-WhitePaper">[<a href="#ref-ACR-TIRADS-WhitePaper" role="doc-biblioref">1</a>,<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span></p>
<ul>
<li><p><strong>Large comet-tail artifacts (0):</strong> echogenic foci with <em>V-shaped echoes</em> > 1 mm deep to them, a type of reverberation artifact. They are associated with colloid and are strongly indicative of benignity when found within the cystic components of thyroid nodules.</p></li>
<li><p><strong>Macrocalcifications (1):</strong> coarse echogenic foci accompanied by <strong><em>acoustic shadowing</em></strong>. Published data shows a weakly positive relationship with malignancy.</p></li>
<li><p><strong>Peripheral (rim) calcifications (2):</strong> occupy the periphery of the nodule (complete or incomplete). More strongly associated with malignancy than macrocalcifications. <em>Interrupted</em> peripheral calcifications qualifies as a <em>lobulated</em> margin (see <a href="#sec-margin" class="quarto-xref">Section 1.4</a>).</p></li>
<li><p><strong>Punctate echogenic foci (3):</strong> “Dot-like” foci (< 1 mm) smaller than macrocalcifications and are <strong><em>nonshadowing</em></strong>. In the solid components of thyroid nodules, they may correspond to the psammomatous calcifications associated with papillary cancers; therefore, considered <em>highly suspicious</em>.</p></li>
</ul>
</div>
</div>
</div>
</section>
<section id="size-cm" class="level3">
<h3 class="anchored" data-anchor-id="size-cm">Size (cm)</h3>
<div id="c41e019c" class="cell" data-execution_count="8">
<div class="cell-output cell-output-display" data-execution_count="32">
<div class="form-group shiny-input-container">
<label class="control-label shiny-label-null" id="size_cm-label" for="size_cm"></label><input id="size_cm" type="number" class="shiny-input-number form-control" min="0">
</div>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-3-contents" aria-controls="callout-3" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
How to measure size ?
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-3" class="callout-3-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<p>Nodules should be measured in three axes <span class="citation" data-cites="ACR-TIRADS-Lexicon">[<a href="#ref-ACR-TIRADS-Lexicon" role="doc-biblioref">3</a>]</span>:</p>
<ol type="1">
<li>Maximum dimension on an axial image</li>
<li>Maximum dimension perpendicular to the previous measurement on the same image</li>
<li>Maximum longitudinal dimension on a sagittal image</li>
</ol>
<div id="fig-size-measure" class="quarto-figure quarto-figure-left quarto-float anchored" data-fig-align="left">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-size-measure-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/size-measure.jpg" class="img-fluid quarto-figure quarto-figure-left figure-img" style="width:40.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-size-measure-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 8: Nodule size measurement example
</figcaption>
</figure>
</div>
</div>
</div>
</div>
</section>
</section>
<section id="results" class="level2">
<h2 class="anchored" data-anchor-id="results">Results</h2>
<div id="4f439902" class="cell" data-execution_count="10">
<div class="cell-output cell-output-display no-overflow-x">
<div class="shiny-html-output" id="render_md_summary"></div>
</div>
</div>
<div id="d61f4c35" class="cell" data-execution_count="11">
<div class="cell-output cell-output-display">
<shiny-data-frame id="output_df" class="html-fill-item html-fill-container"></shiny-data-frame><script type="application/json" data-html-dependency="">{"name": "shiny-data-frame-output", "version": "0.8.1", "source": {"package": "shiny", "subdir": "www/shared/py-shiny/dataframe"}, "script": [{"src": "dataframe.js", "type": "module"}], "stylesheet": [], "meta": [], "all_files": false, "head": null}</script>
<script type="application/json" data-html-dependency="">{"name": "htmltools-fill", "version": "0.5.7", "source": {"package": "shiny", "subdir": "www/shared/htmltools/fill"}, "script": [], "stylesheet": [{"href": "fill.css", "rel": "stylesheet"}], "meta": [], "all_files": false, "head": null}</script>
</div>
</div>
<div id="23405f5f" class="cell" data-execution_count="12">
<div class="cell-output cell-output-display no-overflow-x">
<div class="shiny-html-output" id="render_md_actions"></div>
</div>
</div>
<hr>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-4-contents" aria-controls="callout-4" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Expand to see TI-RADS Chart
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-4" class="callout-4-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<div id="fig-tirads-chart-2" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tirads-chart-2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="images/tirads-chart.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tirads-chart-2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 9: ACR TI-RADS Chart to determine TI-RADS Level and Suggestions <span class="citation" data-cites="ACR-TIRADS-WhitePaper">[<a href="#ref-ACR-TIRADS-WhitePaper" role="doc-biblioref">1</a>]</span>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-5-contents" aria-controls="callout-5" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Expand to see TI-RADS Chart (Alternative)
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-5" class="callout-5-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<div id="fig-tirads-alt" class="quarto-figure quarto-figure-center quarto-float anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tirads-alt-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="./images/tirads-alternative.png" class="img-fluid figure-img" style="width:100.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tirads-alt-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure 10: ACR TI-RADS Alternative Chart <span class="citation" data-cites="ACR-TIRADS-Cat-Alt">[<a href="#ref-ACR-TIRADS-Cat-Alt" role="doc-biblioref">7</a>]</span>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
</section>
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" role="doc-bibliography" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body" data-entry-spacing="0" role="list">
<div id="ref-ACR-TIRADS-WhitePaper" class="csl-entry" role="listitem">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">F.N. Tessler, W.D. Middleton, E.G. Grant, J.K. Hoang, L.L. Berland, S.A. Teefey, J.J. Cronan, M.D. Beland, T.S. Desser, M.C. Frates, L.W. Hammers, U.M. Hamper, J.E. Langer, C.C. Reading, L.M. Scoutt, A.T. Stavros, ACR thyroid imaging, reporting and data system (TI-RADS): White paper of the ACR TI-RADS committee, Journal of the American College of Radiology: JACR. 14 (2017) 587–595. https://doi.org/<a href="https://doi.org/10.1016/j.jacr.2017.01.046">10.1016/j.jacr.2017.01.046</a>.</div>
</div>
<div id="ref-RadAssist" class="csl-entry" role="listitem">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">A. van der L. Habib Ahmad, The radiology assistant: TI-RADS - thyroid imaging reporting and data system, (n.d.). <a href="https://radiologyassistant.nl/head-neck/ti-rads/ti-rads">https://radiologyassistant.nl/head-neck/ti-rads/ti-rads</a>.</div>
</div>
<div id="ref-ACR-TIRADS-Lexicon" class="csl-entry" role="listitem">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">E.G. Grant, F.N. Tessler, J.K. Hoang, J.E. Langer, M.D. Beland, L.L. Berland, J.J. Cronan, T.S. Desser, M.C. Frates, U.M. Hamper, W.D. Middleton, C.C. Reading, L.M. Scoutt, A.T. Stavros, S.A. Teefey, Thyroid ultrasound reporting lexicon: White paper of the ACR thyroid imaging, reporting and data system (TIRADS) committee, Journal of the American College of Radiology: JACR. 12 (2015) 1272–1279. https://doi.org/<a href="https://doi.org/10.1016/j.jacr.2015.07.011">10.1016/j.jacr.2015.07.011</a>.</div>
</div>
<div id="ref-ACR-TIRADS-UserGuide" class="csl-entry" role="listitem">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">F.N. Tessler, W.D. Middleton, E.G. Grant, Thyroid imaging reporting and data system (TI-RADS): A user’s guide, Radiology. 287 (2018) 29–36. https://doi.org/<a href="https://doi.org/10.1148/radiol.2017171240">10.1148/radiol.2017171240</a>.</div>
</div>
<div id="ref-RadKey-ThyroidCyst" class="csl-entry" role="listitem">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">Z. Fryšák, Radiology key: Thyroid cysts, (2017). <a href="https://radiologykey.com/thyroid-cysts">https://radiologykey.com/thyroid-cysts</a>.</div>
</div>
<div id="ref-ACR-TIRADS-Atlas" class="csl-entry" role="listitem">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">ACR TI-RADS atlas, (n.d.). <a href="https://www.acr.org/-/media/ACR/Files/RADS/TI-RADS/ACR-TI-RADS-Atlas.pdf">https://www.acr.org/-/media/ACR/Files/RADS/TI-RADS/ACR-TI-RADS-Atlas.pdf</a>.</div>
</div>
<div id="ref-ACR-TIRADS-Cat-Alt" class="csl-entry" role="listitem">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline">ACR TI-RADS assessment categories (alternative chart), (n.d.). <a href="https://www.acr.org/-/media/ACR/Files/RADS/TI-RADS/TI-RADS-Alternative-chart.pdf">https://www.acr.org/-/media/ACR/Files/RADS/TI-RADS/TI-RADS-Alternative-chart.pdf</a>.</div>
</div>
</div></section></div></main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const isCodeAnnotation = (el) => {
for (const clz of el.classList) {
if (clz.startsWith('code-annotation-')) {
return true;
}
}
return false;
}
const clipboard = new window.ClipboardJS('.code-copy-button', {
text: function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
const viewSource = window.document.getElementById('quarto-view-source') ||
window.document.getElementById('quarto-code-tools-source');
if (viewSource) {
const sourceUrl = viewSource.getAttribute("data-quarto-source-url");
viewSource.addEventListener("click", function(e) {
if (sourceUrl) {
// rstudio viewer pane
if (/\bcapabilities=\b/.test(window.location)) {
window.open(sourceUrl);
} else {
window.location.href = sourceUrl;
}
} else {
const modal = new bootstrap.Modal(document.getElementById('quarto-embedded-source-code-modal'));
modal.show();
}
return false;
});
}
function toggleCodeHandler(show) {
return function(e) {
const detailsSrc = window.document.querySelectorAll(".cell > details > .sourceCode");
for (let i=0; i<detailsSrc.length; i++) {
const details = detailsSrc[i].parentElement;
if (show) {
details.open = true;
} else {
details.removeAttribute("open");
}
}
const cellCodeDivs = window.document.querySelectorAll(".cell > .sourceCode");
const fromCls = show ? "hidden" : "unhidden";
const toCls = show ? "unhidden" : "hidden";
for (let i=0; i<cellCodeDivs.length; i++) {
const codeDiv = cellCodeDivs[i];
if (codeDiv.classList.contains(fromCls)) {
codeDiv.classList.remove(fromCls);
codeDiv.classList.add(toCls);
}
}
return false;
}
}
const hideAllCode = window.document.getElementById("quarto-hide-all-code");
if (hideAllCode) {
hideAllCode.addEventListener("click", toggleCodeHandler(false));
}
const showAllCode = window.document.getElementById("quarto-show-all-code");
if (showAllCode) {
showAllCode.addEventListener("click", toggleCodeHandler(true));
}
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
const config = {
allowHTML: true,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start',
};
if (contentFn) {
config.content = contentFn;
}
if (onTriggerFn) {
config.onTrigger = onTriggerFn;
}
if (onUntriggerFn) {
config.onUntrigger = onUntriggerFn;
}
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
const xrefs = window.document.querySelectorAll('a.quarto-xref');
const processXRef = (id, note) => {
// Strip column container classes
const stripColumnClz = (el) => {
el.classList.remove("page-full", "page-columns");
if (el.children) {
for (const child of el.children) {
stripColumnClz(child);
}
}
}
stripColumnClz(note)
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
container.appendChild(note.children[0].cloneNode(true));
for (let i = 1; i < note.children.length; i++) {
const child = note.children[i];
if (child.tagName === "P" && child.innerText === "") {
continue;
} else {
container.appendChild(child.cloneNode(true));
break;
}
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(container);
}
return container.innerHTML
} else {
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
return note.innerHTML;
}
} else {
// Remove any anchor links if they are present
const anchorLink = note.querySelector('a.anchorjs-link');
if (anchorLink) {
anchorLink.remove();
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
// TODO in 1.5, we should make sure this works without a callout special case
if (note.classList.contains("callout")) {
return note.outerHTML;
} else {
return note.innerHTML;
}
}
}
for (var i=0; i<xrefs.length; i++) {
const xref = xrefs[i];
tippyHover(xref, undefined, function(instance) {
instance.disable();
let url = xref.getAttribute('href');
let hash = undefined;
if (url.startsWith('#')) {
hash = url;
} else {
try { hash = new URL(url).hash; } catch {}
}
if (hash) {
const id = hash.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
if (note !== null) {
try {
const html = processXRef(id, note.cloneNode(true));
instance.setContent(html);
} finally {
instance.enable();
instance.show();
}
} else {
// See if we can fetch this
fetch(url.split('#')[0])
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.getElementById(id);
if (note !== null) {
const html = processXRef(id, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
} else {
// See if we can fetch a full url (with no hash to target)
// This is a special case and we should probably do some content thinning / targeting
fetch(url)
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.querySelector('main.content');
if (note !== null) {
// This should only happen for chapter cross references
// (since there is no id in the URL)
// remove the first header
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
note.children[0].remove();
}
const html = processXRef(null, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
}, function(instance) {
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
let cellAttr = 'data-code-cell="' + cell + '"';
let lineAttr = 'data-code-annotation="' + annotation + '"';
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
return selector;
}
const selectCodeLines = (annoteEl) => {
const doc = window.document;
const targetCell = annoteEl.getAttribute("data-target-cell");
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
const lineIds = lines.map((line) => {
return targetCell + "-" + line;
})
let top = null;
let height = null;
let parent = null;
if (lineIds.length > 0) {
//compute the position of the single el (top and bottom and make a div)
const el = window.document.getElementById(lineIds[0]);
top = el.offsetTop;
height = el.offsetHeight;
parent = el.parentElement.parentElement;
if (lineIds.length > 1) {
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
height = bottom - top;
}
if (top !== null && height !== null && parent !== null) {
// cook up a div (if necessary) and position it
let div = window.document.getElementById("code-annotation-line-highlight");
if (div === null) {
div = window.document.createElement("div");
div.setAttribute("id", "code-annotation-line-highlight");
div.style.position = 'absolute';
parent.appendChild(div);
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
div.style.left = 0;
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
gutterDiv.style.position = 'absolute';
const codeCell = window.document.getElementById(targetCell);
const gutter = codeCell.querySelector('.code-annotation-gutter');
gutter.appendChild(gutterDiv);
}
gutterDiv.style.top = top - 2 + "px";
gutterDiv.style.height = height + 4 + "px";
}
selectedAnnoteEl = annoteEl;
}
};
const unselectCodeLines = () => {
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
elementsIds.forEach((elId) => {
const div = window.document.getElementById(elId);
if (div) {
div.remove();
}
});
selectedAnnoteEl = undefined;
};
// Handle positioning of the toggle
window.addEventListener(
"resize",
throttle(() => {
elRect = undefined;
if (selectedAnnoteEl) {
selectCodeLines(selectedAnnoteEl);
}
}, 10)
);
function throttle(fn, ms) {
let throttle = false;
let timer;
return (...args) => {
if(!throttle) { // first call gets through
fn.apply(this, args);
throttle = true;
} else { // all the others get throttled
if(timer) clearTimeout(timer); // cancel #2
timer = setTimeout(() => {
fn.apply(this, args);
timer = throttle = false;
}, ms);
}
};
}
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
annoteDlNode.addEventListener('click', (event) => {
const clickedEl = event.target;
if (clickedEl !== selectedAnnoteEl) {
unselectCodeLines();
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
if (activeEl) {
activeEl.classList.remove('code-annotation-active');
}
selectCodeLines(clickedEl);
clickedEl.classList.add('code-annotation-active');
} else {
// Unselect the line
unselectCodeLines();
clickedEl.classList.remove('code-annotation-active');
}
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {