Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match_cases() example not working with lab data #1

Open
AmyMikhail opened this issue Oct 10, 2022 · 1 comment
Open

match_cases() example not working with lab data #1

AmyMikhail opened this issue Oct 10, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@AmyMikhail
Copy link
Contributor

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")

@AmyMikhail AmyMikhail added the bug Something isn't working label Oct 10, 2022
@AmyMikhail AmyMikhail self-assigned this Oct 10, 2022
@AmyMikhail
Copy link
Contributor Author

Update:

The godataR::get_labresults_epiwindow() function is working fine, but there is currently a problem with the WHO servers that house R13 and R21 instances of Go.Data not accepting the dollar sign in POST requests where the JSON query is in the body of the request and the $in condition has been used. This may not be a problem on other servers, but the solution applied here will also be informative if other users encounter this issue on their own servers. Solving it will also help to ensure that the WHO servers can be used to demonstrate the full functionality of the lab2godata app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant