Code Monkey home page Code Monkey logo

odb's People

Contributors

cywhale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

odb's Issues

[Todo] User feedback to improve citation list on overlapping points.

That's, there're different surveys on the same sampling site, but the BioQuery now always list only one (top one layer on leaflet).

And some other feedback comments:

ToDo List 2018/11/01

  1. List all citation (data sources) on the overlapping points.
  2. Let users can download citation lists in both Species Geographic Distribution and Species Composition Analyses Modes.

Bugs 2018/11/01

  1. Language setting changes will clear the column of species query (select2Input in Rshiny)

Both R shiny and integrated js front-end need DataTables UI, but loading js not in order

Button extension for DataTables js, see
https://datatables.net/extensions/buttons/examples/initialisation/export.html
Similar question such as (not exactly the same for my question):
https://stackoverflow.com/questions/37966718/datatables-export-to-excel-button-is-not-showing

Need call js in order to make buttons (csv, pdf, for table download) of datatables extension work, i.e. loading the following js in order:
jquery.dataTables.min.js
dataTables.buttons.min.js
buttons.bootstrap.min.js
(and other extension e.g., buttons.flash.min.js, jszip.min.js, pdfmake.min.js...)

But one of my tabPanel (BioQuery: https://bio.odb.ntu.edu.tw/query/?bioquery ) also use R package DT that will also load jquery.dataTables.min.js intrinsically in default. If BioQuery is the first tabPanel of shiny, it will cause button extension of datatables js in other tabPanel fail. But if make other tabPanel that use button extension of datatables the first tab, and load a datatable prior to BioQuery (R package DT), all things work.

I wonder if there is another way to keep these js dependency and let me use BioQuery as the first tabPanel with co-work of button extension for datatables js.
My original code to load these js in shiny: (global.R)

library(htmltools)
datatablesDep <- htmltools::htmlDependency("dataTables", "1.10.19", #1.10.16
                                           src = c(href = "https://cdn.datatables.net/1.10.19/"),
                                           script = "js/jquery.dataTables.min.js", stylesheet = "css/jquery.dataTables.min.css"
)
jquerycsvDep <- htmltools::htmlDependency("jquery-csv", "0.8.9", #1.10.16
                                          src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.8.9/"),
                                          script = "jquery.csv.min.js"
)

fontawesomeDep <- htmltools::htmlDependency("font-awesome", "4.7.0",
                                            src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/"),
                                            stylesheet = "css/font-awesome.min.css"
)
but_datatableDep <- htmltools::htmlDependency("buttons.dataTables", "1.5.6",
                                              src = c(href = "https://cdn.datatables.net/buttons/1.5.6/"),
                                              script = "js/dataTables.buttons.min.js", stylesheet = "css/buttons.dataTables.min.css"
)
but_bootstrapDep <- htmltools::htmlDependency("buttons.bootstrap", "1.5.6",
                                              src = c(href = "https://cdn.datatables.net/buttons/1.5.6/"),
                                              script = "js/buttons.bootstrap.min.js", stylesheet = "css/buttons.bootstrap.min.css"
)
but_dt_flashDep <- htmltools::htmlDependency("buttons_flash", "1.5.6",
                                             src = c(href = "https://cdn.datatables.net/buttons/1.5.6/"),
                                             script = "js/buttons.flash.min.js"
)
but_js_zipDep <- htmltools::htmlDependency("jszip", "3.1.3", 
                                           src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/"),
                                           script = "jszip.min.js"
)
but_pdfmakeDep <- htmltools::htmlDependency("pdfmake", "0.1.53", 
                                            src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/"),
                                            script = "pdfmake.min.js"
)
but_vfs_fontsDep <- htmltools::htmlDependency("vfs_fonts", "0.1.53", 
                                              src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/"),
                                              script = "vfs_fonts.js"
)
but_html5Dep <- htmltools::htmlDependency("buttons_html5", "1.5.6",
                                          src = c(href = "https://cdn.datatables.net/buttons/1.5.6/"),
                                          script = "js/buttons.html5.min.js"
)
but_printDep <- htmltools::htmlDependency("buttons_print", "1.5.6",
                                          src = c(href = "https://cdn.datatables.net/buttons/1.5.6/"),
                                          script = "js/buttons.print.min.js"
)

in server.R

library(DT)

in ui.R

jqueryDep <- htmltools::htmlDependency("jquery", "1.12.4",
                                       src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/"),
                                       script = "jquery.min.js"
)
jqueryuiDep <- htmltools::htmlDependency("jquery-ui", "1.12.1",
                                       src = c(href = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/"),
                                       script = "jquery-ui.min.js"
)
shinyUI(function(req) { tagList(
  jqueryDep,
  jqueryuiDep, ...

  tabPanel("Open API", #div(class='hiddenx', uiOutput('jsblk_ui')),
         datatablesDep,jquerycsvDep,but_datatableDep,but_bootstrapDep,
         but_dt_flashDep,but_js_zipDep,but_pdfmakeDep,but_vfs_fontsDep,
         but_html5Dep,but_printDep,
         htmlTemplate("www/ocpu_api.html")
  ),
  tabPanel("BioQuery",...)
 )
})

Still try to find some better solutions..

R shiny: Couldn't normalize path in addResourcePath, with arguments: prefix = 'leaflet-providers-1.9.0'

[update]
NOT exactly this problem, bugs of this issue remains, keep debugging...
Seems leaflet 2.0.2 version do not have this problem, but 2.0.3 has.

[old trials]
This bug occurred when loading cached leaflet map by using R.cache::loadCache(key)
Error message is:

Error in value[[3L]]: Couldn't normalize path in addResourcePath, with arguments: prefix = 'leaflet-providers-1.9.0'; directoryPath

At beginning it seems a problem caused by R.cache saveCache error when use three-dots argument (ellipsis)
In shiny, use R.cache to memoise cached data, such as
https://github.com/cywhale/ODB/tree/master/shiny_memoised_cache
BUT when use leaflet.providers, it will pass 'prefix' arguments when passing ... in memoised function, then I guess it may cause aboving error.

Modified functions memFx() in
https://github.com/cywhale/ODB/blob/master/shiny_memoised_cache/app.R

data <- FUN(...)

by matching function call arguments like this

  ll <- list(...)  
  args <- formals(FUN)  
  argx <- ll[names(ll) %in% names(args)]
  data <- do.call(FUN, argx)

I'll test more cases to make sure it works.

Unclear issues about intra-session delay especially after querying species distribution

Shiny app url https://bio.odb.ntu.edu.tw/query

Sometimes, even all cpu cores not occupied, the user operations (such as click a button, span the advanced analyze mode window, etc) will delay behaved after seconds, or after several user operations. After suddenly recovery, these undone operations will be served.

Difficult to reproduce the unregular intrasession delayed operations.

Suspect that the causes may due to Shiny + promises + future package introduce unwanted intrasession delay? Not correctly return processing state back after future-object resolved?.

Comments about the possible causes for this issue needed.
A small clip demo how asyn feature provided by Rshiny promises and r-future package work behind BioQuery, ODB
https://twitter.com/bramasolo/status/1004242453400965120

Reference: Async process blocks shiny app within "user session"
rstudio/promises#23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.