OHDSI Home | Forums | Wiki | Github

Custom Feature analysis with parameters HOW TO?

I what to create a custom SQL where some parameters can be set at the Characterisation.

I have created a custom SQL Feature Analysis.
Here a working Characterisation test using it:
http://atlas-demo.ohdsi.org/#/cc/characterizations/428

I would like to change be able to edit some of the variables from the “Feature analyses parameters” option in the “Characterisation”.
Here is the example:
http://atlas-demo.ohdsi.org/#/cc/characterizations/429

However, I get the following error when executing

org.ohdsi.webapi.exception.AtlasException: org.json.JSONException: JSONObject["days_before_index"] is not a Boolean.
	at org.ohdsi.webapi.common.generation.TransactionalTasklet.execute(TransactionalTasklet.java:42)
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
	at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:272)
	at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
	at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
	at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
	at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
	at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
	at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200)
	at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
	at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:392)
	at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:135)
	at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306)
	at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.json.JSONException: JSONObject["days_before_index"] is not a Boolean.
	at org.json.JSONObject.getBoolean(JSONObject.java:523)
	at org.ohdsi.featureExtraction.FeatureExtraction.convertSettingsPrespecToDetails(FeatureExtraction.java:344)
	at org.ohdsi.featureExtraction.FeatureExtraction.createSql(FeatureExtraction.java:505)
	at org.ohdsi.featureExtraction.FeatureExtraction.createSql(FeatureExtraction.java:465)
	at org.ohdsi.cohortcharacterization.CCQueryBuilder.createFeJsonObject(CCQueryBuilder.java:507)
	at org.ohdsi.cohortcharacterization.C
1 Like

I’d post this issue to github, including the above stack trace.

The error is happening from the feature extraction code here, but the strange thing is that it’s trying to read the keys of the parameters as ‘boolean’, and there’s a bit of complicated logic happening in this code, and I don’t think it’s supporting custom parameters properly.

Tagging @schuemie @anthonysena

Just to recap: for the 1st characterization design, you are using this feature which has the time windows hard-coded: ATLAS. In the 2nd design which fails, the feature definition defines 2 new parameters: @days_before_index, @days_after_index. Then you’ve added those parameters to the main characterization design as shown here:

I think the problem here is the order of operations inside of the characterization module. Off the top of my head I’m not sure how we’re handling the custom SQL but I’d expect that the custom SQL feature would undergo some type of SqlRender::render call to properly replace the placeholders with the values in the characterization design before attempting to call FeatureExtraction.

Fully agree with @Chris_Knoll - could you post this to GitHub and we can take a look from there? Thank you!

Thanks, I thought it may be me miss understanding the system rather than a bug. This is why I posted here first. I’ll move it to github

t