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

Error in jsonlite::fromJSON(file = treemapFile) argument "txt" is missing, with no default #726

Open
chgl opened this issue May 24, 2023 · 9 comments

Comments

@chgl
Copy link
Contributor

chgl commented May 24, 2023

When running the latest version of Achilles, v1.7.2:

Error in jsonlite::fromJSON(file = treemapFile) : 
argument "txt" is missing, with no default
Calls: exportToJson -> generateConditionReports -> <Anonymous>

I believe this is a regression caused in de786a6 since the jsonlite fromJSON function definition requires a parameter called txt (which apparently can be a URL or file path as well): https://github.com/jeroen/jsonlite/blob/7287acf3925392c33b523c76dedd5fed631971a3/R/fromJSON.R#L44.

I could find the following 4 instances of fromJSON using GitHub's search: https://github.com/search?q=repo%3AOHDSI%2FAchilles%20fromJson&type=code

With https://github.com/OHDSI/Broadsea-Atlasdb it might be possible to create a basic integration test for running Achilles against a DB as part of the CI?

@thunders1984
Copy link

we got the same issue when trying to generate json file using Achilles::exportToJson.
the error : Generating condition reports
Error in jsonlite::fromJSON(file = treemapFile) :
argument "txt" is missing, with no default
is there any solution or some guide how to fix it.

@Jananiaridhia
Copy link

Hi , is there any solution identified for the above problem ? Currently we are having same issue while generating report through Achilles .

@chrisknoll
Copy link
Contributor

chrisknoll commented Jan 10, 2024

I added a comment to the PR, I don't think the PR addresses this since you can't remove file = and have the value passed in as the first param (the json text) and have it just work.

Secondly, there is no parameter named 'txt' in the function signature of jsonlite::fromJSON() I think this error is from somewhere else.

We need the full stack trace to know what the exact line is that is reporting the error. the message Calls: exportToJson -> generateConditionReports -> <Anonymous> gives us some info, but we need to know where the <Annonymous> call is

@PieterMaertens
Copy link

The full stack trace:

traceback()
3: jsonlite::fromJSON(file = treemapFile)
2: generateConditionReports(conn, connectionDetails$dbms, cdmDatabaseSchema,
resultsDatabaseSchema, outputPath, vocabDatabaseSchema)
1: exportToJson(connectionDetails, cdmDatabaseSchema = "omopcdm",
resultsDatabaseSchema = "results", vocabDatabaseSchema = "omopcdm",
outputPath = "/exportToJson", compressIntoOneFile = FALSE)

and signature of jsonlite::fromJSON(), package version 1.8.8

jsonlite::fromJSON
function (txt, simplifyVector = TRUE, simplifyDataFrame = simplifyVector,
simplifyMatrix = simplifyVector, flatten = FALSE, ...)

@actualben
Copy link

As @Blappchri pointed out in #743, this is because we're calling jsonlite::fromJSON using rjson::fromJSON's signature

rjson::fromJSON:

fromJSON( json_str, file, method = "C", unexpected.escape = "error", simplify = TRUE )

jsonlite::fromJSON:

fromJSON( txt, simplifyVector = TRUE, simplifyDataFrame = simplifyVector, simplifyMatrix = simplifyVector, flatten = FALSE, ...)

@Volpym
Copy link

Volpym commented Jan 31, 2024

Since the PR hasn't been reviewed yet, I removed the Achilles from my HADES instance and installed @ziporah 's #743. But I still got the same error. Am I missing something?

@Blappchri
Copy link

Note that the branch isn't mine, @ziporah developed it. I am just the one being annoying about getting this issue fixed^^. I have not verified myself that the branch works in its entirety, but based on the code it is fixing the thing that need to be changed. I myself have used a workaround based on using trace() to rewrite the fromJSON function to how Achilles assumes it works within my R session.

@Volpym
Copy link

Volpym commented Feb 1, 2024

Sorry for the confusion, I edited my comment

Bunnynova added a commit to AncillaPartners/Achilles that referenced this issue Feb 2, 2024
User ziporah created a pull request on the original OHDSI/Achilles repository to fix issue OHDSI#726.
Bunnynova added a commit to AncillaPartners/Achilles that referenced this issue Feb 2, 2024
User ziporah created a pull request on the original OHDSI/Achilles repository to fix issue OHDSI#726.
@KAR2022
Copy link

KAR2022 commented Jul 26, 2024

We are getting the same error :(
I am unable to find the function exportToJson.R inside Achilles package directory to make the edits per PR.
Any thoughts on this?

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

9 participants