-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathapp.R
4005 lines (3222 loc) · 192 KB
/
app.R
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
####################
# Ben Glicksberg
# Butte Lab / UCSF
# 2018-19
####################
suppressPackageStartupMessages(library(DBI))
suppressPackageStartupMessages(library(shiny))
suppressPackageStartupMessages(library(shinyWidgets))
suppressPackageStartupMessages(library(shinyjs))
suppressPackageStartupMessages(library(shinyalert))
suppressPackageStartupMessages(library(shinythemes))
suppressPackageStartupMessages(library(shinycssloaders))
suppressPackageStartupMessages(library(plotly))
suppressPackageStartupMessages(library(timevis))
suppressPackageStartupMessages(library(stringr))
suppressPackageStartupMessages(library(dplyr))
options("currentPath" = paste0(getwd(),'/'))
source("global.R")
##############################################################
############################# UI #############################
##############################################################
ui <- fluidPage(
#### sets page style
tags$head(
tags$style(
HTML(
"body{
height: auto;
max-width: 1800px;
margin-left: 250px;
margin-right:300px;
}
.navbar{
margin-left:250px;
#margin-right:500px;
#width:100%;
max-width:1100px;
}"
)
)
),
navbarPage("PatientExploreR",id="inTabset", ### Navigation bar
#### HOME tab
tabPanel("Home",
style = "width:100%; margin-left:250px; margin-right:200px",
mainPanel(align="center",
useShinyjs(),
useShinyalert(),
fluidPage(theme = shinytheme("paper"),
fluidRow( # intro fluidRow
tags$h3("PatientExploreR"),
tags$p("PatientExploreR interfaces with a relational database of EHR data in the Observational Medical Outcomes Partnership (OMOP) Common Data Model (CDM). This application produces patient-level interactive and dynamic reports and visualization of clinical data, without requiring programming skills.",align="left"),
tags$br(),
fluidRow(
column(width=4, # Help button
actionButton("gotoHelp","",icon=icon("question-circle","fa-5x"),lib="font-awesome"),
fluidRow(tags$h5("Help"))),
column(width=4, # About button
actionButton("gotoAbout","",icon=icon("info-circle","fa-5x"),lib="font-awesome"),
fluidRow(tags$h5("About"))),
column(width=4, #Configuration button
actionButton("gotoConfiguration","",icon=icon("download","fa-5x"),lib="font-awesome"),
fluidRow(tags$h5("Configuration")))),
tags$hr()
), # end intro fluidRow
fluidRow(
column(width=5, # Login column
tags$h4("Please log-in below:"),
# Credentials section
textInput(inputId="sqlid", label="User ID", value = "", width = NULL, placeholder = "User ID"),
passwordInput(inputId="sqlpass", label="Password", value = "", width = NULL,placeholder = NULL),
textInput(inputId="sqlhost", label="Host", value = "", width = NULL, placeholder = "Host"),
textInput(inputId="sqldb", label="Database", value = "", width = NULL, placeholder = "Database"),
pickerInput(
inputId = "driver_picker",
label = "Driver",
choices = c("MySQL","PostgreSQL", "Amazon Redshift", "Microsoft SQL Server", "Microsoft Parallel Data Warehouse", "Google BigQuery"),
selected = "MySQL",
multiple = FALSE),
textInput(inputId="sqlport", label="Port", value = "", width = NULL, placeholder = "Port"),
fluidRow(column(width=6,
actionButton(width = 150,
inputId = "save_credentials",
label = "Save Credentials")),
column(width=6,
actionButton(width =150,
inputId = "load_credentials",
label = "Load Credentials"))),
HTML("<br>"),
fluidRow(
column(width=12,
directoryInput('directory', label = "", value = getOption("currentPath"))
# credit: https://github.com/wleepang/shiny-directory-input
)
),
HTML("<br>"),
fluidRow(
column(width=6,
disabled(actionButton(width =150,
inputId = "logout",
label = "Logout"
))
),
column(width=6,
actionButton(width = 150,
inputId = "login",
label = "Login"
)))
), # end Login column
column(width=7, # utilities column
shinyjs::hidden(
div(id="dashboard_open",
fluidRow(
shinyjs::hidden(div(id="intro_help_panel",uiOutput("intro_help")))
),
fluidRow( # utilities row
fluidRow(
column(width=2,div(style = "height:20px;"),
fluidRow(
actionButton("gotoFinder","",icon=icon("search","fa-3x"),lib="font-awesome")),
fluidRow(
tags$h5("Patient Finder")
)),
column(width=10,align="left",div(style = "height:20px;"),
"Search for a patient directly or identify a cohort: query the EHR for a certain patient or find all patients that meet any criteria concept available from the CDM of any modality (e.g., Condition, Procedure). Cohorts can be futher filtered by demographic features (e.g., age range, self-reported race), visualized, and exported.")
),
fluidRow(
column(width=2,div(style = "height:20px;"),
fluidRow(
actionButton("gotoReport", "",icon=icon("address-card","fa-3x"),lib="font-awesome")),
fluidRow(
tags$h5("Overall Report")
)),
column(width=10,align="left",div(style = "height:20px;"),
"Generate overall report of a selected patient's clinical history: this report will provide a chronological history of all events of all data modalities (e.g., Observations, Medications). Can filter by specific concepts and export.")
),
fluidRow(
column(width=2,div(style = "height:20px;"),
fluidRow(
actionButton("gotoInteractive", "",icon=icon("mouse-pointer","fa-3x"),lib="font-awesome")),
fluidRow(
tags$h5("Encounter Timeline")
)),
column(width=10,align="left",div(style = "height:20px;"),
"Interact and explore a selected patient's clinical encounter and visit timeline: investigate and visualize clinical events by visit occurrence. Selecting a visit in the interactive timeline will detail all associated clinical events. Can filter by visit (e.g., Outpatient) and admitting/dischanrge types.")
),
fluidRow(
column(width=2,div(style = "height:20px;"),
fluidRow(
actionButton("gotoExplorer", "",icon=icon("wrench","fa-3x"),lib="font-awesome")),
fluidRow(
tags$h5("Data Explorer")
)),
column(width=10,align="left",div(style = "height:20px;"),
"Explore patterns of clinical events over time: for a selected patient, can view all data measured for categorical (e.g., Medications, Devices) and numeric (e.g., Measurement, Observation) types over time. Cateogrial variables displayed in a timeline and can be filtered for what is shown. Numeric variables are displayed as a timeseries which the user can interact with. \n
Targeted view provides an in-depth graph of one variable at a time while the Multiplex view allows for simulaneous and linked exploration of multiple variables.")
)
) # end utilities row
) # end utilities column
)) # end shinyjs:hidden
) #end fluidRow
) # end fluidPage
) # end mainPanel
), # end tabpanel Home
tabPanel("Patient Finder",
############# FINDER tab
style = "width:100%; margin-left:250px; margin-right:200px",
mainPanel(
div(id="login_message_finder",
tags$h4("Please log in to contunue.")
),
shinyjs::hidden(
div(id="finder_open",
fluidRow(align="center",tags$h4("Patient Finder"),hr(width=100)),
fluidRow(
column(width = 5,
tags$p(align = "Left","Search for patients directly or based on clinical criteria (e.g., Condition ICD-10CM code). By selecting 'Criteria', all available ontologies will be displayed per modality which the user can use for searching. This will load demographic information for matching patients to allow for further refining.")
),
column(width = 3,
radioButtons("finder_type", "Search Mode:",
choices = c("Search by Patient" = "pt_search",
"Search by Criteria" = "criteria_search"))
),
column(width = 4,
shinyjs::hidden ( # initialized as hidden, but show b/c of server function
div(id="pt_search_open",
fluidRow(
textInput(inputId = "pt_search_bar_finder",
label="",
placeholder = "Enter Patient ID...")),
fluidRow(disabled(actionButton(inputId = "pt_search_button_finder",
label = "Search")))
)) # end shinyjs::show
)
), # end top row
fluidRow( # main criteria row
shinyjs::hidden (
div(id="criteria_search_open",
tags$h4(align="left","Criteria (select from table):"),
fluidRow(
column(width=3,
pickerInput(
inputId = "finder_domain_picker",
label = "Select Domain",
choices = c("Condition","Device","Drug","Measurement","Observation","Procedure"),
selected = "Condition"
)
),
column(width=3,
pickerInput(
inputId = "finder_vocab_picker",
label = "Select Vocabulary",
choices = "",
options = list(
`actions-box` = TRUE,
size = 25,
`selected-text-format` = "count = 1"
),
multiple = TRUE
)
),
column(width=3,
pickerInput(
inputId = "finder_class_picker",
label = "Select Concept Class",
choices = "",
options = list(
`actions-box` = TRUE,
size = 25,
`selected-text-format` = "count = 1"
),
multiple = TRUE
)
),
column(width = 2,style="padding-top:20px;",
actionButton(inputId = "criteria_select_all_button_finder",
label = "Select All")
),
column(width = 1,style="padding-top:20px;",
actionButton(inputId = "criteria_select_none_button_finder",
label = "None")
)
), # end picker Row
column(width = 12,
DT::dataTableOutput('finder_term_picker')
)
)) # end criteria shinyjs
),# end criteria row
shinyjs::hidden (
div(id="criteria_search_text_open",
fluidRow(
uiOutput("selected_criteria_options")
)
)), # end shinyjs:hidden # selected criteria_text
shinyjs::hidden (
div(id="pts_found_open",
fluidRow(
uiOutput("pts_found_display")
)
)) # end pts_found shinyjs:hidden
)) # end shinyjs:hidden
) # end mainPanel
), # end Finder
tabPanel("Overall Report",
############# REPORT tab
style = "width:100%; margin-left:250px; margin-right:200px",
mainPanel(
div(id="login_message_report",
tags$h4("Please log in to contunue.")
),
shinyjs::hidden(
div(id="report_open",
fluidRow(align="center",uiOutput("overall_title"),hr(width=100)),
fluidRow(
uiOutput("report_pt_info"),
hr()
), #end fluidRow
fluidRow(
uiOutput("report_pt_filter"),
hr()
), #end fluidRow
fluidRow(
DT::dataTableOutput("report_table")
) #end fluidRow
))# end shinyjs Report
) # end mainPanel
), # end Report
tabPanel("Encounter Timeline",
############# TIMELINE tab
style = "width:100%; margin-left:250px; margin-right:200px",
mainPanel(
div(id="login_message_timeline",
tags$h4("Please log in to contunue.")
),
shinyjs::hidden(
div(id="timeline_open",
fluidRow(align="center",uiOutput("timeline_title"),hr(width=100))
,
fluidRow(
uiOutput("timeline_filter_options")
)
,
shinyjs::hidden(
div(id = "encounter_selected_info_panel",
fluidRow(uiOutput("encounter_info_text")),
fluidRow(
tabsetPanel(id = 'encounter_tables',
tabPanel("Conditions",
tags$br(),
DT::dataTableOutput("encounter_conditions_table")),
tabPanel("Devices",
tags$br(),
DT::dataTableOutput("encounter_devices_table")),
tabPanel("Measurements",
tags$br(),
DT::dataTableOutput("encounter_measurements_table")),
tabPanel("Medications",
tags$br(),
DT::dataTableOutput("encounter_medications_table")),
tabPanel("Observations",
tags$br(),
DT::dataTableOutput("encounter_observations_table")),
tabPanel("Procedures",
tags$br(),
DT::dataTableOutput("encounter_procedures_table"))
)
)
)) #end shinyjs
)) # end shinyjs Timeline
) #end mainPanel
), # end Timeline
tabPanel("Data Explorer",
############# DATA EXPLORER tab
div(id="login_message_explorer",
tags$h4("Please log in to contunue.")
),
style = "width:100%; margin-left:250px; margin-right:200px",
mainPanel(
shinyjs::hidden(
div(id="explorer_open",
fluidRow(align="center",uiOutput("explorer_title"),hr(width=100)),
fluidRow(
column(width =3,
uiOutput("explorer_radio_buttons")
),
column(width=9,
uiOutput("explorer_description")
)
),
fluidRow(
hr(),
uiOutput("explorer_data")
)
)) # end shinyjs Explorer
) # end mainPanel
), # end Explorer
navbarMenu("More",
tabPanel("Help",
style = "width:100%; margin-left:250px; margin-right:200px",
mainPanel(
fluidRow(align="center",tags$h4("Help"),hr(width=100)),
fluidRow(tags$h5("Step-by-step instructions for all pages by section below.")),
fluidRow(tags$p("For further help, please contact Ben Glicksberg at [email protected]")),
tags$br(),
tabsetPanel(id = 'help_pages',
tabPanel("Home/Login",
tags$br(),
fluidPage(
fluidRow(
column(width=5,
tags$img(src = "images/Home/home1.png", width = '400px')),
column(width=7,
tags$b("Main App Screen"),
tags$br(),
tags$ol(
tags$li("Tab panel for navigating app"),
tags$li("Go to help page (this page)"),
tags$li("Learn more about our group and the application, data sources, and data format"),
tags$li("Instructions for how to download, install, and configure app for your EHR data"),
tags$li("Instructions for how to run the sandbox server")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5, align = 'center',
tags$img(src = "images/Home/home2.png", width = '275px', height = '500px')),
column(width=7,
tags$b("Login Fields"),
tags$br(),
tags$ol(
tags$li("All criteria to enable connecting to EHR data"),
tags$li("Username field (not required if not necessary to connect to database)"),
tags$li("Password field (not required if not necessary to connect to database)"),
tags$li("Host field (required): For MySQL this is typically a server address, but in other formats (e.g., PostgreSQL), this can be 'server/database'"),
tags$li("Database field (required): For MySQL this is the database itself. For PostgreSQL this is the schema."),
tags$li("Driver type (required): Relational database structure in which EHR data are stored (see below for more details)"),
tags$li("Port for connection (not required)"),
tags$li("Saves current credentials that are entered into the credentials .Renviron file (see Configuration page for more details) in the specified path (see #11). Note this button is disabled for the public sandbox webserver."),
tags$li("Loads credentials into respective field from credentials .Renviron file (see Configuration page for more details). Will only load fields that adhere to these formatting guidelines. This button will only be enabled if an .Renviron file can be found in the current specified path (see #11)."),
tags$li(HTML("Set directory for credentials: Uses <a href= 'https://github.com/wleepang/shiny-directory-input'>DirectoryInput package </a> for selecting directory with credentials file. Credentials are saved in an .Renviron file (see Configuration page for more details). Note this button is disabled for the public sandbox webserver.")),
tags$li("Login/Logout buttons")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5, align = 'center',
tags$img(src = "images/Home/home3.png", width = '200px', height = '350px')),
column(width=7,
tags$b("Login Fields"),
tags$br(),
tags$ol(
tags$li(HTML("Connections can be made to various relational database formats. For MySQL, connection is made through the <a href = 'https://cran.r-project.org/web/packages/DBI/index.html'> DBI </a> package and <a href = 'https://cran.r-project.org/web/packages/RMySQL/index.html'> RMySQL </a> driver For all others, the OHDSI group's <a href = 'https://github.com/OHDSI/DatabaseConnector'> DatabaseConnector </a>, <a href = 'https://github.com/OHDSI/DatabaseConnectorJars'> DatabaseConnectorJars </a> (drivers), and <a href = 'https://github.com/OHDSI/SqlRender'> SqlRender </a> packages are utilized."))
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5, align = 'center',
tags$img(src = "images/Home/home4.png", width = '200px', height = '350px')),
column(width=7,
tags$b("Login Fields"),
tags$br(),
tags$ol(
tags$li("Loads available credentials from .Renviron file"),
tags$li("Click to begin login process. This will check if connection to OMOP server can be made and if the OMOP tables exist. The app will not continue if required tables are missing. A warning message will be appear if tables are empty (but the app will still be able to run). Once these criteria are met, the app will load the data ontology (and save it if it doesn't exist in the specified direcotry) as well as patient demographic information.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5, align = 'center',
tags$img(src = "images/Home/home5.png", width = '275px', height = '300px')),
column(width=7,
tags$b("Section Selections"),
tags$br(),
tags$ol(
tags$li(HTML("Click to get to this Help page.")),
tags$li("Patient Finder can be used for cohort querying and basic plots and information. Select a certain patient for other sections"),
tags$li("Requires a patient selected from #2. Interactive report of all clinical data generated as well as an automated clinical summary."),
tags$li("Requires a patient selected from #2. Intearactive timeline plot of clinical encounters as well as frequency plots."),
tags$li("Requires a patient selected from #2. The ability to explore finegrain details about patient clinical variables over time.")
)
)
)
) #end fluidPage
), # end Home help tab
tabPanel("Patient Finder",
tags$br(),
fluidPage(
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder1.png", width = '400px')),
column(width=7,
tags$b("Main Finder Screen"),
tags$br(),
tags$ol(
tags$li("Search for patients either directly or by clinical criteria (mix-and-match of any type; details below). Searching for a patient will load all relevant clinical and encounter data for subsequent sections.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder2.png", width = '400px')),
column(width=7,
tags$b("Direct Search"),
tags$br(),
tags$ol(
tags$li("Sample generated patient for use in this example (see About section for more details)."),
tags$li("Search for patient: direct search will first check if patient exists and load all data if so.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder3.png", height = '200px', width = '400px')),
column(width=7,
tags$b("Criteria Search"),
tags$br(),
tags$ol(
tags$li("Can search by all concepts contained in the CDM. Can first filter by Domain."),
tags$li("Can also filter by vocabulary"),
tags$li("Can also filter by concept class"),
tags$li("Concepts can be searched for in the search box"),
tags$li("Concepts can be selected by clicking the items in the table. This shows all concepts available based on the criteria above." ),
tags$li("Can browse concept table by clicking the Next and Previous buttons" )
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder4.png", height = '200px', width = '400px')),
column(width=7,
tags$b("Criteria Search Continued"),
tags$br(),
tags$ol(
tags$li("Vocabularies (and Concept Classes) are filtered by the previous selection. In this case, ICD10CM, ICD9CM, and SNOMED concepts can be selected as available from the Condition domain.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder5.png", height = '200px', width = '400px')),
column(width=7,
tags$b("Criteria Search Continued"),
tags$br(),
tags$ol(
tags$li("Specific codes/concepts can be searched for (e.g., ICD10CM: K51) which filters the concept table by relevant fields"),
tags$li("The Select All button will automatically select all concepts (in this case n=64) that are filtered based on criteria"),
tags$li("The None button unselects all concepts within the filtered list"),
tags$li("The criteria filtering limits the concept space by domain (can add different types)")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder6.png", height = '175px', width = '400px')),
column(width=7,
tags$b("Criteria Search Continued"),
tags$br(),
tags$ol(
tags$li("List of all criteria selected from above. Multiple types can be included here "),
tags$li("Table of all selected critera by term and vocabulary. Use Next and Previous to browse"),
tags$li("Select an item from the Selected Criteria table and click this button to remove item from selected list."),
tags$li("Reset Search will remove all selected criteria"),
tags$li("Search Type: 'or' will identify a cohort that meet EITHER of ay of the selected criteria; 'and' will require all conditions (i.e., concepts) met."),
tags$li(HTML("Search Strategy: Direct will search for the concept directly terms directly (using the _source columns); Mapped (recommended) will first map terms to common ontology (e.g., SNOMED) and find/include all descendent concepts in search (see <a href = 'https://github.com/BenGlicksberg/ROMOP'> ROMOP package </a> for more detials).")),
tags$li("Click to begin searching for cohort based on selection criteria/strategies")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder7.png", height = '350px', width = '400px')),
column(width=7,
tags$b("Criteria Search Cohort"),
tags$br(),
tags$ol(
tags$li("Table of all selected patients in cohort. Can filter cohort below by any demographic feature (automatically adjusts table and plots; see below for more details)"),
tags$li("Table can be sorted by clicking on columns and can show different amounts of entries per page. "),
tags$li("Table can be filtered by any demographic filter options by selecting subsets below column name."),
tags$li("Lists number of patients in filtered cohort"),
tags$li("Navigate the cohort table by these control buttons"),
tags$li("Can export/save cohort demographic table into a .csv file for utility in other programs."),
tags$li("Show plots of demographic features for cohort. Dynamically changed based on filter options"),
tags$li("Other sections of the app require a patient to be selected. Clicking on the seach button for patient in the row begins the search process.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder8.png", height = '200px', width = '400px')),
column(width=7,
tags$b("Selected Cohort Plots"),
tags$br(),
tags$ol(
tags$li("Hide plots"),
tags$li("Dynamic and interactive (hoverable for tooltip text) plots of demographic features for selected cohort. Automatically altered based on filter options. Can be exported by hovering over the plot and clicking the plotly button for 'Download plot as png' ")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Finder/finder9.png", height = '150px', width = '400px')),
column(width=7,
tags$b("Patient Search from Selected Cohort"),
tags$br(),
tags$ol(
tags$li("Filtering cohort subsets table below. In this example, 'Male' patients are selected only in addition to an age range."),
tags$li("The second row is our patient of interest"),
tags$li("Click on the Search button in the last column: retrieves all clinical and encounter data for selected patient for use in other sections")
)
)
)
) # end fluidpage
), #end Finder help tab
tabPanel("Patient Report",
tags$br(),
fluidPage(
fluidRow(
column(width=5,
tags$img(src = "images/Report/report1.png",width = '400px')),
column(width=7,
tags$b("Main Report Screen"),
tags$br(),
tags$ol(
tags$li("Demographic background for selected patient (in this case patient id 9000000)"),
tags$li("Automatically generated clinical report for selected patient. Inlcudes information such as time in EHR, number of encounters (and by type), and clinical modalitiy entries (and by type).")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Report/report2.png", height = '350px')),
column(width=7,
tags$b("Patient Report"),
tags$br(),
tags$ol(
tags$li("Table of all clinical concepts recorded for selected patient. Includes formatted data for all domains and organized by Date, Type (i.e., domain), Event (i.e., concept), and Value (if available; e.g. Measurement value)."),
tags$li("Browse entries in table"),
tags$li("Selet Data Modalities (i.e., domains) to include in report. Selections here will filter items from report table as well as filter options in #4 (i.e., will not display any items for domain if domain not selected)"),
tags$li("Filter specific concepts/items per modalitiy to include in report"),
tags$li("Can export all clinical data for given patient in .csv file for use in other programs or for further work")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Report/report3.png", height = '350px')),
column(width=7,
tags$b("Patient Report Options"),
tags$br(),
tags$ol(
tags$li("Select modalities (i.e., domains) to include in report")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Report/report4.png", height = '350px')),
column(width=7,
tags$b("Patient Report Options Continued"),
tags$br(),
tags$ol(
tags$li("Unselected modalities will not be included in report."),
tags$li("Specific items in each modalitiy can be selected/unselected (in this case within Measurements)"),
tags$li("In addition to entire modalities, specific items unselected within each will not be included in the report"),
tags$li("The export button will save a .csv list of the filtered report")
)
)
)
) #end fluidPage
), #end Report help tab
tabPanel("Encounter Timeline",
tags$br(),
fluidPage(
fluidRow(
column(width=5,
tags$img(src = "images/Timeline/timeline1.png",width = '400px')),
column(width=7,
tags$b("Main Timeline Screen"),
tags$br(),
tags$ol(
tags$li("All encounter infomration for selected patient (in this case patient id 9000000). Clicking radiobuttonss under Plot Encounters will produce bar plots breakdown for selected type (e.g., Visit Types)"),
tags$li(HTML("Select items from these fields will automatically generate and produce an interactive timeline visualization built using the <a href = 'https://github.com/daattali/timevis'>timevis package </a>. "))
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=5,
tags$img(src = "images/Timeline/timeline2.png", width = '400px')),
column(width=7,
tags$b("Timeline options"),
tags$br(),
tags$ol(
tags$li("All options here are from what is available for the selected patient based on his/her encounter history. Selecting from these list will add all encounters of these types to the timeline.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Timeline/timeline3.png", width = '400px')),
column(width=6,
tags$b("Timeline Options Continued"),
tags$br(),
tags$ol(
tags$li("Inveractive timeline visualization of encounters for selected patient. Can scroll left and right, zoom in and out, and select items by clicking on them. Encounter items are described by their Visit Type text"),
tags$li("All Visit Types (e.g., Inpatient Visit) selected in the dropdown are included in the visualization plot"),
tags$li("All Admitting Concept Types (e.g., Inpatient Hospital) selected in the dropdown are included in the visualization plot"),
tags$li("All Discharge Concept Types (e.g., Home) selected in the dropdown are included in the visualization plot")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Timeline/timeline4.png", width = '400px')),
column(width=6,
tags$b("Timeline Selections"),
tags$br(),
tags$ol(
tags$li("Buttons to automatically navigate timeline. Fit All Encounters will navigate the timeline to put all items on screen (note this can increase height of plot by a lot). Focus Past Year will focus the timeline to the previous year (e.g., 2017)."),
tags$li("All encounter items in the timeline can be selected. Here the third Outpatient Visit is selected for the current patient. Clicking on the timeline item populates information about the encounter below."),
tags$li("All information covered in the timeline for the encounter is displayed in the Encounter Information section"),
tags$li("All clinical data recorded during the encounter is contained within a table separated by tabs of each domain."),
tags$li("These tables contain pre-selected columns pertinent to the selected domain (e.g., 'Condition Status Type' for Condition) "),
tags$li("Clicking CSV or Excel buttons on each tab will allow for downloading the table in the affiliated format.")
)
)
)
)# end fluidPage
), #end Timeline help tab
tabPanel("Data Explorer",
tags$br(),
fluidPage(
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer1.png",width = '450px')),
column(width=6,
tags$b("Main Explorer Screen"),
tags$br(),
tags$ol(
tags$li("The Data Explorer section allows users to explore trends in categorical and numeric clinical data for a selected patient (in this case patient id 9000000). There are 3 ways in which to explore: i) Targeted: one modality at a time; ii) Multiplex: multiple modalities plotted along the same x-axis (i.e., time); and iii) Multiplex Timeline: multiple modalities plotted on a grouped timeline visualization. ")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer2.png", width = '650px')),
column(width=6,
tags$b("Targeted Explorer: Categorical"),
tags$br(),
tags$ol(
tags$li("The Targeted explorer option plots data based on clinical modality at a time (e.g. Conditions or Measurements). For all categorical data (Conditions, Devices, Medications, and Procedures), these are plotted as an interactive timeline. "),
tags$li("For the timeline there are two view types possible: Event will display each item as a single time point; Range will plot the item from start-to-end period if that information exists (note these are not always accurate) "),
tags$li("Users can select items of each modality from the dropdown to include in the plot. Only concepts recorded for the selected patient are available.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer3.png", width = '425px')),
column(width=6,
tags$b("Targeted Explorer: Categorical"),
tags$br(),
tags$ol(
tags$li("Timeline visualization automatically produced containing elements selected in the dropdown list in #2. As with other timelines, this is completely interactive."),
tags$li("Only items from the dropdown list are included in the timeline. These items are populated directly from patient-speicific concepts.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer4.png", width = '425px')),
column(width=6,
tags$b("Targeted Explorer: Categorical"),
tags$br(),
tags$ol(
tags$li("If Range option View Type is selected, the concept items in the timeline are displayed based on a range if available "),
tags$li("For items without an end date, they are still displayed as an Event (or single time point)"),
tags$li("Items with a range (e.g., Ulcerative Colitis) are displayed as a bar across the time period")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer5.png", width = '425px')),
column(width=6,
tags$b("Targeted Explorer: Categorical"),
tags$br(),
tags$ol(
tags$li("All items in the timeline can be selected by clicking"),
tags$li("Information pertaining to the selected concept are displayed")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer6.png", width = '425px')),
column(width=6,
tags$b("Targeted Explorer: Numeric"),
tags$br(),
tags$ol(
tags$li("Domains that contain numeric data, specifically Measurements and Observations (although the latter is a mix), are first displayed as a frequency table with the number of recorded events for each item."),
tags$li("Items in the frequency table can be selected by clicking to automatically produce a line plot")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer7.png", width = '425px')),
column(width=6,
tags$b("Targeted Explorer: Numeric"),
tags$br(),
tags$ol(
tags$li("Select an item from the frequency table to view trends over time for that data concept ('C reactive protein [Mass/volume] in Serum or Plasma' selected in this case)"),
tags$li("An interactive line plot of all data points for the selected patients in the selected data concept is automatically produced"),
tags$li("High/Low values are automatically colored and coded based on the internal range system"),
tags$li("Hovering over each data point displays the value")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer8.png", width = '425px')),
column(width=6,
tags$b("Multiplex Explorer Mode"),
tags$br(),
tags$ol(
tags$li("Multiplex mode: display multiple types of data on the same time scale plot"),
tags$li("Categorical data can be selected in which items are displayed as a dot plot"),
tags$li("Numerical data can be selected in which terms are displayed as a line plot")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer9.png", width = '425px')),
column(width=6,
tags$b("Multiplex Explorer Mode Continued"),
tags$br(),
tags$ol(
tags$li("Numeric data types (Measurements and Observations) can be selected based on what was measured for the selected patient"),
tags$li("Categorical data types (all others) can be selected in the same fashion")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer10.png", width = '425px')),
column(width=6,
tags$b("Multiplex Explorer Mode Continued"),
tags$br(),
tags$ol(
tags$li("The interactive multiplex plot is populated with selected items. Users can zoom in by clicking and dragging a section. All other items are then zoomed in at the same scale. Double clicking returns to original scale. Plots can be downloaded by hovering over the image and selecting 'Download plot as png'."),
tags$li("All items selected above are displayed in the legend. Categorical data are as dot plots on the top.")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer11.png", width = '425px')),
column(width=6,
tags$b("Multiplex Timeline Explorer Mode"),
tags$br(),
tags$ol(
tags$li("In the Multiplex Timeline Explorer mode, multiple types of data are displayed on the same time scale in a timevis plot."),
tags$li("All data types can be selected and included based on data available from the selected patient")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer12.png", width = '425px')),
column(width=6,
tags$b("Multiplex Timeline Explorer Mode Continued"),
tags$br(),
tags$ol(
tags$li("Categorical data can be selected like before"),
tags$li("Numeric data can be selected as well like before")
)
)
),
tags$br(),
tags$hr(),
fluidRow(
column(width=6,
tags$img(src = "images/Explorer/explorer13.png", width = '425px')),
column(width=6,
tags$b("Multiplex Timeline Explorer Mode Continued"),
tags$br(),
tags$ol(
tags$li("All selected items for the selected patient are displayed in a timevis plot grouped by domain. This is interactive with the same options available as before"),
tags$li("Data can be viewed as an Event or Range as before"),
tags$li("All data items can be selected by clicking"),
tags$li("Information for the selected data item are displayed above the plot")
)
)
)
) #end fluidPage
) #end Explorer help tab
) #end help_pages Tabset panel
) #end Help section mainPanel
), #end Help section tab
tabPanel("About",
fluidRow(align="center",tags$h4("About"),hr(width=100)),
tags$br(),
style = "margin-left:250px; max-width:1000px; margin-right:250px",
tags$h5("Manuscript Information"),
tags$p("TBD"),
tags$br(),
tags$h5("Sandbox Server"),
p(HTML("The Centers for Medicare and Medicaid Services (CMS) have released a synthetic clinical dataset <a href='https://www.cms.gov/Research-Statistics-Data-and-Systems/Downloadable-Public-Use-Files/SynPUFs/DE_Syn_PUF.html'>DE-SynPUF</a> in the public domain with the aim of being reflective of the patient population but containing no protected health information. The OHDSI group has underwent the task of converting these data into the <a href='https://github.com/OHDSI/ETL-CMS'>OMOP CDM format </a>. Users are certainly able to set up this configuration on their own system following the instructions on the GitHub page. We obtained all data files from the <a href='ftp://ftp.ohdsi.org/synpuf'> OHDSI FTP server</a> (accessed June 17th, 2018) and created the CDM (DDL and indexes) according to their <a href = 'https://github.com/OHDSI/CommonDataModel/tree/master/PostgreSQL'>official instructions</a>, but modified for MySQL. For space considerations, we only uploaded one million rows of each of the data files. The sandbox server is a Rshiny server running as an Elastic Compute Cloud (EC2) instance on Amazon Web Services (AWS) querying a MySQL database server (AWS Aurora MySQL). ")),
tags$br(),
tags$h6("Example Patient"),
p(HTML("As the DE-SynPUF data does not contain patient measurement results, we generated a profile for a patient with Chron's Disease with representative clinical data (e.g., disease codes and lab test results) for illustrative purposes. Users can recreate this example patient using the script <a href = 'https://github.com/BenGlicksberg/PatientExploreR/blob/dev/data/new_pt_insert_commands.txt'> found here </a>. The script is formatted for a MySQL database.")),
tags$h5("Who We Are"),
p(HTML("PatientExploreR was created by Benjamin Glicksberg ([email protected]) while working as a post-doctoral scholar in the lab of <a href = 'http://buttelab.ucsf.edu/'> Dr. Atul Butte </a> at UCSF within the <a href = 'http://bakarinstitute.ucsf.edu/'>Bakar Computaitonal Health Sciences Institute </a>. This project was a collaboration between many individuals (see Manuscript Information) from UCSF, Columbia University, and the Icahn School of Medicine at Mount Sinai.")),
tags$hr()
),
tabPanel("Configuration",
fluidRow(align="center",tags$h4("Configuration"),hr(width=100)),
tags$br(),
style = "margin-left:250px; max-width:1000px; margin-right:250px",
tags$h5("Source Files"),
p(HTML("<a href = 'https://github.com/BenGlicksberg/PatientExploreR'> GitHub Repository </a>")),
tags$br(),
tags$h5("Requirements"),
tags$ul(
tags$li("Personal Computer or Server with connection to internet"),
tags$li("R"),
tags$li("All required packages (see Install.R)"),
tags$li("Database software (either: MySQL, PostgreSQL, Amazon Redshift, Microsoft SQL Server, Microsoft Parallel Data Warehouse, Google BigQuery"),
tags$li("Access to Electronic Health Record data (recommended for use with a de-identified version) that is properly formatted to OMOP Common Data Model v5")
),
tags$h5("Installation"),
tags$ol(
tags$li("Download app from GitHub (see Source Files)"),
tags$li("Navigate to directory and run Install.R (Rscript Install.R) to install all required packages"),
tags$li("(Optional) Create .Renviron file in directory with database credentials (Note: this can be done in the app itself). See section below for formatting this file."),
tags$li("Open app using either Rstudio (Run App) or from command line: R -e \"shiny::runApp('PatientExploreR.R')\", then navigate to the IP address after \"Listening on…\" using a web browser.")
),
tags$br(),
tags$h6("Storing credentials"),
HTML("For quick connection, users can quickly load and save their credentials to connect to EHR database within an R environment file (.Renviron). Either this file can be created after the credentials are entered in the input fields (Save Credentials button) which will automatically create this file in the directory of interest. Alternatively, users can create an .Renviron file the project directory in the following format:<br>
driver = ' ' <br>
host = ' ' <br>
username= ' ' <br>
password = ' ' <br>
dbname = ' ' <br>
port = ' '<br>
<br>
Full instructions on these connection parameters can be found from the OHDSI consortium's <a href= 'https://github.com/OHDSI/DatabaseConnector'> Database Connector <\a> GitHub page.")
)
)