-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.R
105 lines (84 loc) · 5.14 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
library(shiny)
library(DT)
source("helper.r")
source("global.r")
shinyServer <- function(input, output) {
output$minutes <- renderText( {
paste ("List duration <= ",
getMinutes (input$duration, 'None', input$filterRegion),
" minutes & percentile of counts at ", input$countPercentile,
sep='')
})
output$downloadData <- downloadHandler(
filename = function() { paste('Filter_',
Sys.Date(),'_',
'.csv', sep='') },
content = function(file) {
currentfilter<-generateFilter (state = input$state,
filterRegion = input$filterRegion,
fortnightly = (input$fortnight=='Fortnight'),
duration = getMinutes (input$duration, input$state, input$filterRegion),
filterPercentile = input$countPercentile,
makeXAs1 = input$Xas1,
dataView = input$alldata)
write.csv(currentfilter, file)
}
)
output$filter <- renderDT ({currentfilter<-generateFilter (state = input$state,
filterRegion = input$filterRegion,
fortnightly = (input$fortnight=='Fortnight'),
duration = getMinutes (input$duration, input$state, input$filterRegion),
filterPercentile = input$countPercentile,
makeXAs1 = input$Xas1,
dataView = input$alldata)
},options = list(
lengthMenu = list(c(20, 50, 100, 300, 500, -1), c('20', '50', '100', '300', '500', 'All')),
pageLength = 100))
}
shinyUI <- fluidPage(
titlePanel('Filter Generator'),
fluidRow(
column(12,
p("Uses eBird data to generate a fortnightly/monthly eBird filter automatically"),
p("Created and maintained by Praveen J, Bird Count India",
a("(@Praveen J)", href = "Email:[email protected]")),
p("Last Date of Update. Data: 30 May 2021. Code: 30 May 2021. Filter Configuration: Dynamic - Managed by Bird Count India"))
),
sidebarPanel(
width = 3,
selectInput('filterRegion', 'Filter Region', choices = c("None",g_all_filters), selected = 'India--West Bengal--North'),
selectInput('state', 'State', choices = c("None",g_states$STATE), selected = firstState),
selectInput('fortnight', 'Period', c('Month', 'Fortnight')),
selectInput('alldata', 'Display Data', c("Counts Only"=1, "Lists Only"=2, "Both"=3)),
sliderInput('duration', "List Duration Percentile", min=1, max=100,
value=90, step=1, round=0),
sliderInput('countPercentile', 'Count Percentile', min=1, max=100,
value=90, step=1, round=0),
checkboxInput('Xas1', 'Consider X as 1'),
helpText('These filter suggestions are created at monthly/fortnightly scale using the aggregated eBird data from a selected region.
All lists are sorted on duration and lists below a certain duration are only considered,
as typical lists. Long lists may have bigger counts but are atypical.
All counts for each species is sorted and filter will be set at a percentile to catch only
counts above that value. This is a preference of the filter editor, as lower value would mean
longer review queues. In data poor areas, we should consider counts with X as 1, else we will
get lot of zeros, when the species is actually present. No of complete lists where it was reported
can be optionally shown in brackets based on user selection')
),
mainPanel(
headerPanel(textOutput ("minutes")),
tabsetPanel(
tabPanel("Filters", dataTableOutput('filter')),
tabPanel("About",
br(), h1("About Filter Generator"),
br(), p("eBird Central implemented filters that support custom boundaries."),
br(), p("This program is useful in creating/customising filters using existing eBird data which typically filter editors use past experience."),
br(), p("For more information on Filters, check out these articles:"),
br(), a("Understanding the eBird review and data quality process", href = "https://support.ebird.org/en/support/solutions/articles/48000795278-the-ebird-data-quality-and-review-process"),
br(), br(), a("Understanding eBird Filters", href = "https://teamebirdmichigan.wordpress.com/2014/04/04/understanding-the-ebird-filters//"),
br(), br(), a("eBird Data Quality and Review Process", href = "http://www.birdcount.in/ebird-data-quality-review/")
)
),
downloadButton('downloadData', 'Download')
)
)
shinyApp(ui = shinyUI, server = shinyServer)