Coder Social home page Coder Social logo

lab2godata's Issues

match_cases() example not working with lab data

Problem statement:

The match_cases() function example is not working. It appears that there is a bug in godataR::get_labresults_epiwindow(). Although this function is able to retrieve the lab data from Go.Data, the case information based on a query with a list of Go.Data case IDs is failing to export (the export log ID returns NULL).

Here is the json query that is failing:

{
  "filter": {
    "where": {
      "visualId": {
        "$in": ["C-2022-0002", "C-2022-0003", "C-2022-0004"]
      },
      "useDbColumns": "true",
      "dontTranslateValues": "true",
      "jsonReplaceUndefinedWithNull": "true"
    },
    "fields": ["id", "visualId", "firstName", "lastName", "dob", "age.years", "documents.number", "dateOfReporting", "dateOfOnset", "type"]
  }
} 

This query is passed to cases/exports/ as below:

# Send the Go.Data case ID query to Go.Data and fetch the export log ID:
    elid = httr::POST(url =

                        # Construct request API URL:
                        paste0(url,
                               "api/outbreaks/",
                               outbreak_id,
                               "/cases/export?access_token=",
                               get_access_token(url = url,
                                                username = username,
                                                password = password)),
                      # Set the content type:
                      httr::content_type_json(),

                      # Add query:
                      body = query_json_c,
                      encode = "raw") %>%

      # Fetch content:
      httr::content() %>%

      # Extract export log ID from content:
      purrr::pluck("exportLogId")

Add option to save user settings in lab2godata and load at next session

Problem statement:

The lab2godata shiny app currently has quite a number of options to fill - this means a lot of selections for the user, which could be tedious if they have to reselect all the parameters each time they use the app.

Proposed solution:

Save user inputs as a .rda file, which if present on the user's computer, will automatically load the next time the app is launched.

Note the following:

  • A Shiny bookmark is not appropriate for this use case, as the app is hosted on the user's own computer, not a server.
  • Hard-coding to search for the .rda file, load it if it exists and apply the saved inputs is a more appropriate approach.
  • The .rda file is loaded at the top of the script, outside of the UI and server (if it exists).
  • For mapped variables, the code will first check if the saved variable names exist in the file uploaded by the user; if yes, those variable names will show as already selected on the relevant drop-down menus.
  • Sensitive data (such as Go.Data user name and password) will not be saved in the .rda file; the user will have to enter these each time they launch the app.
  • Once they are satisfied with the output, the user can choose to save settings by pressing on the 'Save settings' button.
  • If the user changes the matchcols input parameter during a session, the variable names to map will automatically change and they will have to select the relevant new variable(s) from the drop-down list.

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.