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

Server error (rq1, convert_tgt_chartadvice): is.list(x) is not TRUE # In call: # timedata(tgt) #19

Closed
stefvanbuuren opened this issue Oct 23, 2023 · 1 comment

Comments

@stefvanbuuren
Copy link
Member

stefvanbuuren commented Oct 23, 2023

This error occurs in JAMES 1.5.4 and earlier when JAMES cannot find the input data. The most typical causes are:

  • the request does not upload the data correctly
  • the URL points to the wrong session number
  • the session has expired (older than 30 minutes)

Replication

Data to upload

{"Format":"3.0","organisationCode":1234,"reference":"Maria","clientDetails":[{"bdsNumber":19,"value":"2"},{"bdsNumber":20,"value":"20181011"},{"bdsNumber":82,"value":189},{"bdsNumber":91,"value":"1"},{"bdsNumber":110,"value":990},{"bdsNumber":238,"value":1670},{"bdsNumber":240,"value":1900}],"clientMeasurements":[{"bdsNumber":235,"values":[{"date":"20181111","value":380},{"date":"20181211","value":435}]},{"bdsNumber":245,"values":[{"date":"20181011","value":990},{"date":"20181111","value":1250},{"date":"20181211","value":2100}]},{"bdsNumber":252,"values":[{"date":"20181111","value":270},{"date":"20181211","value":305}]}],"nestedDetails":[{"nestingBdsNumber":62,"nestingCode":"01","clientDetails":[{"bdsNumber":63,"value":"19950704"}]},{"nestingBdsNumber":62,"nestingCode":"02","clientDetails":[{"bdsNumber":63,"value":"19901202"}]}]}
# request_site_methods.R
#
# Issue 23okt2023, AS
# Server error (rq1, convert_tgt_chartadvice): is.list(x) is not TRUE
# In call:
#   timedata(tgt)

library(jamesclient)
fn <- path.expand("~/Package/james/notes/Voorbeelddossier.txt")
host <- "https://james.groeidiagrammen.nl"
js <- read_json_js(fn)

# Create site: upload/data and manually construct URL (OK)
# Method 1
r1 <- james_post(host = host, path = "data/upload/json", txt = js)
site_url1 <- file.path(host, paste0("site?session=", r1$session))
browseURL(site_url1)

# Create site: site/request, implicit upload, manually construct URL (errors)
# Method 2 (spawns data/upload session)
r2 <- james_post(host = host, path = "/site/request/json",
                 sitehost = host, txt = fn)
site_url2 <- file.path(host, paste0("site?session=", r2$session))
browseURL(site_url2)
# The problem is that r2$session points to the site/request session,
# not to the spawned data/upload session

# Correct way:
# Create site: by site/request with implicit upload (OK)
# The return value points to the spawned data/uploaded session
browseURL(r2$parsed)

# Create site: site/request, using session input from data/upload (OK)
# Method 3 (evades manual URL construction)
r3 <- james_post(host = host, path = "/site/request/json",
                 sitehost = host, session = r1$session)
browseURL(r3$parsed)

Conclusions:

  • The pop-up "Server error ..." is a rough edge, and needs to be handled more elegantly;
  • Spawning to data/upload (method 2) does not support manual URL construction.
@stefvanbuuren
Copy link
Member Author

In JAMES 1.5.5, the error caused by browseURL(site_url2) is easy to diagnose from the "Meldingen" panel. It now informs the developer at which session location JAMES looks for the data, and that JAMES cannot find child data there.

In addition, some changes to the underlying R code were made that prevented the R error, and instead transformed these into warnings. The pop-up window is gone, and now the application falls back on the standard chart NJAH (since there are no data).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant