forked from dscanferla/Iraq-JPMI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
1343 lines (1150 loc) · 96.9 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
#### 1 LOAD PACKAGES ###########################################################
library(dplyr) # data wrangling work horse
library(tidyr) # additional data wrangling
library(tidytidbits) # for conditional piping
library(stringr) # to do some operations with strings
library(shiny) # for shiny app functions
library(shinyWidgets) # additional UI options for shiny
library(shinythemes) # to apply a theme to the shiny app
library(sf) # to read/manipulate shapefiles
library(leaflet) # to display maps
library(leaflet.extras) # additional options for leaflet
library(highcharter) # to build plots
library(DT) # for datatable in data explorer
library(kableExtra) # to make tables
library(scales) # to define percentages
#### 2 LOAD DATA ###############################################################
data <- read.csv("data/longterm_data_by_KI.csv", na.strings = c("NA", "")) # load JPMI dataset
jram <- read.csv("data/JRAM_data.csv") # load JRAM dataset
item_list <- read.csv("data/item_list.csv") # load item list
country <- st_read("gis/irq_admbnda_adm0_cso_itos_20190603.shp") # load shapefile with country border
governorate <- st_read("gis/irq_admbnda_adm1_cso_20190603.shp") # load shapefile with governorate borders
district <- st_read("gis/irq_admbnda_adm2_cso_20190603.shp") # load shapefile with district borders
data$date <- as.Date(data$date, format="%Y-%m-%d") # format date column in JPMI dataset as date
jram$Date <- as.Date(jram$Date, format="%d/%m/%Y") # format date column in JRAM dataset as date
#### 3 AGGREGATION #############################################################
#### * 3.1 Prices ##############################################################
prices <- data %>%
select(date, governorate, district, site, ends_with("_price"), exchange_rate) %>% # calculate site medians
group_by(date, governorate, district, site) %>%
summarise_all(median, na.rm = TRUE) %>%
select(date, governorate, district, ends_with("_price"), exchange_rate) %>% # calculate district medians
group_by(date, governorate, district) %>%
summarise_all(median, na.rm = TRUE) %>%
setNames(gsub("_price","",names(.))) %>% # rename columns names
ungroup() %>%
group_by(date) %>%
mutate(water_trucking2 = ifelse(is.na(water_trucking), # impute missing water trucking values
water/(1- median( water_trucking/(water+water_trucking), na.rm=TRUE )),
water_trucking),
SMEB_food = 10*lentils + 15*rice + 5*sugar + 0.75*salt + 5*bulgur + # calculate SMEB values
4.55*vegetable_oil + 30*wheat_flour,
SMEB_nfi = 6*bath_soap + 6*toothbrush + 1*toothpaste + 1*shampoo +
32*sanitary_napkins + 1*plastic_garbage_bags + 1*detergent,
SMEB_water = 3*water + 47/500*water_trucking2,
SMEB = SMEB_food + SMEB_nfi + SMEB_water,
SMEB_food_old = 10.8*lentils + 40.5*rice + 5.94*sugar + # calculate SMEB values
5.94*vegetable_oil + 40.5*wheat_flour,
SMEB_nfi_old = 8*bath_soap + 4*toothbrush + 2*toothpaste + 2*shampoo + 1*disinfectant_solution +
20*sanitary_napkins + 1*plastic_garbage_bags,
SMEB_fuel_old = 1*butane + 16.67*kerosene,
SMEB_old = SMEB_food_old + SMEB_nfi_old + ifelse(date < "2018-08-01", SMEB_fuel_old, SMEB_water),
exchange_rate = exchange_rate / 100 # divide exchange rate by 100 since we ask for the price of 100 USD
) %>%
select(-water_trucking2) %>%
mutate(SMEB = ifelse(date >= "2020-01-01", SMEB, NA),
SMEB_old = ifelse(date < "2020-01-01", SMEB_old, NA),
SMEB_food = ifelse(date >= "2020-01-01", SMEB_food, NA),
SMEB_food_old = ifelse(date < "2020-01-01", SMEB_food_old, NA),
SMEB_nfi = ifelse(date >= "2020-01-01", SMEB_nfi, NA),
SMEB_nfi_old = ifelse(date < "2020-01-01", SMEB_nfi_old, NA),
#SMEB_water = ifelse(date >= "2020-01-01", SMEB_water, NA),
SMEB_fuel_old = ifelse(date < "2020-01-01", SMEB_fuel_old, NA)) %>%
mutate_if(is.numeric, round, 0) %>% # round values
rename(Date = date, Governorate = governorate, District = district, # rename column names
"SMEB" = SMEB,
"SMEB food" = SMEB_food,
"SMEB NFI" = SMEB_nfi,
"SMEB water" = SMEB_water,
"SMEB (pre-2020)" = SMEB_old,
"SMEB food (pre-2020)" = SMEB_food_old,
"SMEB NFI (pre-2020)" = SMEB_nfi_old,
"SMEB fuel (pre-2020)" = SMEB_fuel_old,
"Lentils (1 kg)" = lentils,
"Rice (1 kg)" = rice,
"Sugar (1 kg)" = sugar,
"Salt (1 kg)" = salt,
"Bulgur (1 kg)" = bulgur,
"Vegetable oil (1 L)" = vegetable_oil,
"Wheat flour (1 kg)" = wheat_flour,
"Bath soap (125 g)" = bath_soap,
"Toothbrush (1 unit)" = toothbrush,
"Toothpaste (75 ml)" = toothpaste,
"Shampoo (500 ml)" = shampoo,
"Sanitary napkins (1 unit)" = sanitary_napkins,
"Garbage bags (20 units)" = plastic_garbage_bags,
"Detergent (1 kg)" = detergent,
"Disinfectant solution (1 L)" = disinfectant_solution,
"Bottled water (1 L)" = water,
"Water trucking (500 L)" = water_trucking,
"Butane (1 canister)" = butane,
"Chicken (1 kg)" = chicken,
"Chickpeas (1 kg)" = chickpeas,
"Comb (1 unit)" = comb,
"Dry milk (500 g)" = dry_milk,
"Eggs (30 units)" = eggs,
"Kerosene (1 L)" = kerosene,
"Nail clippers (1 unit)" = nail_clippers,
"Onions (1 kg)" = onions,
"Tea (500 g)" = tea,
"Towel (1 unit)" = towel,
"White beans (1 kg)" = white_beans,
"US dollars (1 USD)" = exchange_rate
)
prices_long <- gather(prices, Item, Price, 4:ncol(prices)) # change dataframe to long format
#### * 3.2 Indicators ##########################################################
indicators <- data %>%
select(date, governorate, district, starts_with("challenges."), ends_with("_shortage"), ends_with("_imported"), supply_routes,
-starts_with("butane_"), -starts_with("chicken_"), -starts_with("chickpeas_"), -starts_with("comb_"),
-starts_with("dry_milk_"), -starts_with("eggs_"), -starts_with("kerosene_"), -starts_with("nail_clippers_"),
-starts_with("onions_"), -starts_with("tea_"), -starts_with("towel_"), -starts_with("white_beans_"))
indicators <- indicators %>%
gather(Indicator, Value, 4:(ncol(indicators))) %>%
filter(Indicator != "challenges.decline") %>%
group_by(date, governorate, district, Indicator) %>%
summarise(freq = sum(Value == 1 | Value == "yes", na.rm = TRUE) / sum(!is.na(Value)) * 100) %>%
mutate_if(is.numeric, round, 0) %>%
spread(Indicator, freq) %>%
mutate(challenges.atleast1 = 100 - challenges.none) %>%
rename(Date = date,
Governorate = governorate,
District = district,
'% of traders reporting challenge in past 30 days: Issues with check points or other movement restrictions' = challenges.check_points,
'% of traders reporting challenge in past 30 days: Shortages in demand' = challenges.demand,
'% of traders reporting challenge in past 30 days: I do not know' = challenges.dnk,
'% of traders reporting challenge in past 30 days: Issues with government regulations' = challenges.government_regulations,
'% of traders reporting challenge in past 30 days: Issues with insecurity or instability in the area' = challenges.insecurity,
'% of traders reporting challenge in past 30 days: Shortages in liquidity' = challenges.liquidity,
'% of traders reporting challenge in past 30 days: None' = challenges.none,
'% of traders reporting challenge in past 30 days: Other' = challenges.other,
'% of traders reporting challenge in past 30 days: At least one challenge reported' = challenges.atleast1,
'% of traders reporting harmful supply route change in past 30 days' = supply_routes,
'% of traders reporting shortage of LENTILS in past 30 days' = lentils_shortage,
'% of traders reporting shortage of RICE in past 30 days' = rice_shortage,
'% of traders reporting shortage of SUGAR in past 30 days' = sugar_shortage,
'% of traders reporting shortage of SALT in past 30 days' = salt_shortage,
'% of traders reporting shortage of BULGUR in past 30 days' = bulgur_shortage,
'% of traders reporting shortage of VEGETABLE OIL in past 30 days' = vegetable_oil_shortage,
'% of traders reporting shortage of WHEAT FLOUR in past 30 days' = wheat_flour_shortage,
'% of traders reporting shortage of BATH SOAP in past 30 days' = bath_soap_shortage,
'% of traders reporting shortage of TOOTHBRUSH in past 30 days' = toothbrush_shortage,
'% of traders reporting shortage of TOOTHPASTE in past 30 days' = toothpaste_shortage,
'% of traders reporting shortage of SHAMPOO in past 30 days' = shampoo_shortage,
'% of traders reporting shortage of SANITARY NAPKINS in past 30 days' = sanitary_napkins_shortage,
'% of traders reporting shortage of GARBAGE BAGS in past 30 days' = plastic_garbage_bags_shortage,
'% of traders reporting shortage of DETERGENT in past 30 days' = detergent_shortage,
'% of traders reporting shortage of DISINFECTANT SOLUTION in past 30 days' = disinfectant_solution_shortage,
'% of traders reporting shortage of BOTTLED WATER in past 30 days' = water_shortage,
'% of traders reporting shortage of WATER TRUCKING in past 30 days' = water_trucking_shortage,
'% of traders importing LENTILS' = lentils_imported,
'% of traders importing RICE' = rice_imported,
'% of traders importing SUGAR' = sugar_imported,
'% of traders importing SALT' = salt_imported,
'% of traders importing BULGUR' = bulgur_imported,
'% of traders importing VEGETABLE OIL' = vegetable_oil_imported,
'% of traders importing WHEAT FLOUR' = wheat_flour_imported,
'% of traders importing BATH SOAP' = bath_soap_imported,
'% of traders importing TOOTHBRUSH' = toothbrush_imported,
'% of traders importing TOOTHPASTE' = toothpaste_imported,
'% of traders importing SHAMPOO' = shampoo_imported,
'% of traders importing SANITARY NAPKINS' = sanitary_napkins_imported,
'% of traders importing GARBAGE BAGS' = plastic_garbage_bags_imported,
'% of traders importing DETERGENT' = detergent_imported,
'% of traders importing DISINFECTANT SOLUTION' = disinfectant_solution_imported,
'% of traders importing BOTTLED WATER' = water_imported
)
full <- left_join(prices, indicators, by = c("Date", "Governorate", "District"))
#### 4 REFERENCES ##############################################################
dates <- sort(unique(prices_long$Date)) # define list with date range in data
dates_min <- as.Date("2020-01-01") # set minimum date to be displayed
dates_max <- max(prices_long$Date) # maximum date in data
dates_max2 <- sort(unique(prices_long$Date), decreasing=T)[2] # second-latest date
dates_max_1y <- as.POSIXlt(dates_max) # most recent month minus 1 year
dates_max_1y$year <- dates_max_1y$year-1
dates_max_1y <- as.Date(dates_max_1y)
dates_jram <- sort(unique(jram$Date)) # date range in JRAM data
dates_min_jram <- min(dates_jram) # minimum date in JRAM data
dates_max_jram <- max(dates_jram) # maximum date in JRAM data
plot_location_list <- prices_long %>% # define location list (which is later used as choice filter options)
ungroup() %>%
select(Governorate, District) %>% # extract governorate and district columns
arrange(Governorate, District) %>% # list alphabetically
filter(!duplicated(District)) # remove duplicates
indicator_list <- names(indicators) %>%
str_subset(c("Date", "Governorate", "District"), negate = TRUE) # extract additional indicator list
cols <- c("rgb(238,88,89)", "rgb(88,88,90)", "rgb(165,201,161)", # define color palette for plot lines
"rgb(86,179,205)", "rgb(246,158,97)", "rgb(255,246,122)",
"rgb(210,203,184)", "rgb(247,172,172)", "rgb(172,172,173)",
"rgb(210,228,208)", "rgb(171,217,230)", "rgb(251,207,176)",
"rgb(255,251,189)", "rgb(233,229,220)")
full_list <- data.frame(Item = indicator_list, # create full indicator list
Group = "VIII. Additional Indicators") %>% arrange(Item)
full_list <- rbind(item_list, full_list) # combine prices and additional indicators
jram$partners <- paste(jram$Lead_Partner, jram$Other_partners_involved, sep = ", ")
jram$partners <- gsub(", $", "", jram$partners)
partner_list <- strsplit(jram$partners, ", ")
partner_list <- sort(unique(unlist(partner_list)))
#### 5 PREPARE DATA ############################################################
#### * 5.1 Define dataframe ####################################################
prices_country <- prices %>% # aggregate price data at country level
select(-Governorate, -District) %>%
group_by(Date) %>%
summarise_all(median, na.rm = TRUE)
prices_country_long <- gather(prices_country, Item, Price, 2:ncol(prices_country))# transform country-level price data to long format
prices_country_home <- prices_country %>% # filter out SMEB data from country level price data
filter(Date >= dates_min) %>%
select(Date, SMEB, `SMEB food`, `SMEB NFI`, `SMEB water`) %>%
gather(Item, Price, SMEB:'SMEB water') # transform SMEB data to long format so highcharter can read dataframe
prices_changes <- prices_country_long %>% # calculate bi-monthly/yearly changes of item prices
filter(Date == dates_max | Date == dates_max2 | Date == dates_max_1y) %>%
group_by(Item) %>%
mutate(change = percent(Price/lag(Price, order_by=Date)-1, accuracy = 1),
change2 = percent(Price/lag(Price, n = 2, order_by=Date)-1, accuracy = 1)) %>%
mutate(change = ifelse(!grepl('^\\-', change) & change != "0%" & !is.na(change), paste0("+", change, HTML(" ▲")), change),
change = ifelse(grepl('^\\-', change), paste0(change, HTML(" ▼")), change),
change = ifelse(change == "0%", paste0(change, HTML(" ▶")), change),
change2 = ifelse(!grepl('^\\-', change2) & change2 != "0%" & !is.na(change2), paste0("+", change2, HTML(" ▲")), change2),
change2 = ifelse(grepl('^\\-', change2), paste0(change2, HTML(" ▼")), change2),
change2 = ifelse(change2 == "0%", paste0(change2, HTML(" ▶")), change2)) %>%
filter(Date == dates_max,
!is.na(Price)) %>%
select(-Date) %>%
mutate(Price = format(Price, big.mark=","),
change2 = replace_na(change2, "NA")) %>%
#mutate(change = ifelse(change > 0, change, paste0("\u25BA", change)))%>%
rename("Price (in IQD)" = Price,
"Bi-monthly change" = change,
"Yearly change" = change2)
prices_changes_items <- prices_changes %>%
filter(!str_detect(Item, "^SMEB"))
prices_changes_meb <- prices_changes %>%
filter(str_detect(Item, "^SMEB")) %>%
arrange(Item)
data_latest <- data %>% # latest dataset for download on dashboard page
filter(date == dates_max) %>%
select(-(106:ncol(data)), -ends_with("_restock"))
jram <- jram %>%
filter(GPS_Coordinates != "") %>% # delete entries without coordinates from JRAM dataset
separate(GPS_Coordinates, c("lat","lon"), ",", convert = TRUE) %>% # divide coordinates into latitude and longitude
mutate(Link_to_Assessment = ifelse(Link_to_Assessment == "", "", paste0("<a href=", Link_to_Assessment, ">link</a>"))) %>%
mutate(popup_data = paste0('<strong>Lead partner: </strong>', Lead_Partner, # define pop up window contents
'<br><strong>Governorate:</strong> ', Governorate,
'<br><strong>Location:</strong> ', Location,
'<br><strong>Market:</strong> ', Market,
'<br><strong>Date:</strong> ', format(Date, "%B %Y"),
'<br><strong>Other partners involved:</strong> ', Other_partners_involved,
'<br><strong>Info:</strong> ', Info,
'<br><strong>Contact name:</strong> ', Contact_Name,
'<br><strong>Contact email:</strong> <a href=mailto:', Contact_Email, '>', Contact_Email, '</a>',
'<br><strong>Link to assessment:</strong> ', Link_to_Assessment),
label = paste0(Location, " - ", Lead_Partner, " (", format(Date, "%b %Y"),")") # define hover label contents
)
#### * 5.2 Dashboard tables ######################################################
smeb <- data.frame(Category = c(rep("Food Items", 7), rep("Non-Food Items", 8), rep("Water", 2)), # define SMEB content table
Item = c("Bulgur", "Lentils", "Rice", "Salt", "Sugar", "Vegetable oil",
"Wheat flour", "Bath soap", "Adult toothbrush", "Child toothbrush",
"Detergent", "Garbage bags", "Sanitary napkins", "Shampoo",
"Toothpaste", "Water trucking", "Drinking water"),
Quantity = c("5 kg", "10 kg", "15 kg", "0.75 kg", "6 kg", "4.55 L", "30 kg",
"6 x 125 g", "3 units", "3 units", "1 kg", "1 pack (20)",
"4 packs (32)", "1 x 500 ml", "1 x 75 ml", "47 L/person",
"3 L/person"))
smeb_kbl <- smeb %>% # make a html (kable) object out of dataframe
kbl(escape = F) %>%
kable_styling(bootstrap_options = c("hover", "condensed", "striped"), fixed_thead = T, full_width = F) %>%
column_spec(1, width = "8em", bold = T, background = "white") %>%
column_spec(2, width = "10em") %>%
column_spec(3, width = "8em") %>%
collapse_rows(columns = 1, valign = "top")
table_changes_meb <- prices_changes_meb %>% # style key figures table
kbl(escape = F, format.args = list(big.mark = ","), align = "lrrr") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"), fixed_thead = T, full_width = F) %>%
column_spec(1, width = "7em") %>%
column_spec(3, color = ifelse(grepl('^\\+', prices_changes_meb$'Bi-monthly change'), "red", ifelse(grepl('^\\-', prices_changes_meb$'Bi-monthly change'), "green", "auto"))) %>%
column_spec(4, color = ifelse(grepl('^\\+', prices_changes_meb$'Yearly change'), "red", ifelse(grepl('^\\-', prices_changes_meb$'Yearly change'), "green", "auto")))
month_collected <- paste0(format(dates_max, "%B"), " ",format(dates_max, "%Y")) # define overview of last round
shops_covered <- nrow(data_latest)
districts_covered <- n_distinct(data_latest$district, na.rm = FALSE)
governorates_covered <- n_distinct(data_latest$governorate, na.rm = FALSE)
#governorates_covered <- paste(sort(unique(data_latest$governorate)), collapse = ", ")
overview_round <- data.frame(figure = c("Month", "Shops covered", "Districts covered", "Governorates covered"),
value = c(month_collected, shops_covered, districts_covered, governorates_covered)
)
table_round <- overview_round %>% # style overview table
kbl(escape = F, format.args = list(big.mark = ","), align = "lr", col.names = NULL) %>%
column_spec(1, width = "12em") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"), fixed_thead = T, full_width = T) %>%
row_spec(1, extra_css = "border-top: 2px solid gainsboro")
table_changes <- prices_changes_items %>% # style item table
kbl(escape = F, format.args = list(big.mark = ","), align = "lrrr") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"), fixed_thead = T, full_width = F) %>%
column_spec(1, width = "13em") %>%
column_spec(3, color = ifelse(grepl('^\\+', prices_changes_items$'Bi-monthly change'), "red", ifelse(grepl('^\\-', prices_changes_items$'Bi-monthly change'), "green", "auto"))) %>%
column_spec(4, color = ifelse(grepl('^\\+', prices_changes_items$'Yearly change'), "red", ifelse(grepl('^\\-', prices_changes_items$'Yearly change'), "green", "auto"))) %>%
row_spec(c(7, 9, 17), extra_css = "border-bottom: 2px solid gainsboro")
#### 6 UI ######################################################################
ui <- bootstrapPage(
# ensure that the 6th element in the tab bar (JRAM) is right-aligned (some CSS does the trick)
#tags$head(tags$style(HTML("
# .navbar-nav {
# float: none !important;
# }
# .navbar-nav > li:nth-child(6) {
# float: right;
# }
# "))),
navbarPage("Joint Price Monitoring Initiative (JPMI)", # define dashboard title
theme = shinytheme("simplex"), # set theme
#### * 6.1 Home ######################################################################
tabPanel("Dashboard", # define panel title
icon = icon("tachometer-alt"), # select icon to be displayed in front of title
div(class="dashboard", # set dashboard class from CSS file
tags$head(includeCSS("styles.css")), # load CSS stylesheet
leafletOutput("map_home", width = "100%", height = "100%"), # display background map
absolutePanel( # define introduction box
id = "home", class = "panel panel-default", fixed = FALSE, draggable = FALSE,
top = "20", left = "20", right = "auto", bottom = "auto", width = "400", height = "auto",
h4("Introduction"),
p("The Joint Price Monitoring Initiative (JPMI) is a bi-monthly data collection exercise launched by the Iraq Cash Working Group (CWG)
in November 2016. The initiative aims to inform cash-based interventions in Iraq by providing indicative information on key commodities
sold in local marketplaces. The initiative is guided by the CWG, led by REACH and supported by the CWG members.",
style="text-align:justify"),
p("This website displays a wide range of indicators collected through the JPMI, such as prices for key food
and non-food items (NFIs), as well as the costs associated with the Survival Minimum Expenditure Basket (SMEB).",
style="text-align:justify"),
p(tags$i(h6("Refer to the tools displayed in the panel above if you wish to analyse disaggregated data.
Display price data over time with the Price Plot, do spatial analysis with the Map, or
discover the data with the Data Explorer. See Info for more on the JPMI.",
style="color:grey;text-align:justify"))),
br()
),
absolutePanel( # define chart box
id = "home", class = "panel panel-default", fixed = FALSE, draggable = FALSE,
top = "393", left = "20", right = "auto", bottom = "auto", width = "400", height = "auto",
hchart(prices_country_home, "line", # define chart
hcaes(x = Date, y = Price, group = Item)) %>%
hc_yAxis(min = 0, title = list(text = "")) %>%
hc_xAxis(title = "", labels = list(align = "center")) %>%
hc_size(height = "253") %>%
hc_title(
text = "Overall Median SMEB Over Time (in IQD)",
margin = 10,
align = "left",
style = list(fontSize = 15)
) %>%
hc_colors(cols) %>%
hc_legend(style = list(fontSize = 8))
),
absolutePanel(
id = "home", class = "panel panel-default", fixed = FALSE, draggable = FALSE,
top = "20", left = "440", right = "auto", bottom = "auto", width = "350", height = "240",
h4("Key Figures"),
HTML(table_changes_meb), br()
),
absolutePanel(
id = "home", class = "panel panel-default", fixed = FALSE, draggable = FALSE,
top = "280", left = "440", right = "auto", bottom = "auto", width = "350", height = "195",
h4("Latest Round"),
HTML(table_round), br()
),
absolutePanel(
id = "home", class = "panel panel-default", fixed = FALSE, draggable = FALSE,
top = "495", left = "440", right = "auto", bottom = "auto", width = "350", height = "173",
h4("Data Download"),
"Visit the Data Explorer or download the full dataset from the latest round here:",
br(), br(),
downloadButton("downloadDataLatest",
paste0("Download ", format(dates_max, "%B"), " ", format(dates_max, "%Y"), " dataset")),
br(), br()
),
absolutePanel(
id = "home", class = "panel panel-default", fixed = FALSE, draggable = FALSE,
top = "20", left = "810", right = "auto", bottom = "auto",
width = "427",
h4("Overall Median Item Prices"),
HTML(table_changes), br()
),
absolutePanel(id = "dropdown", top = 47, left = 560, width = 200, fixed=FALSE, draggable = FALSE, height = "auto",
dropdown(
h4("SMEB contents"),
column(
HTML(smeb_kbl),
width = 7),
column(p(h6("The Survival Minimum Expenditure Basket (SMEB) represents the minimum culturally adjusted group of items
required to support a six-person Iraqi household for one month, as defined by the CWG.")),
p(h6("The SMEB reported on this website only includes the food, NFI and water components. Not included are rent,
electricity, communication and transportation.")),
p(h6("The composition of the SMEB was revised twice: 1) In the September
2018 round and onwards, the current water component replaced the fuel component. 2) Since January 2020,
the SMEB furthermore includes modified food and NFI components.")),
p(h6("More details on the SMEB can be found here:",
tags$a(href="https://www.humanitarianresponse.info/en/operations/iraq/document/survival-minimum-expenditure-basket-technical-guidance-note-october-2019",
"SMEB Guidance Note"), ".")),
width = 5),
width = "650px",
tooltip = tooltipOptions(title = "Click to see more details about the SMEB."),
size = "xs",
up = FALSE,
style = "jelly", icon = icon("info"),
animate = animateOptions(
enter = "fadeInDown",
exit = "fadeOutUp",
duration = 0.5)
)
),
# display CWG & REACH logos on bottom left
absolutePanel(id = "logo", class = "card", bottom = 15, left = 20, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.humanitarianresponse.info/en/operations/iraq/cash-working-group',
tags$img(src='cwg.jpg', height='30'))),
absolutePanel(id = "logo", class = "card", bottom = 15, left = 150, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.reach-initiative.org', tags$img(src='reach.jpg', height='30'))),
# display partner logos on bottom right
absolutePanel(id = "logo", class = "card", bottom = 14, right = 20, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.clovekvtisni.cz/en/', tags$img(src='pin.png', height='35'))),
absolutePanel(id = "logo", class = "card", bottom = 14, right = 80, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.oxfam.org/en', tags$img(src='oxfam.png', height='35'))),
absolutePanel(id = "logo", class = "card", bottom = 11, right = 130, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.nrc.no/', tags$img(src='nrc.png', height='40'))),
absolutePanel(id = "logo", class = "card", bottom = 15, right = 270, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.mercycorps.org/', tags$img(src='mercycorps.png', height='35'))),
absolutePanel(id = "logo", class = "card", bottom = 15, right = 380, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.rescue.org/', tags$img(src='irc.png', height='34'))),
absolutePanel(id = "logo", class = "card", bottom = 14, right = 430, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://harikar.org/', tags$img(src='harikar.png', height='35'))),
absolutePanel(id = "logo", class = "card", bottom = 19, right = 480, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://drc.ngo/', tags$img(src='drc.png', height='25'))),
absolutePanel(id = "logo", class = "card", bottom = 14, right = 560, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.care-international.org/', tags$img(src='care.png', height='37'))),
absolutePanel(id = "logo", class = "card", bottom = 18, right = 610, fixed=TRUE, draggable = FALSE, height = "auto",
tags$a(href='https://www.acted.org/en/', tags$img(src='acted.png', height='25')))
) # close dashboard class
), # close dashboard tabpanel
#### * 6.2 Plot ######################################################################
tabPanel("Price Plot", # set panel title
icon = icon("chart-line"), # select icon
chooseSliderSkin(skin = "Nice", color = NULL), # set theme for sliders
sidebarLayout(
sidebarPanel(
tags$i(h6("Note: Reported prices are indicative only.", style="color:#045a8d")),
pickerInput("plot_aggregation",
label = "Aggregation level:",
choices = c("District", "Governorate", "Country"),
selected = "District",
multiple = FALSE
),
hr(),
conditionalPanel(condition = "input.plot_aggregation == 'District'",
radioGroupButtons("plot_by_district_item",
label = "Group by:",
choices = c("Item", "District"),
selected = "Item",
justified = TRUE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'Governorate'",
radioGroupButtons("plot_by_governorate_item",
label = "Group by:",
choices = c("Item", "Governorate"),
selected = "Item",
justified = TRUE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'District' & input.plot_by_district_item == 'District'",
pickerInput("select_bydistrict_district",
label = "District(s):",
choices = lapply(split(plot_location_list$District, plot_location_list$Governorate), as.list),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = c("Al-Falluja"),
multiple = TRUE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'District' & input.plot_by_district_item == 'District'",
pickerInput("select_bydistrict_item",
label = "Item:",
choices = lapply(split(item_list$Item, item_list$Group), as.list),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = "SMEB",
multiple = FALSE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'Governorate' & input.plot_by_governorate_item == 'Governorate'",
pickerInput("select_bygovernorate_governorate",
label = "Governorate(s):",
choices = unique(plot_location_list$Governorate),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = c("Al-Anbar"),
multiple = TRUE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'Governorate' & input.plot_by_governorate_item == 'Governorate'",
pickerInput("select_bygovernorate_item",
label = "Item:",
choices = lapply(split(item_list$Item, item_list$Group), as.list),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = "SMEB",
multiple = FALSE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'Country' | (input.plot_aggregation == 'Governorate' & input.plot_by_governorate_item == 'Item') | (input.plot_aggregation == 'District' & input.plot_by_district_item == 'Item')",
pickerInput("select_byitem_item",
label = "Item(s):",
choices = lapply(split(item_list$Item, item_list$Group), as.list),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = c("SMEB", "SMEB food", "SMEB NFI", "SMEB water"),
multiple = TRUE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'District' & input.plot_by_district_item == 'Item'",
pickerInput("select_byitem_district",
label = "District:",
choices = lapply(split(plot_location_list$District, plot_location_list$Governorate), as.list),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = "Al-Falluja",
multiple = FALSE
)
),
conditionalPanel(condition = "input.plot_aggregation == 'Governorate' & input.plot_by_governorate_item == 'Item'",
pickerInput("select_byitem_governorate",
label = "Governorate:",
choices = unique(plot_location_list$Governorate),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = "Al-Anbar",
multiple = FALSE
)
),
hr(),
sliderTextInput("select_date", # set date slider
"Months:",
force_edges = TRUE,
choices = dates,
selected = c(dates_min, dates_max)
),
prettySwitch(
inputId = "select_index",
label = "Index series",
status = "success",
fill = TRUE
),
conditionalPanel(condition = "input.select_index == true",
sliderTextInput("select_date_index",
"Reference Month:",
force_edges = TRUE,
choices = dates,
selected = dates_max
),
),
h6("Select aggregation level, item(s), location(s) and month from drop-down menues to update plot.
Displayed values are median prices - retail prices are first aggregated on site level and then
on district level (and then on governorate/country level)."),
absolutePanel(id = "dropdown", bottom = 20, left = 20, width = 200, # define blue info button
fixed=TRUE, draggable = FALSE, height = "auto",
dropdown(
h4("SMEB contents"),
column(
HTML(smeb_kbl),
width = 7),
column(p(h6("The Survival Minimum Expenditure Basket (SMEB) represents the minimum culturally adjusted group of items
required to support a six-person Iraqi household for one month, as defined by the CWG.")),
p(h6("The SMEB reported on this website only includes the food, NFI and water components. Not included are rent,
electricity, communication and transportation.")),
p(h6("The composition of the SMEB was revised twice: 1) In the September
2018 round and onwards, the current water component replaced the fuel component. 2) Since January 2020,
the SMEB furthermore includes modified food and NFI components.")),
p(h6("More details on the SMEB can be found here:",
tags$a(href="https://www.humanitarianresponse.info/en/operations/iraq/document/survival-minimum-expenditure-basket-technical-guidance-note-october-2019",
"SMEB Guidance Note"), ".")),
width = 5),
width = "650px",
tooltip = tooltipOptions(title = "Click to see more details about the SMEB."),
size = "xs",
up = TRUE,
style = "jelly", icon = icon("info"),
animate = animateOptions(
enter = "fadeInLeftBig",
exit = "fadeOutLeft",
duration = 0.5)
)
),
width = 3, # set bootstrap width of sidebar (out of 12)
), # close sidebar panel
mainPanel(
tags$i(textOutput("plot_text"), style = "color: red"), # display error message displayed if there is no data available
highchartOutput("graph", width = "100%", height = "600px"), # display large chart
width = 8 # set width of main panel (out of 12, as per bootstrap logic)
)
)),
#### * 6.3 Map ######################################################################
tabPanel("Map", icon = icon("map"),
div(class="outer",
tags$head(
# Include our custom CSS
includeCSS("styles.css")
),
leafletOutput("map", width = "100%", height = "100%"),
absolutePanel(
id = "controls", class = "panel panel-default", fixed = TRUE, draggable = FALSE, top = "130", left = "12", right = "auto", bottom = "auto",
width = 300, height = "auto",
pickerInput("map_indicator_select",
label = "Indicator:",
choices = c("Prices", "Availability and Challenges"),
selected = "Prices",
multiple = FALSE
),
conditionalPanel(condition = "input.map_indicator_select == 'Prices'",
pickerInput("map_item_select",
label = "Item:",
choices = lapply(split(item_list$Item, item_list$Group), as.list),
selected = "SMEB",
options = list(`actions-box` = TRUE),
multiple = FALSE
)
),
conditionalPanel(condition = "input.map_indicator_select == 'Availability and Challenges'",
pickerInput("map_addindicator_select",
label = HTML("Availability and Challenges:<br><i>(% of assessed traders)</i>"),
choices = sort(indicator_list),
selected = "% of traders reporting harmful supply route change in past 30 days",
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
multiple = FALSE
)
),
sliderTextInput("map_date_select",
"Month:",
force_edges = TRUE,
choices = dates,
selected = dates_max,
animate = TRUE
) # close sliderTextInput
), # close absolutePanel
absolutePanel(id = "no_data", fixed = TRUE, draggable = FALSE, top = 50, left = 0, right = 0, bottom = 0,
width = "550", height = "20",
tags$i(h4(textOutput("map_text"), style = "color: red; background-color: white;"))
),
conditionalPanel(condition = "input.map_indicator_select == 'Prices' & (input.map_item_select == 'SMEB' | input.map_item_select == 'SMEB food' | input.map_item_select == 'SMEB NFI' | input.map_item_select == 'SMEB water' |
input.map_item_select == 'SMEB (pre-2020)' | input.map_item_select == 'SMEB food (pre-2020)' | input.map_item_select == 'SMEB NFI (pre-2020)' | input.map_item_select == 'SMEB water (pre-2020)')",
absolutePanel(id = "dropdown", bottom = 20, left = 20, width = 200, # define blue info button
fixed=TRUE, draggable = FALSE, height = "auto",
dropdown(
h4("SMEB contents"),
column(
HTML(smeb_kbl),
width = 7),
column(p(h6("The Survival Minimum Expenditure Basket (SMEB) represents the minimum culturally adjusted group of items
required to support a six-person Iraqi household for one month, as defined by the CWG.")),
p(h6("The SMEB reported on this website only includes the food, NFI and water components. Not included are rent,
electricity, communication and transportation.")),
p(h6("The composition of the SMEB was revised twice: 1) In the September
2018 round and onwards, the current water component replaced the fuel component. 2) Since January 2020,
the SMEB furthermore includes modified food and NFI components.")),
p(h6("More details on the SMEB can be found here:",
tags$a(href="https://www.humanitarianresponse.info/en/operations/iraq/document/survival-minimum-expenditure-basket-technical-guidance-note-october-2019",
"SMEB Guidance Note"), ".")),
width = 5),
width = "650px",
tooltip = tooltipOptions(title = "Click to see more details about the SMEB."),
size = "xs",
up = TRUE,
style = "jelly", icon = icon("info"),
animate = animateOptions(
enter = "fadeInLeftBig",
exit = "fadeOutLeft",
duration = 0.5)
) # close dropdown
) # close absolute panel
) # close conditional panel
) # close div for class outer
), # close tab panel
#### * 6.4 Data Explorer ######################################################################
tabPanel("Data Explorer", icon = icon("table"),
sidebarLayout(
sidebarPanel(
radioGroupButtons("table_aggregation",
label = "Aggregation level:",
choices = c("District", "Key Informant"),
selected = "District",
justified = TRUE
),
conditionalPanel(condition = "input.table_aggregation != 'District'",
tags$i(h6("Note: Only district-level data can be displayed in the table on the right.
You can download data on either aggregation level by setting your desired
parameters and clicking on the download button below.",
style="color:red")),
),
hr(),
conditionalPanel(condition = "input.table_aggregation == 'District'",
pickerInput("table_show_vars",
label = "Indicators:",
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
choices = lapply(split(full_list$Item, full_list$Group), as.list),
selected = c("SMEB", "SMEB food", "SMEB NFI", "SMEB water"),
multiple = TRUE
)
),
conditionalPanel(condition = "input.table_aggregation == 'Key Informant'",
pickerInput("table_show_vars_ki",
label = "Indicators:",
choices = names(data),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = names(data),
multiple = TRUE
)
),
pickerInput("table_district",
label = "Districts:",
choices = lapply(split(plot_location_list$District, plot_location_list$Governorate), as.list),
options = list(title = "Select", `actions-box` = TRUE, `live-search` = TRUE),
selected = plot_location_list$District,
multiple = TRUE
),
sliderTextInput("table_date_select",
"Months:",
force_edges = TRUE,
choices = dates,
selected = c(dates_min, dates_max)
),
hr(),
actionButton("table_reset", "Reset filters"),
downloadButton("downloadData", "Download as CSV"),
width = 3
),
mainPanel(
DT::dataTableOutput("table", width = "100%", height = "100%"),
width = 9
)
)
),
#### * 6.5 Info ######################################################################
tabPanel("Info", icon = icon("info"),
column(
h4("Background"),
p("The Joint Price Monitoring Initiative (JPMI) was developed by the Cash Working Group (CWG) and REACH Initiative to conduct
harmonized price monitoring activities among cash actors in Iraq.",
style="text-align:justify;margin-bottom:20px"),
h4("Methodology"),
p("In each assessed marketplace, JPMI field teams record indicators on selected food and non-food items (NFIs) sold by local retailers.
Marketplaces are defined as permanent areas of commerce diverse enough to provide access to a variety of food and non-food items
(NFIs). Within each district, marketplaces are selected by partner agency field staff in order to ensure that localized knowledge
is taken into consideration. Partner staff are instructed to select primary markets within their selected districts to ensure
relevant price data is collected.",
style="text-align:justify;"),
p("Monitored commodities have been identified by the CWG based on what is typically consumed by an average Iraqi household.
All assessable commodities of the Survival Minimum Expenditure Basket (SMEB) are included. In line with the purpose of the
SMEB, only the lowest available prices are recorded for each item.",
style="text-align:justify;"),
p("All data collection is conducted through a KoBo-based mobile data collection tool. Following data collection, REACH compiles
and cleans all partner data and crosschecks outliers with field teams. The cleaned data is then uploaded and displayed
on this website. Data collection for the JPMI occurs on a bi-monthly basis with the website being updated after each round.",
style="text-align:justify;"),
p("For more details on methodology, refer to the ",
tags$a(href="https://www.impact-repository.org/document/reach/7a6169cc/reach_irq_tor_joint_price_monitoring_initiative_jpmi_july_2018_0.pdf",
"JPMI terms of reference (ToR)"), ".",
style="text-align:justify;margin-bottom:20px"),
h4("Limitations"),
p("All data is gathered by partner agencies of the JPMI. As such, the geographic coverage of the JPMI is determined by
partner capacity, ability and interest, and has changed over time. This means that the markets and districts covered
across the assessed months are not consistent. These changes in coverage could have an impact on overall reported prices.",
style="text-align:justify;margin-bottom:20px"),
h4("Contact"),
p("In case you have any questions about the JPMI, please contact:", tags$a(href="mailto:[email protected]", "[email protected]")),
br(),
tags$a(href='https://www.humanitarianresponse.info/en/operations/iraq/cash-working-group', tags$img(src = "cwg.jpg", height = "40px")), tags$a(href='https://www.reach-initiative.org', tags$img(src = "reach.jpg", height = "40px")),
width=6),
column(
h4("Current Partners"),
tags$a(href="https://www.acted.org/en/", "ACTED"), br(),
tags$a(href="https://www.care-international.org/", "CARE International"), "/", tags$a(href="https://harikar.org/", "Harikar"), br(),
tags$a(href="https://drc.ngo/", "Danish Refugee Council (DRC)"), br(),
tags$a(href="https://www.rescue.org/", "International Rescue Committee (IRC)"), br(),
tags$a(href="https://www.mercycorps.org/", "Mercy Corps"), br(),
tags$a(href="https://www.nrc.no/", "Norwegian Refugee Council (NRC)"), br(),
tags$a(href="https://www.oxfam.org/en", "Oxfam"), br(),
tags$a(href="https://www.clovekvtisni.cz/en/", "People in Need (PIN)"), br(),
br(),
h4("Previous Partners"),
tags$a(href="https://www.actioncontrelafaim.org/en/", "Action contre la Faim (ACF)"), br(),
tags$a(href="https://www.drk.de/en/", "German Red Cross (GRC)"), "/", tags$a(href="https://en.ircs.org.iq/", "Iraqi Red Crescent Society (IRCS)"), br(),
tags$a(href="https://www.medair.org/", "Medair"), br(),
tags$a(href="https://www.pah.org.pl/en/", "Polish Humanitarian Action (PAH)"), br(),
tags$a(href="https://www.qandil.org/", "Qandil"), br(),
tags$a(href="https://www.ri.org/", "Relief International (RI)"), br(),
tags$a(href="https://www.savethechildren.net/", "Save the Children"), br(),
tags$a(href="https://www.tearfund.org/", "Tearfund"), br(),
tags$a(href="https://www.tdh.ch/en", "Terre des Hommes (TdH)"), br(),
tags$a(href="https://www.trianglegh.org/index_en.php", "Triangle Génération Humanitaire (TGH)"), br(),
tags$a(href="https://www.unhcr.org/", "UNHCR"), br(),
tags$a(href="https://www.welthungerhilfe.org/", "Welthungerhilfe"), br(),
tags$a(href="https://www.worldvision.org/", "World Vision"), br(),
width=6)
),
#### * 6.6 JRAM ######################################################################
tabPanel("JRAM", icon = icon("map-marker"),
div(class="outer",
tags$head(includeCSS("styles.css")),
leafletOutput("map_jram", width = "100%", height = "100%"),
absolutePanel(
id = "controls", class = "panel panel-default", fixed = TRUE, draggable = FALSE, top = "130", left = "12", right = "auto", bottom = "auto",
width = 300, height = "auto",
pickerInput("jram_partner_select",
label = "Partners:",
choices = partner_list,
selected = partner_list,
options = list(`actions-box` = TRUE),
multiple = TRUE
),
pickerInput("jram_governorate_select",
label = "Governorates:",
choices = sort(unique(jram$Governorate)),
selected = unique(jram$Governorate),
options = list(`actions-box` = TRUE),
multiple = TRUE
),
sliderTextInput("jram_date_select",
"Months:",
choices = dates_jram,
force_edges = TRUE,
selected = c(dates_min_jram, dates_max_jram)
),
actionButton("jram_reset", "Reset filters")
),
absolutePanel(top = 50, left = 55, fixed=TRUE, draggable = FALSE, height = "auto",
dropdown(
h4("Introduction"),
p("The Joint Rapid Assessment of Markets (JRAM) was developed and launched by the Cash Working Group of
Iraq (CWG) in April 2017 in order to establish a harmonised and collaborative mechanism for conducting
market assessments in areas newly accessible to humanitarian actors. The CWG serves as the mandating
body for the assessment, with REACH Initiative (REACH) acting as a technical partner and CWG partners
carrying out all field-level data collection, analysis, and reporting. The JRAM was designed to provide
comprehensive market-level data on the impact of protracted crises on markets, specifically with respect
to the status of infrastructure, security, and suppliers; the prices and availability of key goods; and
the response capacity of traders. The data collected are then used to determine if cash and market-based
programming are appropriate intervention mechanisms. This dashboard presents the locations and lead
partners for JRAMs conducted since August 2017.", style="text-align: justify;"),
h4("Methodology"),
p("The JRAM uses a qualitative approach based on the Rapid Assessment of Markets (RAM) system developed by
the International Committee of the Red Cross (ICRC). The populations of interest are market actors in the
selected area, including wholesalers, retailers, and consumers. CWG partners identify relevant markets
for assessment based on operational relevance and feasibility. Partners use purposive sampling to identify
respondents from each of the three groups, and undertake field data collection using an ODK-based
questionnaire. Partners then clean and analyse data using tools and guidance developed by REACH.", style="text-align: justify;"),
h4("Limitations"),
p("Due to the qualitative nature of the JRAM, findings are indicative only and cannot be statistically
generalised to the assessed area. Findings are also relevant only to the specified markets and should not
be regarded as indicative of market functionality elsewhere in Iraq.", style="text-align: justify;"),
h4("Disclaimer"),
p("All responsibility for data quality, analysis, interpretation, and outputs lies with the implementing
partner who led the JRAM. REACH does not validate partner data, analysis, or findings. Providing links
to publicly available results therefore does not necessarily imply endorsement by REACH.", style="text-align: justify;"),
width = "800px",
#size = "sm",
up = FALSE,
style = "jelly", icon = icon("info"),
tooltip = tooltipOptions(placement = "right", title = "Click to see more information about the JRAM."),
animate = animateOptions(
enter = "fadeInLeft",
exit = "fadeOutLeft",
duration = 0.5)