Giter Club home page Giter Club logo

adapquest's People

Contributors

cbonesana avatar vcutrona avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

isteps-sps-lab

adapquest's Issues

Broken demo config

When I try taking the "simple" survey in the demo, I get an internal server error. Stack trace below :-)

2023-04-03 10:44:46.099 INFO  ch.idsia.adaptive.backend.controller.SurveyController            Request test initialization with accessCode=AdapQuest-Example
2023-04-03 10:44:46.163 INFO  ch.idsia.adaptive.backend.services.SessionService                Registering new session with accessCode=AdapQuest-Example userAgent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 remoteAddress=127.0.0.1
2023-04-03 10:44:46.957 INFO  ch.idsia.adaptive.backend.controller.SurveyController            Request status for token=2b53921d-602d-42a8-93ac-d06200578455
2023-04-03 10:44:47.155 INFO  ch.idsia.adaptive.backend.controller.SurveyController            User with token=2b53921d-602d-42a8-93ac-d06200578455 request a new question
2023-04-03 10:44:47.252 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: no such vertex in graph: -1] with root cause
java.lang.IllegalArgumentException: no such vertex in graph: -1
	at org.jgrapht.graph.AbstractGraph.assertVertexExist(AbstractGraph.java:131)
	at org.jgrapht.graph.AbstractBaseGraph.outgoingEdgesOf(AbstractBaseGraph.java:484)
	at ch.idsia.crema.model.graphical.DAGModel.getChildren(DAGModel.java:257)
	at ch.idsia.crema.search.impl.DepthFirst.visit(DepthFirst.java:34)
	at ch.idsia.crema.search.impl.DepthFirst.visitAll(DepthFirst.java:25)
	at ch.idsia.crema.search.impl.DepthFirst.visit(DepthFirst.java:21)
	at ch.idsia.crema.preprocess.RemoveBarren.cutIndependent(RemoveBarren.java:131)
	at ch.idsia.crema.preprocess.RemoveBarren.executeInPlace(RemoveBarren.java:32)
	at ch.idsia.crema.inference.bp.LoopyBeliefPropagation.preprocess(LoopyBeliefPropagation.java:90)
	at ch.idsia.crema.inference.bp.LoopyBeliefPropagation.query(LoopyBeliefPropagation.java:185)
	at ch.idsia.crema.inference.bp.LoopyBeliefPropagation.query(LoopyBeliefPropagation.java:181)
	at ch.idsia.adaptive.backend.services.commons.inference.precise.InferenceLBP.query(InferenceLBP.java:21)
	at ch.idsia.adaptive.backend.services.commons.inference.precise.InferenceLBP.query(InferenceLBP.java:16)
	at ch.idsia.adaptive.backend.services.commons.agents.AgentPreciseAdaptive.nextQuestion(AgentPreciseAdaptive.java:152)
	at ch.idsia.adaptive.backend.services.commons.agents.AgentGeneric.next(AgentGeneric.java:219)
	at ch.idsia.adaptive.backend.services.SurveyManagerService.nextQuestion(SurveyManagerService.java:113)
	at ch.idsia.adaptive.backend.controller.SurveyController.nextQuestion(SurveyController.java:346)
	at ch.idsia.adaptive.backend.controller.SurveyController$$FastClassBySpringCGLIB$$544da7d.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
	at ch.idsia.adaptive.backend.controller.SurveyController$$EnhancerBySpringCGLIB$$8d27981f.nextQuestion(<generated>)
	at ch.idsia.adaptive.backend.controller.DemoController.survey(DemoController.java:162)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:502)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:768)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:833)

AdapQuest-Example internal server error

We've deployed version 1.6.3

but when clicking the "AdapQuest-Example" survey, the screen shows an error message of "internal server error". This is the stack trace I've found in the logs---hope this helps :-)

2023-04-06 10:30:28.342 INFO  ch.idsia.adaptive.backend.controller.SurveyController            User with token=ebec1de4-fc1c-4db2-9374-fffb414a7fed request a new question
2023-04-06 10:30:28.443 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/aq].[dispatcherServlet] Servlet.service() for servlet [dispatcherServlet] in context with path [/aq] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: no such vertex in graph: -1] with root cause
java.lang.IllegalArgumentException: no such vertex in graph: -1
	at org.jgrapht.graph.AbstractGraph.assertVertexExist(AbstractGraph.java:131)
	at org.jgrapht.graph.AbstractBaseGraph.outgoingEdgesOf(AbstractBaseGraph.java:484)
	at ch.idsia.crema.model.graphical.DAGModel.getChildren(DAGModel.java:257)
	at ch.idsia.crema.search.impl.DepthFirst.visit(DepthFirst.java:34)
	at ch.idsia.crema.search.impl.DepthFirst.visitAll(DepthFirst.java:25)
	at ch.idsia.crema.search.impl.DepthFirst.visit(DepthFirst.java:21)
	at ch.idsia.crema.preprocess.RemoveBarren.cutIndependent(RemoveBarren.java:131)
	at ch.idsia.crema.preprocess.RemoveBarren.executeInPlace(RemoveBarren.java:32)
	at ch.idsia.crema.inference.bp.LoopyBeliefPropagation.preprocess(LoopyBeliefPropagation.java:90)
	at ch.idsia.crema.inference.bp.LoopyBeliefPropagation.query(LoopyBeliefPropagation.java:185)
	at ch.idsia.crema.inference.bp.LoopyBeliefPropagation.query(LoopyBeliefPropagation.java:181)
	at ch.idsia.adaptive.backend.services.commons.inference.precise.InferenceLBP.query(InferenceLBP.java:21)
	at ch.idsia.adaptive.backend.services.commons.inference.precise.InferenceLBP.query(InferenceLBP.java:16)
	at ch.idsia.adaptive.backend.services.commons.agents.AgentPreciseAdaptive.nextQuestion(AgentPreciseAdaptive.java:152)
	at ch.idsia.adaptive.backend.services.commons.agents.AgentGeneric.next(AgentGeneric.java:219)
	at ch.idsia.adaptive.backend.services.SurveyManagerService.nextQuestion(SurveyManagerService.java:120)
	at ch.idsia.adaptive.backend.controller.SurveyController.nextQuestion(SurveyController.java:341)
	at ch.idsia.adaptive.backend.controller.SurveyController$$FastClassBySpringCGLIB$$544da7d.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
	at ch.idsia.adaptive.backend.controller.SurveyController$$EnhancerBySpringCGLIB$$8d27981f.nextQuestion(<generated>)
	at ch.idsia.adaptive.backend.controller.DemoController.survey(DemoController.java:171)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:502)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:768)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:833)

Alloy demo survey charts

When taking the Alloy demo survey with AQ version 1.6.1., there were two charts in the bottom half of the screen to show progress while answering questions. With version 1.6.3 those charts are gone, they only show up again at the end of the survey. Not sure this is a bug, maybe this change was intentional? You can check out version 1.6.3 here:

Can't use SpringBoot base URL

Problem

I'd like make Adaptive Questionnaire serve its UI from a configurable root URL path. For example, given the root path of /aq, Adaptive Questionnaire would serve its home from /aq/, CSS would be at /aq/css/style.css, and so on. SpringBoot applications support this kind of setup through the server.servlet.context-path application property. But when I try using that property as in e.g. server.servlet.context-path=/aq, the UI breaks. The home page loads, but all its links are relative to / instead of the configured root path, e.g. /aq, so the browser can't fetch any dependent resources like JS, CSS, etc.

Steps to reproduce

  1. Set an env var like so: server_servlet_context-path=/aq
  2. Start Adaptive Questionnaire in the same terminal.
  3. Browse to localhost:8080, you should get a 404 since the configured root path is /aq.
  4. But when you browse to localhost:8080/aq, the home page doesn't display properly because the links in the HTML aren't prefixed with /aq. For example, <link rel="stylesheet" href="/css/style.css"> instead of <link rel="stylesheet" href="/aq/css/style.css">, <a href="/demo/" class="btn btn-primary">Go to Demo</a> instead of <a href="/aq/demo/" class="btn btn-primary">Go to Demo</a>, and so on.

Notes

It looks like the Thymeleaf templates use server-relative URLs as in e.g. fragments/layout.html

<link rel="stylesheet" th:href="@{~/css/style.css}"/>

The templating engine renders those kinds of URL paths as absolute since you might be calling another server app. On the other hand, the templating engine prefixes context-relative URLs like

<link rel="stylesheet" th:href="@{/css/style.css}"/>

(notice the missing tilde at the front) with the configured servlet context, so once rendered the link would become

<link rel="stylesheet" href="/aq/css/style.css"/>

if you set server_servlet_context-path=/aq.

So implementing a solution that honours any configured servlet context could boil down to removing tildes in front of all the URLs in the Thymeleaf templates. Plus, massaging the custom JavaScript in charts.js...

Support for multiple-answer

The current system support only one type of question: single answer in a multiple choice question.

One idea for the multiple-answer support, in other words when a user can select multiple answers, is the following:

  • each answer refers to a binary node in the network,
  • if the answer is checked, select the yes state of the node,
  • if the answer is not checked, select the no state of the node,
  • these nodes are connected with a single node, connected to the main network.

A possible alternative is to use binary encoding to map the sequence of answers to a state.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.