-
Notifications
You must be signed in to change notification settings - Fork 33
/
02-rstudio-ohdsi.yaml
796 lines (744 loc) · 71 KB
/
02-rstudio-ohdsi.yaml
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
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License.
# A copy of the License is located at
# http://aws.amazon.com/apache2.0/
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions and limitations under the License.
AWSTemplateFormatVersion: '2010-09-09'
Description: This CloudFormation Template deploys a complete OHDSI environment. It
depends on the OHDSI-VPC CloudFormation Template.
Parameters:
# VpcId:
# Type: AWS::EC2::VPC::Id
# Description: VPC this server will reside in
VPCSubnet:
Description: The subnet in which you want your R-Studio server to be deployed.
Type: AWS::EC2::Subnet::Id
VPCId:
Type: AWS::EC2::VPC::Id
RStudioSecurityGroup:
Description: The Security Group you want to use to contorl access to your R-Studio Server.
Type: AWS::EC2::SecurityGroup::Id
HomeDirectorySize:
Description: The amount of encrypted disk space, in GBs, allocated to store R-Studio user's local data.
Type: Number
Default: 20
InstanceType:
Type: String
Description: Instance type for the R-Studio server.
AllowedValues:
- t2.medium
- t2.large
- t2.xlarge
- t2.2xlarge
- t3.medium
- t3.large
- t3.xlarge
- t3.2xlarge
- m4.large
- m4.xlarge
- m4.2xlarge
- m4.4xlarge
- m4.10xlarge
- m4.16xlarge
- m5.large
- m5.xlarge
- m5.2xlarge
- m5.4xlarge
- m5.12xlarge
- m5.24xlarge
- c4.large
- c4.xlarge
- c4.2xlarge
- c4.4xlarge
- c4.8xlarge
- c5.large
- c5.xlarge
- c5.2xlarge
- c5.4xlarge
- c5.9xlarge
- c5.18xlarge
- r4.large
- r4.xlarge
- r4.2xlarge
- r4.4xlarge
- r4.8xlarge
- r4.16xlarge
- r5.large
- r5.xlarge
- r5.2xlarge
- r5.4xlarge
- r5.8xlarge
- r5.16xlarge
- g2.2xlarge
- g2.8xlarge
- p2.xlarge
- p2.8xlarge
- p2.16xlarge
- g3.4xlarge
- g3.8xlarge
- g3.16xlarge
ConstraintDescription: Valid instance type in the t2, t3, m5, c5, r4, g2, p2, and g3 families
Default: t2.xlarge
UserList:
Description: Provide a comma separated list of usernames and passwords (user1,pass1,user2,pass2) to create on the R-Studio Server.
Type: 'String'
NoEcho: true
Default: 'rstudio,yourRSTUDIOpassword1'
KeyPair:
Description: The EC2 Key Pair to use for the Atlas/WebAPI EC2 Instances.
Type: AWS::EC2::KeyPair::KeyName
RStudioInstanceProfile:
Type: String
RDSEndpoint:
Type: String
RedshiftEndpoint:
Type: String
EBEndpoint:
Description: "The unique name to use for your Elastic Beanstalk URL (will be rendered http://(EBEndpoint).(region).elasticbeanstalk.com)"
Type: String
DatabaseMasterPassword:
Description: Must be letters (upper or lower), numbers, spaces, and these special characters `~#$%^&*()_+,-
Type: String
NoEcho: true
AllowedPattern: ^([a-zA-Z0-9`~#$%^&*()_+,\\-])*$
ConstraintDescription: The Amazon RDS master password. Letters, numbers, spaces, and these special characters `~#$%^&*()_+,-
Sources:
Description: Comma-delimited list of OMOP CDM schema sources to load into the Redshift datawarehouse
Type: String
AllowedPattern: ^([a-zA-Z0-9,])*$
Default: CMSDESynPUF1k,CMSDESynPUF23m
PatientLevelPredictionv:
Description: OHDSI PatientLevelPrediction GitHub branch you want deployed (this specifies the version)
Type: String
Default: '2.0.2'
CohortMethodv:
Description: OHDSI CohortMethod GitHub branch you want deployed (this specifies the version)
Type: String
Default: '2.6.2'
SqlRenderv:
Description: OHDSI SqlRender GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.4.10'
DatabaseConnectorv:
Description: OHDSI DatabaseConnector GitHub branch you want deployed (this specifies the version)
Type: String
Default: '2.1.0'
DatabaseConnectorJarsv:
Description: OHDSI DatabaseConnectorJars GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.0.0'
OhdsiRToolsv:
Description: OhdsiRTools GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.5.3'
FeatureExtractionv:
Description: OHDSI FeatureExtraction GitHub branch you want deployed (this specifies the version)
Type: String
Default: '2.0.2'
Cyclopsv:
Description: OHDSI Cyclops GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.3.1'
EmpiricalCalibrationv:
Description: OHDSI EmpiricalCalibration GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.3.6'
OhdsiSharingv:
Description: OHDSI OhdsiSharing GitHub branch you want deployed (this specifies the version)
Type: String
Default: '0.1.3'
Achillesv:
Description: OHDSI Achilles GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.5.0'
MethodEvaluationv:
Description: OHDSI MethodEvalution GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.0.1'
Hydrav:
Description: OHDSI Hydra GitHub branch you want deployed (this specifies the version)
Type: String
Default: '0.0.4'
PredictionComparisonv:
Description: OHDSI Hydra GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.0.0'
Eunomiav:
Description: OHDSI Eunomia GitHub branch you want deployed (this specifies the version)
Type: String
Default: '0.0.1'
Andromedav:
Description: OHDSI Andromeda GitHub branch you want deployed (this specifies the version)
Type: String
Default: '0.4.0'
BigKNNv:
Description: OHDSI Andromeda GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.0.0'
SelfControlledCaseSeriesv:
Description: OHDSI SelfControlledCaseSeries GitHub branch you want deployed (this specifies the version)
Type: String
Default: '2.0.0'
SelfControlledCohortv:
Description: OHDSI SelfControlledCohort GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.5.0'
EvidenceSynthesisv:
Description: OHDSI EvidenceSynthesis GitHub branch you want deployed (this specifies the version)
Type: String
Default: '0.2.3'
CohortDiagnosticsv:
Description: OHDSI CohortDiagnostics GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.2.7'
Hadesv:
Description: OHDSI Hades GitHub branch you want deployed (this specifies the version)
Type: String
Default: '1.0.0'
Mappings:
RegionMap:
us-east-1:
AMI: ami-0d5eff06f840b45e9
us-east-2:
AMI: ami-0443305dabd4be2bc
us-west-1:
AMI: ami-04468e03c37242e1e
us-west-2:
AMI: ami-0cf6f5c8a62fa5da6
ca-central-1:
AMI: ami-0101734ab73bd9e15
eu-west-1:
AMI: ami-063d4ab14480ac177
eu-west-2:
AMI: ami-06dc09bb8854cbde3
eu-west-3:
AMI: ami-0b3e57ee3b63dd76b
eu-central-1:
AMI: ami-043097594a7df80ec
sa-east-1:
AMI: ami-05373777d08895384
ap-south-1:
AMI: ami-010aff33ed5991201
ap-southeast-1:
AMI: ami-02f26adf094f51167
ap-southeast-2:
AMI: ami-0186908e2fdeea8f3
ap-northeast-1:
AMI: ami-0ca38c7440de1749a
ap-northeast-2:
AMI: ami-0f2c95e9fe3f8f80e
ap-northeast-3:
AMI: ami-056314235f4f5d523
Resources:
SageMakerRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- sagemaker.amazonaws.com
Action:
- sts:AssumeRole
Path: /
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/AmazonSageMakerFullAccess"
RStudioInstance:
Type: AWS::EC2::Instance
Metadata:
AWS::CloudFormation::Init:
config:
files:
/tmp/rdependencies.r:
content: !Sub |
print("Testing to see if R dependency libraries are installed...")
try(if("callr" %in% rownames(installed.packages()) == FALSE){install.packages("callr", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("cli" %in% rownames(installed.packages()) == FALSE){install.packages("cli", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("digest" %in% rownames(installed.packages()) == FALSE){install.packages("digest", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("git2r" %in% rownames(installed.packages()) == FALSE){install.packages("git2r", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("httr" %in% rownames(installed.packages()) == FALSE){install.packages("httr", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("jsonlite" %in% rownames(installed.packages()) == FALSE){install.packages("jsonlite", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("memoise" %in% rownames(installed.packages()) == FALSE){install.packages("memoise", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("pkgbuild" %in% rownames(installed.packages()) == FALSE){install.packages("pkgbuild", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("pkgload" %in% rownames(installed.packages()) == FALSE){install.packages("pkgload", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("processx" %in% rownames(installed.packages()) == FALSE){install.packages("processx", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("rcmdcheck" %in% rownames(installed.packages()) == FALSE){install.packages("rcmdcheck", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("remotes" %in% rownames(installed.packages()) == FALSE){install.packages("remotes", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("rstudioapi" %in% rownames(installed.packages()) == FALSE){install.packages("rstudioapi", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("sessioninfo" %in% rownames(installed.packages()) == FALSE){install.packages("sessioninfo", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("usethis" %in% rownames(installed.packages()) == FALSE){install.packages("usethis", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if("withr" %in% rownames(installed.packages()) == FALSE){install.packages("withr", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("devtools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("devtools") != "2.4.4")){install.packages("https://cran.r-project.org/src/contrib/devtools_2.4.4.tar.gz", repos=NULL, type="source")})
try(if(("remotes" %in% rownames(installed.packages()) == FALSE) || (packageVersion("remotes") != "2.4.2")){devtools::install_version("remotes", version = "2.4.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("aws.signature" %in% rownames(installed.packages()) == FALSE) || (packageVersion("aws.signature") != "0.5.0")){install.packages("aws.signature", version = "0.5.0", repos = "http://cloudyr.github.io/drat", upgrade = "never")})
try(if(("aws.ec2metadata" %in% rownames(installed.packages()) == FALSE) || (packageVersion("aws.ec2metadata") != "0.1.6")){install.packages("aws.ec2metadata", version = "0.1.6", repos = "http://cloudyr.github.io/drat", upgrade = "never")})
try(if(("aws.s3" %in% rownames(installed.packages()) == FALSE) || (packageVersion("aws.s3") != "0.3.20")){install.packages("aws.s3", version = "0.3.20", repos = "http://cloudyr.github.io/drat", upgrade = "never")})
try(if(("acepack" %in% rownames(installed.packages()) == FALSE) || (packageVersion("acepack") != "1.4.1")){devtools::install_version("acepack", version = "1.4.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("askpass" %in% rownames(installed.packages()) == FALSE) || (packageVersion("askpass") != "1.1")){devtools::install_version("askpass", version = "1.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("assertthat" %in% rownames(installed.packages()) == FALSE) || (packageVersion("assertthat") != "0.2.1")){devtools::install_version("assertthat", version = "0.2.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("AUC" %in% rownames(installed.packages()) == FALSE) || (packageVersion("AUC") != "0.3.0")){devtools::install_version("AUC", version = "0.3.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("backports" %in% rownames(installed.packages()) == FALSE) || (packageVersion("backports") != "1.1.4")){devtools::install_version("backports", version = "1.1.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("base64enc" %in% rownames(installed.packages()) == FALSE) || (packageVersion("base64enc") != "0.1-3")){devtools::install_version("base64enc", version = "0.1-3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("BH" %in% rownames(installed.packages()) == FALSE) || (packageVersion("BH") != "1.75.0-0")){devtools::install_version("BH", version = "1.75.0-0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("bit" %in% rownames(installed.packages()) == FALSE) || (packageVersion("bit") != "4.0.4")){devtools::install_version("bit", version = "4.0.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("bitops" %in% rownames(installed.packages()) == FALSE) || (packageVersion("bitops") != "1.0-6")){devtools::install_version("bitops", version = "1.0-6", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("brew" %in% rownames(installed.packages()) == FALSE) || (packageVersion("brew") != "1.0-7")){devtools::install_version("brew", version = "1.0-7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("bslib" %in% rownames(installed.packages()) == FALSE) || (packageVersion("bslib") != "0.4.0")){devtools::install_version("bslib", version = "0.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("caTools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("caTools") != "1.17.1.2")){devtools::install_version("caTools", version = "1.17.1.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("checkmate" %in% rownames(installed.packages()) == FALSE) || (packageVersion("checkmate") != "1.9.3")){devtools::install_version("checkmate", version = "1.9.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("clipr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("clipr") != "0.6.0")){devtools::install_version("clipr", version = "0.6.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("clisymbols" %in% rownames(installed.packages()) == FALSE) || (packageVersion("clisymbols") != "1.2.0")){devtools::install_version("clisymbols", version = "1.2.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("colorspace" %in% rownames(installed.packages()) == FALSE) || (packageVersion("colorspace") != "1.4-1")){devtools::install_version("colorspace", version = "1.4-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("config" %in% rownames(installed.packages()) == FALSE) || (packageVersion("config") != "0.3")){devtools::install_version("config", version = "0.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("cpp11" %in% rownames(installed.packages()) == FALSE) || (packageVersion("cpp11") != "0.4.0")){devtools::install_version("cpp11", version = "0.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("crayon" %in% rownames(installed.packages()) == FALSE) || (packageVersion("crayon") != "1.3.4")){devtools::install_version("crayon", version = "1.3.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("crosstalk" %in% rownames(installed.packages()) == FALSE) || (packageVersion("crosstalk") != "1.0.0")){devtools::install_version("crosstalk", version = "1.0.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("curl" %in% rownames(installed.packages()) == FALSE) || (packageVersion("curl") != "3.3")){devtools::install_version("curl", version = "3.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("data.table" %in% rownames(installed.packages()) == FALSE) || (packageVersion("data.table") != "1.12.2")){devtools::install_version("data.table", version = "1.12.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("DBI" %in% rownames(installed.packages()) == FALSE) || (packageVersion("DBI") != "1.1.1")){devtools::install_version("DBI", version = "1.1.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("desc" %in% rownames(installed.packages()) == FALSE) || (packageVersion("desc") != "1.2.0")){devtools::install_version("desc", version = "1.2.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("deldir" %in% rownames(installed.packages()) == FALSE) || (packageVersion("deldir") != "1.0-6")){devtools::install_version("deldir", version = "1.0-6", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("desc" %in% rownames(installed.packages()) == FALSE) || (packageVersion("desc") != "1.4.2")){devtools::install_version("desc", version = "1.4.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("diagram" %in% rownames(installed.packages()) == FALSE) || (packageVersion("diagram") != "1.6.4")){devtools::install_version("diagram", version = "1.6.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("doParallel" %in% rownames(installed.packages()) == FALSE) || (packageVersion("doParallel") != "1.0.14")){devtools::install_version("doParallel", version = "1.0.14", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("downlit" %in% rownames(installed.packages()) == FALSE) || (packageVersion("downlit") != "0.4.2")){devtools::install_version("downlit", version = "0.4.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("dplyr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("dplyr") != "1.0.4")){devtools::install_version("dplyr", version = "1.0.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("DT" %in% rownames(installed.packages()) == FALSE) || (packageVersion("DT") != "0.7")){devtools::install_version("DT", version = "0.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("evaluate" %in% rownames(installed.packages()) == FALSE) || (packageVersion("evaluate") != "0.14")){devtools::install_version("evaluate", version = "0.14", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("fansi" %in% rownames(installed.packages()) == FALSE) || (packageVersion("fansi") != "0.4.0")){devtools::install_version("fansi", version = "0.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("fastmatch" %in% rownames(installed.packages()) == FALSE) || (packageVersion("fastmatch") != "1.1-0")){devtools::install_version("fastmatch", version = "1.1-0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ff" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ff") != "2.2-14")){devtools::install_version("ff", version = "2.2-14", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ffbase" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ffbase") != "0.12.7")){devtools::install_version("ffbase", version = "0.12.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("foreach" %in% rownames(installed.packages()) == FALSE) || (packageVersion("foreach") != "1.4.4")){devtools::install_version("foreach", version = "1.4.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("formatR" %in% rownames(installed.packages()) == FALSE) || (packageVersion("formatR") != "1.7")){devtools::install_version("formatR", version = "1.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("Formula" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Formula") != "1.2-3")){devtools::install_version("Formula", version = "1.2-3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("fs" %in% rownames(installed.packages()) == FALSE) || (packageVersion("fs") != "1.5.2")){devtools::install_version("fs", version = "1.5.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("functional" %in% rownames(installed.packages()) == FALSE) || (packageVersion("functional") != "0.6")){devtools::install_version("functional", version = "0.6", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("gdtools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("gdtools") != "0.1.9")){devtools::install_version("gdtools", version = "0.1.9", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("generics" %in% rownames(installed.packages()) == FALSE) || (packageVersion("generics") != "0.0.2")){devtools::install_version("generics", version = "0.0.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("gert" %in% rownames(installed.packages()) == FALSE) || (packageVersion("gert") != "1.9.0")){devtools::install_version("gert", version = "1.9.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ggplot2" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ggplot2") != "3.3.3")){devtools::install_version("ggplot2", version = "3.3.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("gh" %in% rownames(installed.packages()) == FALSE) || (packageVersion("gh") != "1.3.1")){devtools::install_version("gh", version = "1.3.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("glue" %in% rownames(installed.packages()) == FALSE) || (packageVersion("glue") != "1.4.2")){devtools::install_version("glue", version = "1.4.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("gridExtra" %in% rownames(installed.packages()) == FALSE) || (packageVersion("gridExtra") != "2.3")){devtools::install_version("gridExtra", version = "2.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("gtable" %in% rownames(installed.packages()) == FALSE) || (packageVersion("gtable") != "0.3.0")){devtools::install_version("gtable", version = "0.3.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("hexbin" %in% rownames(installed.packages()) == FALSE) || (packageVersion("hexbin") != "1.27.3")){devtools::install_version("hexbin", version = "1.27.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("here" %in% rownames(installed.packages()) == FALSE) || (packageVersion("here") != "1.0.1")){devtools::install_version("here", version = "1.0.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("highr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("highr") != "0.8")){devtools::install_version("highr", version = "0.8", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("Hmisc" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Hmisc") != "4.7-1")){devtools::install_version("Hmisc", version = "4.7-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("htmlTable" %in% rownames(installed.packages()) == FALSE) || (packageVersion("htmlTable") != "1.13.1")){devtools::install_version("htmlTable", version = "1.13.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("htmltools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("htmltools") != "0.5.3")){devtools::install_version("htmltools", version = "0.5.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("htmlwidgets" %in% rownames(installed.packages()) == FALSE) || (packageVersion("htmlwidgets") != "1.3")){devtools::install_version("htmlwidgets", version = "1.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("httpuv" %in% rownames(installed.packages()) == FALSE) || (packageVersion("httpuv") != "1.6.1")){devtools::install_version("httpuv", version = "1.6.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ini" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ini") != "0.3.1")){devtools::install_version("ini", version = "0.3.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("interp" %in% rownames(installed.packages()) == FALSE) || (packageVersion("interp") != "1.1-3")){devtools::install_version("interp", version = "1.1-3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("iterators" %in% rownames(installed.packages()) == FALSE) || (packageVersion("iterators") != "1.0.10")){devtools::install_version("iterators", version = "1.0.10", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("itertools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("itertools") != "0.1-3")){devtools::install_version("itertools", version = "0.1-3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("keras" %in% rownames(installed.packages()) == FALSE) || (packageVersion("keras") != "2.2.4.1")){devtools::install_version("keras", version = "2.2.4.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("knitr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("knitr") != "1.23")){devtools::install_version("knitr", version = "1.23", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("labeling" %in% rownames(installed.packages()) == FALSE) || (packageVersion("labeling") != "0.3")){devtools::install_version("labeling", version = "0.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("later" %in% rownames(installed.packages()) == FALSE) || (packageVersion("later") != "0.8.0")){devtools::install_version("later", version = "0.8.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("latticeExtra" %in% rownames(installed.packages()) == FALSE) || (packageVersion("latticeExtra") != "0.6-28")){devtools::install_version("latticeExtra", version = "0.6-28", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("lazyeval" %in% rownames(installed.packages()) == FALSE) || (packageVersion("lazyeval") != "0.2.2")){devtools::install_version("lazyeval", version = "0.2.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("lifecycle" %in% rownames(installed.packages()) == FALSE) || (packageVersion("lifecycle") != "1.0.2")){devtools::install_version("lifecycle", version = "1.0.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("Matrix" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Matrix") != "1.5-1")){devtools::install_version("Matrix", version = "1.5-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("MatrixModels" %in% rownames(installed.packages()) == FALSE) || (packageVersion("MatrixModels") != "0.5-1")){devtools::install_version("MatrixModels", version = "0.5-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("magrittr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("magrittr") != "1.5")){devtools::install_version("magrittr", version = "1.5", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("mailR" %in% rownames(installed.packages()) == FALSE) || (packageVersion("mailR") != "0.4.1")){devtools::install_version("mailR", version = "0.4.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("markdown" %in% rownames(installed.packages()) == FALSE) || (packageVersion("markdown") != "1.0")){devtools::install_version("markdown", version = "1.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("memoise" %in% rownames(installed.packages()) == FALSE) || (packageVersion("memoise") != "2.0.1")){devtools::install_version("memoise", version = "2.0.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("memuse" %in% rownames(installed.packages()) == FALSE) || (packageVersion("memuse") != "4.2-1")){devtools::install_version("memuse", version = "4.2-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("mime" %in% rownames(installed.packages()) == FALSE) || (packageVersion("mime") != "0.7")){devtools::install_version("mime", version = "0.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("miniUI" %in% rownames(installed.packages()) == FALSE) || (packageVersion("miniUI") != "0.1.1.1")){devtools::install_version("miniUI", version = "0.1.1.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("multcomp" %in% rownames(installed.packages()) == FALSE) || (packageVersion("multcomp") != "1.4-20")){devtools::install_version("multcomp", version = "1.4-20", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("munsell" %in% rownames(installed.packages()) == FALSE) || (packageVersion("munsell") != "0.5.0")){devtools::install_version("munsell", version = "0.5.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("mvtnorm" %in% rownames(installed.packages()) == FALSE) || (packageVersion("mvtnorm") != "1.1-3")){devtools::install_version("mvtnorm", version = "1.1-3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("officer" %in% rownames(installed.packages()) == FALSE) || (packageVersion("officer") != "0.3.5")){devtools::install_version("officer", version = "0.3.5", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("openssl" %in% rownames(installed.packages()) == FALSE) || (packageVersion("openssl") != "2.0.3")){devtools::install_version("openssl", version = "2.0.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("openxlsx" %in% rownames(installed.packages()) == FALSE) || (packageVersion("openxlsx") != "4.1.0.1")){devtools::install_version("openxlsx", version = "4.1.0.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pack" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pack") != "0.1-1")){devtools::install_version("pack", version = "0.1-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ParallelLogger" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ParallelLogger") != "1.1.0")){devtools::install_version("ParallelLogger", version = "1.1.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pillar" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pillar") != "1.4.3")){devtools::install_version("pillar", version = "1.4.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pkgbuild" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pkgbuild") != "1.3.1")){devtools::install_version("pkgbuild", version = "1.3.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pkgdown" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pkgdown") != "2.0.6")){devtools::install_version("pkgdown", version = "2.0.6", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pkgconfig" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pkgconfig") != "2.0.2")){devtools::install_version("pkgconfig", version = "2.0.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pkgload" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pkgload") != "1.3.0")){devtools::install_version("pkgload", version = "1.3.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("plogr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("plogr") != "0.2.0")){devtools::install_version("plogr", version = "0.2.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("plotly" %in% rownames(installed.packages()) == FALSE) || (packageVersion("plotly") != "4.9.0")){devtools::install_version("plotly", version = "4.9.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("plyr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("plyr") != "1.8.4")){devtools::install_version("plyr", version = "1.8.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("png" %in% rownames(installed.packages()) == FALSE) || (packageVersion("png") != "0.1-7")){devtools::install_version("png", version = "0.1-7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("polspline" %in% rownames(installed.packages()) == FALSE) || (packageVersion("polspline") != "1.1.20")){devtools::install_version("polspline", version = "1.1.20", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("prettyunits" %in% rownames(installed.packages()) == FALSE) || (packageVersion("prettyunits") != "1.0.2")){devtools::install_version("prettyunits", version = "1.0.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("pROC" %in% rownames(installed.packages()) == FALSE) || (packageVersion("pROC") != "1.15.0")){devtools::install_version("pROC", version = "1.15.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("profvis" %in% rownames(installed.packages()) == FALSE) || (packageVersion("profvis") != "0.3.7")){devtools::install_version("profvis", version = "0.3.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("promises" %in% rownames(installed.packages()) == FALSE) || (packageVersion("promises") != "1.1.0")){devtools::install_version("promises", version = "1.1.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("PRROC" %in% rownames(installed.packages()) == FALSE) || (packageVersion("PRROC") != "1.3.1")){devtools::install_version("PRROC", version = "1.3.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ps" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ps") != "1.5.0")){devtools::install_version("ps", version = "1.5.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("purrr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("purrr") != "0.3.4")){devtools::install_version("purrr", version = "0.3.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("PythonInR" %in% rownames(installed.packages()) == FALSE) || (packageVersion("PythonInR") != "0.1-4")){devtools::install_version("PythonInR", version = "0.1-4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("quantreg" %in% rownames(installed.packages()) == FALSE) || (packageVersion("quantreg") != "5.94")){devtools::install_version("quantreg", version = "5.94", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("R.methodsS3" %in% rownames(installed.packages()) == FALSE) || (packageVersion("R.methodsS3") != "1.7.1")){devtools::install_version("R.methodsS3", version = "1.7.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("R.oo" %in% rownames(installed.packages()) == FALSE) || (packageVersion("R.oo") != "1.22.0")){devtools::install_version("R.oo", version = "1.22.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("R.utils" %in% rownames(installed.packages()) == FALSE) || (packageVersion("R.utils") != "2.9.0")){devtools::install_version("R.utils", version = "2.9.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("R6" %in% rownames(installed.packages()) == FALSE) || (packageVersion("R6") != "2.4.0")){devtools::install_version("R6", version = "2.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ragg" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ragg") != "1.2.2")){devtools::install_version("ragg", version = "1.2.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rcmdcheck" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rcmdcheck") != "1.4.0")){devtools::install_version("rcmdcheck", version = "1.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("RColorBrewer" %in% rownames(installed.packages()) == FALSE) || (packageVersion("RColorBrewer") != "1.1-2")){devtools::install_version("RColorBrewer", version = "1.1-2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("Rcpp" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Rcpp") != "1.0.7")){devtools::install_version("Rcpp", version = "1.0.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("RcppEigen" %in% rownames(installed.packages()) == FALSE) || (packageVersion("RcppEigen") != "0.3.3.5.0")){devtools::install_version("RcppEigen", version = "0.3.3.5.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("RcppTOML" %in% rownames(installed.packages()) == FALSE) || (packageVersion("RcppTOML") != "0.1.7")){devtools::install_version("RcppTOML", version = "0.1.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("RCurl" %in% rownames(installed.packages()) == FALSE) || (packageVersion("RCurl") != "1.95-4.12")){devtools::install_version("RCurl", version = "1.95-4.12", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ReporteRs" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ReporteRs") != "0.8.10")){devtools::install_version("ReporteRs", version = "0.8.10", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("ReporteRsjars" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ReporteRsjars") != "0.0.4")){devtools::install_version("ReporteRsjars", version = "0.0.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rematch2" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rematch2") != "2.1.2")){devtools::install_version("rematch2", version = "2.1.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("reshape2" %in% rownames(installed.packages()) == FALSE) || (packageVersion("reshape2") != "1.4.3")){devtools::install_version("reshape2", version = "1.4.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("reticulate" %in% rownames(installed.packages()) == FALSE) || (packageVersion("reticulate") != "1.12")){devtools::install_version("reticulate", version = "1.12", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rJava" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rJava") != "0.9-11")){devtools::install_version("rJava", version = "0.9-11", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rjson" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rjson") != "0.2.20")){devtools::install_version("rjson", version = "0.2.20", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("RJSONIO" %in% rownames(installed.packages()) == FALSE) || (packageVersion("RJSONIO") != "1.3-1.2")){devtools::install_version("RJSONIO", version = "1.3-1.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rlang" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rlang") != "1.0.5")){devtools::install_version("rlang", version = "1.0.5", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rmarkdown" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rmarkdown") != "1.13")){devtools::install_version("rmarkdown", version = "1.13", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rms" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rms") != "6.3-0")){devtools::install_version("rms", version = "6.3-0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("roxygen2" %in% rownames(installed.packages()) == FALSE) || (packageVersion("roxygen2") != "7.2.1")){devtools::install_version("roxygen2", version = "7.2.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rprojroot" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rprojroot") != "2.0.3")){devtools::install_version("rprojroot", version = "2.0.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rversions" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rversions") != "2.1.2")){devtools::install_version("rversions", version = "2.1.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("rvg" %in% rownames(installed.packages()) == FALSE) || (packageVersion("rvg") != "0.2.1")){devtools::install_version("rvg", version = "0.2.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("sandwich" %in% rownames(installed.packages()) == FALSE) || (packageVersion("sandwich") != "3.0-2")){devtools::install_version("sandwich", version = "3.0-2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("scales" %in% rownames(installed.packages()) == FALSE) || (packageVersion("scales") != "1.0.0")){devtools::install_version("scales", version = "1.0.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("sessioninfo" %in% rownames(installed.packages()) == FALSE) || (packageVersion("sessioninfo") != "1.2.2")){devtools::install_version("sessioninfo", version = "1.2.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("shape" %in% rownames(installed.packages()) == FALSE) || (packageVersion("shape") != "1.4.4")){devtools::install_version("shape", version = "1.4.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("shiny" %in% rownames(installed.packages()) == FALSE) || (packageVersion("shiny") != "1.3.2")){devtools::install_version("shiny", version = "1.3.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("shinycssloaders" %in% rownames(installed.packages()) == FALSE) || (packageVersion("shinycssloaders") != "0.2.0")){devtools::install_version("shinycssloaders", version = "0.2.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("shinydashboard" %in% rownames(installed.packages()) == FALSE) || (packageVersion("shinydashboard") != "0.7.1")){devtools::install_version("shinydashboard", version = "0.7.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("slam" %in% rownames(installed.packages()) == FALSE) || (packageVersion("slam") != "0.1-45")){devtools::install_version("slam", version = "0.1-45", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("snow" %in% rownames(installed.packages()) == FALSE) || (packageVersion("snow") != "0.4-3")){devtools::install_version("snow", version = "0.4-3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("sourcetools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("sourcetools") != "0.1.7")){devtools::install_version("sourcetools", version = "0.1.7", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("SparseM" %in% rownames(installed.packages()) == FALSE) || (packageVersion("SparseM") != "1.81")){devtools::install_version("SparseM", version = "1.81", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("stringi" %in% rownames(installed.packages()) == FALSE) || (packageVersion("stringi") != "1.4.3")){devtools::install_version("stringi", version = "1.4.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("stringr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("stringr") != "1.4.0")){devtools::install_version("stringr", version = "1.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("survAUC" %in% rownames(installed.packages()) == FALSE) || (packageVersion("survAUC") != "1.0-5")){devtools::install_version("survAUC", version = "1.0-5", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("sys" %in% rownames(installed.packages()) == FALSE) || (packageVersion("sys") != "3.2")){devtools::install_version("sys", version = "3.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("systemfonts" %in% rownames(installed.packages()) == FALSE) || (packageVersion("systemfonts") != "1.0.4")){devtools::install_version("systemfonts", version = "1.0.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("testthat" %in% rownames(installed.packages()) == FALSE) || (packageVersion("testthat") != "3.1.4")){devtools::install_version("testthat", version = "3.1.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("tensorflow" %in% rownames(installed.packages()) == FALSE) || (packageVersion("tensorflow") != "1.13.1")){devtools::install_version("tensorflow", version = "1.13.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("textshaping" %in% rownames(installed.packages()) == FALSE) || (packageVersion("textshaping") != "0.3.6")){devtools::install_version("textshaping", version = "0.3.6", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("tfruns" %in% rownames(installed.packages()) == FALSE) || (packageVersion("tfruns") != "1.4")){devtools::install_version("tfruns", version = "1.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("TH.data" %in% rownames(installed.packages()) == FALSE) || (packageVersion("TH.data") != "1.1-1")){devtools::install_version("TH.data", version = "1.1-1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("tibble" %in% rownames(installed.packages()) == FALSE) || (packageVersion("tibble") != "3.0.0")){devtools::install_version("tibble", version = "3.0.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("tidyr" %in% rownames(installed.packages()) == FALSE) || (packageVersion("tidyr") != "1.2.0")){devtools::install_version("tidyr", version = "1.2.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("tidyselect" %in% rownames(installed.packages()) == FALSE) || (packageVersion("tidyselect") != "1.1.0")){devtools::install_version("tidyselect", version = "1.1.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("tinytex" %in% rownames(installed.packages()) == FALSE) || (packageVersion("tinytex") != "0.14")){devtools::install_version("tinytex", version = "0.14", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("triebeard" %in% rownames(installed.packages()) == FALSE) || (packageVersion("triebeard") != "0.3.0")){devtools::install_version("triebeard", version = "0.3.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("urlchecker" %in% rownames(installed.packages()) == FALSE) || (packageVersion("urlchecker") != "1.0.1")){devtools::install_version("urlchecker", version = "1.0.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("urltools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("urltools") != "1.7.3")){devtools::install_version("urltools", version = "1.7.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("usethis" %in% rownames(installed.packages()) == FALSE) || (packageVersion("usethis") != "2.1.6")){devtools::install_version("usethis", version = "2.1.6", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("utf8" %in% rownames(installed.packages()) == FALSE) || (packageVersion("utf8") != "1.1.4")){devtools::install_version("utf8", version = "1.1.4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("uuid" %in% rownames(installed.packages()) == FALSE) || (packageVersion("uuid") != "0.1-2")){devtools::install_version("uuid", version = "0.1-2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("vctrs" %in% rownames(installed.packages()) == FALSE) || (packageVersion("vctrs") != "0.3.8")){devtools::install_version("vctrs", version = "0.3.8", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("viridis" %in% rownames(installed.packages()) == FALSE) || (packageVersion("viridis") != "0.5.1")){devtools::install_version("viridis", version = "0.5.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("viridisLite" %in% rownames(installed.packages()) == FALSE) || (packageVersion("viridisLite") != "0.3.0")){devtools::install_version("viridisLite", version = "0.3.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("waldo" %in% rownames(installed.packages()) == FALSE) || (packageVersion("waldo") != "0.4.0")){devtools::install_version("waldo", version = "0.4.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("whisker" %in% rownames(installed.packages()) == FALSE) || (packageVersion("whisker") != "0.3-2")){devtools::install_version("whisker", version = "0.3-2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("xfun" %in% rownames(installed.packages()) == FALSE) || (packageVersion("xfun") != "0.8")){devtools::install_version("xfun", version = "0.8", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("xgboost" %in% rownames(installed.packages()) == FALSE) || (packageVersion("xgboost") != "0.6.4.1")){devtools::install_version("xgboost", version = "0.6.4.1", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("XML" %in% rownames(installed.packages()) == FALSE) || (packageVersion("XML") != "3.98-1.20")){devtools::install_version("XML", version = "3.98-1.20", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("xml2" %in% rownames(installed.packages()) == FALSE) || (packageVersion("xml2") != "1.3.3")){devtools::install_version("xml2", version = "1.3.3", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("xopen" %in% rownames(installed.packages()) == FALSE) || (packageVersion("xopen") != "1.0.0")){devtools::install_version("xopen", version = "1.0.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("xtable" %in% rownames(installed.packages()) == FALSE) || (packageVersion("xtable") != "1.8-4")){devtools::install_version("xtable", version = "1.8-4", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("yaml" %in% rownames(installed.packages()) == FALSE) || (packageVersion("yaml") != "2.2.0")){devtools::install_version("yaml", version = "2.2.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("zeallot" %in% rownames(installed.packages()) == FALSE) || (packageVersion("zeallot") != "0.1.0")){devtools::install_version("zeallot", version = "0.1.0", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("zoo" %in% rownames(installed.packages()) == FALSE) || (packageVersion("zoo") != "1.8-10")){devtools::install_version("zoo", version = "1.8-10", repos = "http://cran.us.r-project.org", upgrade = "never")})
mode: 000664
owner: root
group: root
/etc/systemd/system/jupyter-server.service:
content: |
[Unit]
Description=JupyterHub
After=syslog.target network.target
[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/jupyterhub/bin"
ExecStart=/usr/local/bin/jupyterhub -f /etc/systemd/system/jupyterhub_config.py
[Install]
WantedBy=multi-user.target
mode: 000644
owner: root
group: root
Properties:
IamInstanceProfile: !Ref RStudioInstanceProfile
InstanceType: !Ref InstanceType
KeyName: !Ref 'KeyPair'
ImageId: !FindInMap
- RegionMap
- !Ref 'AWS::Region'
- AMI
SecurityGroupIds:
- !Ref RStudioSecurityGroup
SubnetId: !Ref VPCSubnet
Tags:
- Key: "Name"
Value: !Sub "${AWS::StackName}-RStudio"
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
VolumeType: "gp2"
DeleteOnTermination: "true"
VolumeSize: 50
- DeviceName: "/dev/sdm"
Ebs:
VolumeType: "gp2"
DeleteOnTermination: "true"
Encrypted: "true"
VolumeSize: !Ref HomeDirectorySize
UserData:
Fn::Base64: !Sub |
#!/bin/bash
RSTUDIO_URL="https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-1.4.1103-x86_64.rpm"
SHINY_URL="https://download3.rstudio.org/centos7/x86_64/shiny-server-1.5.16.958-x86_64.rpm"
RSTUDIOPORT=8787
users="${UserList}"
SMROLEARN=${SageMakerRole}
MIN_USER_ID=400
export SOURCES=${Sources}
export PATH=$PATH:/usr/local/bin
# Install SSM client
#yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
#restart amazon-ssm-agent
#pip install awscli
#Use cfn-init to grab and apply the files specified in the above UserData
/opt/aws/bin/cfn-init --verbose --stack ${AWS::StackName} --resource RStudioInstance --region ${AWS::Region}
sudo mkfs -t ext4 /dev/sdm
mkdir /mnt/tmp
sudo mount /dev/sdm /mnt/tmp
cp -a /home/. /mnt/tmp
umount /dev/sdm
mount /dev/sdm /home
echo "/dev/sdm /home ext4 defaults,nofail 0 2" >> /etc/fstab
yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
export MAKE='make -j 8'
sudo yum install -y xorg-x11-xauth.x86_64 xorg-x11-server-utils.x86_64 xterm libXt libX11-devel libXt-devel libcurl-devel git compat-gmp4 compat-libffi5 openssl-devel
sudo yum install R R-core R-core-devel R-devel libxml2-devel -y
if [ -f /usr/lib64/R/etc/Makeconf.rpmnew ]; then
sudo cp /usr/lib64/R/etc/Makeconf.rpmnew /usr/lib64/R/etc/Makeconf
fi
if [ -f /usr/lib64/R/etc/ldpaths.rpmnew ]; then
sudo cp /usr/lib64/R/etc/ldpaths.rpmnew /usr/lib64/R/etc/ldpaths
fi
mkdir /mnt/r-stuff
cd /mnt/r-stuff
pushd .
mkdir R-latest
cd R-latest
wget https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz
tar -xzf R-4.1.0.tar.gz
#Trying out Python
sudo yum install -y python3 python3-devel python3-pip
sudo yum install -y gcc gcc-c++ gcc-gfortran
sudo yum install -y bzip2-devel readline-devel cairo-devel libpng-devel libjpeg-devel libtiff-devel postgresql-devel
sudo yum install -y pcre2-devel harfbuzz-devel fribidi-devel
sudo amazon-linux-extras install -y epel
sudo amazon-linux-extras install -y postgresql14
sudo yum install -y libsodium-devel
cd R-4*
./configure --with-readline=yes --enable-R-profiling=no --enable-memory-profiling=no --enable-R-shlib --with-pic --prefix=/usr --with-x --with-libpng --with-jpeglib --with-cairo --enable-R-shlib --with-recommended-packages=yes
make -j 8
sudo make install
sudo su << BASH_SCRIPT
echo 'export PATH=${!PWD}/bin:$PATH' >> /etc/profile
BASH_SCRIPT
popd
sudo sed -i 's/make/make -j 8/g' /usr/lib64/R/etc/Renviron
# set unix environment variables
sudo su << BASH_SCRIPT
echo '
export JAVA_HOME=/etc/alternatives/jre
' >> /etc/profile
BASH_SCRIPT
sudo sh -c "source /etc/profile"
# fix java binding - R and packages have to be compiled with the same java version as hadoop
sudo R CMD javareconf
RSTUDIO_FILE=$(basename $RSTUDIO_URL)
wget $RSTUDIO_URL
sudo yum install --nogpgcheck -y $RSTUDIO_FILE
# change port - 8787 will not work for many companies
sudo sh -c "echo 'www-port=$RSTUDIOPORT' >> /etc/rstudio/rserver.conf"
sudo sh -c "echo 'auth-minimum-user-id=$MIN_USER_ID' >> /etc/rstudio/rserver.conf"
sudo perl -p -i -e "s/= 5../= 100/g" /etc/pam.d/rstudio
sudo rstudio-server stop || true
sudo rstudio-server start
#Grab R binaries
cd /usr/lib64/R/library
wget https://ohdsi-sample-data.s3.amazonaws.com/ohdsi-rdependencies-symp2022-4.1.0.gzip
unzip -o ohdsi-rdependencies-symp2022-4.1.0.gzip
#Install R dependencies if any of the specified versions differ
sudo Rscript /tmp/rdependencies.r
SHINY_FILE=$(basename $SHINY_URL)
wget $SHINY_URL
sudo yum install --nogpgcheck -y $SHINY_FILE
#sudo R --no-save <<R_SCRIPT
#install.packages(c('shiny','rmarkdown'), repos="http://cran.rstudio.com")
#R_SCRIPT
# Install Jupyter
export PATH=$PATH:/usr/local/bin
echo "127.0.0.1 `hostname`" >> /etc/hosts
curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -
sudo yum install -y nodejs
npm config set strict-ssl false
pip-3 install jupyterhub
npm install -g configurable-http-proxy
pip-3 install "ipython[notebook]"
pip-3 install jupyterlab
jupyter serverextension enable --py jupyterlab
R --no-save << R_SCRIPT
install.packages('IRkernel', repos = "http://cran.us.r-project.org")
IRkernel::installspec(user = FALSE)
R_SCRIPT
cd /etc/systemd/system
sudo /usr/local/bin/jupyterhub --generate-config
sed -i "s|# c.Spawner.default_url = ''|c.Spawner.default_url = '/lab'|" ./jupyterhub_config.py
sed -i "s|# c.JupyterHub.port = 8000|c.JupyterHub.port = 80|" ./jupyterhub_config.py
sudo systemctl daemon-reload
sudo systemctl enable jupyter-server.service
sudo systemctl start jupyter-server.service
sudo yum install -y cairo-devel
sudo yum install -y scipy
sudo pip3 install scipy
sudo pip3 install sklearn
sudo pip3 install torch torchvision
sudo pip3 install boto3==1.7.52
sudo pip3 install sagemaker
sudo pip3 install mxnet
sudo pip3 install pandas
# Set site-wide grDevices 'bitmap' type to 'cairo' to enable the correct generation of PNG images
sudo echo "options(bitmapType=\"cairo\")
" > /usr/lib64/R/etc/Rprofile.site
mkdir /jdbcdrivers
# Install all of the OHDSI R Libraries
sudo R --no-save << R_SCRIPT
library(devtools)
try(if(("SqlRender" %in% rownames(installed.packages()) == FALSE) || (packageVersion("SqlRender") != "${SqlRenderv}")){devtools::install_version("SqlRender", version = "${SqlRenderv}", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("DatabaseConnectorJars" %in% rownames(installed.packages()) == FALSE) || (packageVersion("DatabaseConnectorJars") != "${DatabaseConnectorJarsv}")){devtools::install_version("DatabaseConnectorJars", version = "${DatabaseConnectorJarsv}", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("DatabaseConnector" %in% rownames(installed.packages()) == FALSE) || (packageVersion("DatabaseConnector") != "${DatabaseConnectorv}")){devtools::install_version("DatabaseConnector", version = "${DatabaseConnectorv}", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("OhdsiRTools" %in% rownames(installed.packages()) == FALSE) || (packageVersion("OhdsiRTools") != "${OhdsiRToolsv}")){devtools::install_github("ohdsi/OhdsiRTools", ref = "v${OhdsiRToolsv}", upgrade = "never")})
try(if(("ParallelLogger" %in% rownames(installed.packages()) == FALSE) || (packageVersion("ParallelLogger") != "2.0.2")){devtools::install_version("ParallelLogger", version = "2.0.2", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("Achilles" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Achilles") != "${Achillesv}")){devtools::install_github("ohdsi/Achilles", ref = "v${Achillesv}", upgrade = "never")})
try(if(("FeatureExtraction" %in% rownames(installed.packages()) == FALSE) || (packageVersion("FeatureExtraction") != "${FeatureExtractionv}")){devtools::install_github("ohdsi/FeatureExtraction", ref = "v${FeatureExtractionv}", upgrade = "never")})
try(if(("Cyclops" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Cyclops") != "${Cyclopsv}")){devtools::install_version("Cyclops", version = "${Cyclopsv}", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("BigKnn" %in% rownames(installed.packages()) == FALSE) || (packageVersion("BigKnn") != "${BigKNNv}")){devtools::install_github("ohdsi/BigKnn", ref = "v${BigKNNv}", upgrade = "never")})
try(if(("CohortMethod" %in% rownames(installed.packages()) == FALSE) || (packageVersion("CohortMethod") != "${CohortMethodv}")){devtools::install_github("ohdsi/CohortMethod", ref = "v${CohortMethodv}", upgrade = "never")})
try(if(("EmpiricalCalibration" %in% rownames(installed.packages()) == FALSE) || (packageVersion("EmpiricalCalibration") != "${EmpiricalCalibrationv}")){devtools::install_version("EmpiricalCalibration", version = "${EmpiricalCalibrationv}", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("OhdsiSharing" %in% rownames(installed.packages()) == FALSE) || (packageVersion("OhdsiSharing") != "${OhdsiSharingv}")){devtools::install_github("ohdsi/OhdsiSharing", ref = "v${OhdsiSharingv}", upgrade = "never")})
try(if(("MethodEvaluation" %in% rownames(installed.packages()) == FALSE) || (packageVersion("MethodEvaluation") != "${MethodEvaluationv}")){devtools::install_github("ohdsi/MethodEvaluation", ref = "v${MethodEvaluationv}", upgrade = "never")})
try(if(("Hydra" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Hydra") != "${Hydrav}")){devtools::install_github("ohdsi/Hydra", ref = "v${Hydrav}", upgrade = "never")})
try(if(("PatientLevelPrediction" %in% rownames(installed.packages()) == FALSE) || (packageVersion("PatientLevelPrediction") != "${PatientLevelPredictionv}")){devtools::install_github("ohdsi/PatientLevelPrediction", ref = "v${PatientLevelPredictionv}", upgrade = "never")})
try(if(("PredictionComparison" %in% rownames(installed.packages()) == FALSE) || (packageVersion("PredictionComparison") != "${PredictionComparisonv}")){devtools::install_github("ohdsi/PredictionComparison", ref = "v${PredictionComparisonv}", upgrade = "never")})
try(if(("Eunomia" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Eunomia") != "${Eunomiav}")){devtools::install_github("ohdsi/Eunomia", ref = "v${Eunomiav}", upgrade = "never")})
try(if(("Andromeda" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Andromeda") != "${Andromedav}")){devtools::install_version("Andromeda", version = "${Andromedav}", repos = "http://cran.us.r-project.org", upgrade = "never")})
try(if(("SelfControlledCaseSeries" %in% rownames(installed.packages()) == FALSE) || (packageVersion("SelfControlledCaseSeries") != "${SelfControlledCaseSeriesv}")){devtools::install_github("ohdsi/SelfControlledCaseSeries", ref = "v${SelfControlledCaseSeriesv}", upgrade = "never")})
try(if(("SelfControlledCohort" %in% rownames(installed.packages()) == FALSE) || (packageVersion("SelfControlledCohort") != "${SelfControlledCohortv}")){devtools::install_github("ohdsi/SelfControlledCohort", ref = "v${SelfControlledCohortv}", upgrade = "never")})
try(if(("EvidenceSynthesis" %in% rownames(installed.packages()) == FALSE) || (packageVersion("EvidenceSynthesis") != "${EvidenceSynthesisv}")){devtools::install_github("ohdsi/EvidenceSynthesis", ref = "v${EvidenceSynthesisv}", upgrade = "never")})
try(if(("CohortDiagnostics" %in% rownames(installed.packages()) == FALSE) || (packageVersion("CohortDiagnostics") != "${CohortDiagnosticsv}")){devtools::install_github("ohdsi/CohortDiagnostics", ref = "v${CohortDiagnosticsv}", upgrade = "never")})
try(if(("Hades" %in% rownames(installed.packages()) == FALSE) || (packageVersion("Hades") != "${Hadesv}")){devtools::install_github("ohdsi/Hades", ref = "v${Hadesv}", upgrade = "never")})
library(DatabaseConnector)
downloadJdbcDrivers(pathToDriver = '/jdbcdrivers', dbms = 'redshift')
downloadJdbcDrivers(pathToDriver = '/jdbcdrivers', dbms = 'postgresql')
R_SCRIPT
region=`curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}'`
count=1
for i in $(echo $users | sed "s/,/ /g")
do
if [ `expr $count % 2` -eq "1" ]; then
username=$i
let count+=1
continue
else
sudo adduser $username
sudo sh -c "echo '$i' | passwd --stdin $username"
sudo -u $username mkdir /home/$username/.aws
sudo -u $username bash -c 'echo "[default]
region = '$region'" > /home/'$username'/.aws/config'
sudo -u $username bash -c 'mkdir ~/andromedaTemp'
sudo -u $username bash -c 'mkdir ~/myResults'
sudo -u $username bash -c 'echo "DATABASECONNECTOR_JAR_FOLDER = \"/jdbcdrivers\"" >> ~/.Renviron'
sudo -u $username bash -c 'echo "#Connection string for the OMOP database on Redshift
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = \"redshift\",
server = \"${RedshiftEndpoint}/mycdm\",
user = \"master\",
password = \"${DatabaseMasterPassword}\",
port = \"5439\",
pathToDriver = \"/jdbcdrivers\")
#Connection string for the WebAPI database on RDS Aurora PostgreSQL
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = \"postgresql\",
server = \"${RDSEndpoint}/OHDSI?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory\",
user = \"ohdsi_admin_user\",
password = \"${DatabaseMasterPassword}\",
port = \"5432\",
pathToDriver = \"/jdbcdrivers\")
options(andromedaTempFolder = "~/andromedaTemp")
outputFolder <- \"/home/`whoami`/myResults\"
" > /home/'$username'/ConnectionDetails.R'
for i in $(echo $SOURCES | sed "s/,/ /g")
do
sudo -u $username bash -c 'echo "cdmDatabaseSchema <- \"'$i'\"
cohortDatabaseSchema <- \"'$i'results\"
" >> /home/'$username'/ConnectionDetails.R'
done
# add the first users in the list to the sudoers file.
if [ "$count" = "2" ]; then
echo "$username ALL=(ALL:ALL) ALL" >> /etc/sudoers
wget -P /home/$username/ https://ohdsi-rstudio.s3.amazonaws.com/atlasusermgmt.sh
chmod +x /home/$username/atlasusermgmt.sh
chown $username:$username /home/$username/atlasusermgmt.sh
fi
let count+=1
fi
done
RStudioTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
DependsOn: RStudioInstance
Properties:
HealthCheckIntervalSeconds: 30
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 10
HealthyThresholdCount: 4
Matcher:
HttpCode: '200'
Port: 80
Protocol: HTTP
TargetGroupAttributes:
- Key: deregistration_delay.timeout_seconds
Value: '20'
Targets:
- Id: !Ref 'RStudioInstance'
Port: 8787
UnhealthyThresholdCount: 3
VpcId: !Ref VPCId
JupyterTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
DependsOn: RStudioInstance
Properties:
HealthCheckIntervalSeconds: 30
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 10
HealthyThresholdCount: 4
Matcher:
HttpCode: '200'
Port: 80
Protocol: HTTP
TargetGroupAttributes:
- Key: deregistration_delay.timeout_seconds
Value: '20'
Targets:
- Id: !Ref 'RStudioInstance'
Port: 80
UnhealthyThresholdCount: 3
VpcId: !Ref VPCId
Outputs:
RStudioTargetGroupArn:
Value: !Ref RStudioTargetGroup
JupyterTargetGroupArn:
Value: !Ref JupyterTargetGroup