OHDSI / OhdsiShinyModules

An R package containing Shiny modules used by various OHDSI Shiny apps
https://ohdsi.github.io/OhdsiShinyModules/
8 stars 11 forks source link

Prediction protocol does not work #366

Open egillax opened 1 month ago

egillax commented 1 month ago

After fixing #365 locally when trying to generate prediction report/protocol (after pressing view Report on a modelDesign) I get the following error:

FreeMarker template error: The following has evaluated to null or missing: ==> primaryCriteria [in template "cohortExpression.ftl" at line 17, column 8]

with the following java stack trace:

freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
    at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
    at freemarker.core.UnexpectedTypeException.newDescriptionBuilder(UnexpectedTypeException.java:85)
    at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:48)
    at freemarker.core.NonHashException.<init>(NonHashException.java:49)
    at freemarker.core.Dot._eval(Dot.java:48)
    at freemarker.core.Expression.eval(Expression.java:101)
    at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:99)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
    at freemarker.core.Environment.visit(Environment.java:334)
    at freemarker.core.Environment.visit(Environment.java:340)
    at freemarker.core.Environment.process(Environment.java:313)
    at freemarker.template.Template.process(Template.java:383)
    at org.ohdsi.circe.cohortdefinition.printfriendly.MarkdownRender.renderCohort(MarkdownRender.java:43)
    at org.ohdsi.circe.cohortdefinition.printfriendly.MarkdownRender.renderCohort(MarkdownRender.java:52)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at RJavaTools.invokeMethod(RJavaTools.java:399)

the following line from the stacktrace at org.ohdsi.circe.cohortdefinition.printfriendly.MarkdownRender.renderCohort(MarkdownRender.java:43) seems to indicate this is coming from the following line in inst/patient-level-prediction-document/plp-participants.Rmd

markdown <- tryCatch(
  {CirceR::cohortPrintFriendly(target$expression)}, 
  error = function(e) return('')
)

In the intermediate files I also see the from the generated output that it failed in plp-participants.Rmd

egillax commented 1 month ago

Would it also be possible to add a test for the plp report so this won't regress when this is fixed ?