OHDSI Home | Forums | Wiki | Github

Error generating condition reports for Acillies

Hi folks,

We initially had the Achilles application working against our system by populating just the person and observation period tables. As part of our ‘expansion’, we recently populated the condition_occurance table as well.

However, now we seem to be running into issues in generating the json files for the Achilles application.

I run the following commands which execute successfully.

connectionDetails ← createConnectionDetails(dbms=“postgresql”, server=“localhost/demo”, port=“5432”, user=“snkasthu”, password=“root”, schema=“public”)

achillesResults ← achilles (connectionDetails, cdmDatabaseSchema=“public”, resultsDatabaseSchema=“public”, sourceName="", smallcellcount=1, cdmVersion=“5”)

However, the following runs into problems.

exportToJson(connectionDetails=connectionDetails, cdmDatabaseSchema=“public”, resultsDatabaseSchema=“public”, cdmVersion=“5”, outputPath="/Users/snkasthu/Downloads/AchillesWeb-master/data/SAMPLE")

I get the following errors, which seem to indicate some sort of casting issue? :frowning:

Connecting using PostgreSQL driver
Generating condition treemap
|======================================================================| 100%
Generating condition reports
| | 0%Error executing SQL: Error in rJava::.jcall(s, “Ljava/sql/ResultSet;”, “executeQuery”, as.character(query)[1]): org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying * integer
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 92

An error report has been created at /Users/snkasthu/errorReport.txt
Error in value[3L] : no loop for break/next, jumping to top level

errorReport.txt reads as follows:

DBMS:
postgresql

Error:
org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying * integer
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 92

SQL:
SELECT c1.concept_id AS concept_id,
c1.concept_name as concept_name,
cast(num_stratum_4 * 10 AS VARCHAR) || ‘-’ || cast((num_stratum_4 + 1) * 10 - 1 AS VARCHAR) AS trellis_name, --age decile
c2.concept_name AS series_name, --gender
num_stratum_2 AS x_calendar_year, – calendar year, note, there could be blanks
ROUND(CAST(1000 * (1.0 * num_count_value / denom_count_value) AS NUMERIC), 5) AS y_prevalence_1000pp --prevalence, per 1000 persons
FROM (
SELECT num.stratum_1 AS num_stratum_1,
num.stratum_2 AS num_stratum_2,
num.stratum_3 AS num_stratum_3,
num.stratum_4 AS num_stratum_4,
num.count_value AS num_count_value,
denom.count_value AS denom_count_value
FROM (
SELECT *
FROM ACHILLES_results
WHERE analysis_id = 404
AND stratum_3 IN (‘8507’, ‘8532’)
) num
INNER JOIN (
SELECT *
FROM ACHILLES_results
WHERE analysis_id = 116
AND stratum_2 IN (‘8507’, ‘8532’)
) denom
ON num.stratum_2 = denom.stratum_1
AND num.stratum_3 = denom.stratum_2
AND num.stratum_4 = denom.stratum_3
) tmp
INNER JOIN public.concept c1
ON num_stratum_1 = CAST(c1.concept_id as VARCHAR)
INNER JOIN public.concept c2
ON num_stratum_3 = CAST(c2.concept_id as VARCHAR)
ORDER BY c1.concept_id,
num_stratum_2

R version:
R version 3.2.0 (2015-04-16)

Platform:
x86_64-apple-darwin13.4.0

Attached base packages:

  • stats
  • graphics
  • grDevices
  • utils
  • datasets
  • methods
  • base

Other attached packages:

  • Achilles (1.0)
  • rjson (0.2.15)
  • DatabaseConnector (1.3.0)
  • RJDBC (0.2-5)
  • rJava (0.9-7)
  • DBI (0.3.1)
  • SqlRender (1.1.2)

I know there were some Postgres CAST issues for HERACLES. @Chris_Knoll might be able to clarify if these same issues are at work in the Achilles exports.

1 Like

Sorry about that! Some changes made to the code a little while back meant it no longer ran on Postgres. I think I fixed all of it (simple tests on Postgres now work fine). Could you try reinstalling Achilles and try again? Make sure you have only one new instance of R open when you reinstall.

1 Like

Thank you, will try that :sunny:

Hi there!

I want to report that the export to json process works fine now.
However, there’s some changes made to the datasources.json file that seem to break things.

I noticed that whereas this file used to look like:{ “datasources”:[ { “name”:“demo”, “folder”:“SAMPLE” } ] }
It now looks like: { datasources:[ { name:“demo”, folder:“SAMPLE” } ] }

Note that the newer version doesn’t have double quotes. This seems to break things, and the webpage refused to load. And so, I had to switch to the older version (with quotes) for it to work…

We don’t provide or bundle a datasources.json file. You make that one yourself. The instructions on the git page indicates quotes around the file (as proper JSON syntax requires). Where did you get your datasources.json file?

-Chris

Ok, in that case its probably that I edited the file later at some stage. I believed that the json file was replaced by each OHDSI application, sorry :frowning:

t