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

Survey Incremental Validation #35

Open
prakhar1989 opened this issue Jul 19, 2015 · 13 comments
Open

Survey Incremental Validation #35

prakhar1989 opened this issue Jul 19, 2015 · 13 comments
Labels

Comments

@prakhar1989
Copy link
Owner

Add support for incrementally validating survey by making a ajax call to runner.jar.

@prakhar1989
Copy link
Owner Author

@etosch - I have cloned and built runner.jar on my computer. Can you paste some examples on how I can run sample json survey to validate with the jar file.

@etosch
Copy link
Contributor

etosch commented Jul 20, 2015

runner.jar handles communication with backends; @jfoley threw together a
StaticAnalysisServer for running the static analyses (which includes the
validation).

  • pull the latest version of the SurveyMan repository
  • run make package
  • run java -cp edu.umass.cs.surveyman.server.StaticAnalysisServer

Send the request as json to /analyser via POST.

On 7/19/15 12:18 PM, Prakhar Srivastav wrote:

Add support for incrementally validating survey by making a ajax call
to runner.jar.


Reply to this email directly or view it on GitHub
#35.

@prakhar1989
Copy link
Owner Author

Hi @etosch

So I pulled in the Surveyman code and was able to build the package too. However, I'm unable to start the server. Can you tell me what's wrong?

PS: Not quite well-versed with the java stack 😬

 java -cp edu.umass.cs.surveyman.server.StaticAnalysisServer
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

@prakhar1989
Copy link
Owner Author

Run command - java -cp surveyman.jar edu.umass.cs.surveyman.server.StaticAnalysisServer

So I was able to run the server and hit the /analyze route but no matter what JSON is sent in POST, the server keeps throwing up an exception.

Here's the curl request that I'm making

curl -X POST -H "Content-Type: application/json" -d '{"survey": [
    {
        "id": "b_10101",
        "randomize": true,
        "questions": [],
        "subblocks": []
    }
]}' 'http://localhost:1234/analyze'
java.lang.NullPointerException
    at edu.umass.cs.surveyman.input.json.JSONParser.makeCorrelationMap(JSONParser.java:258)
    at edu.umass.cs.surveyman.input.json.JSONParser.populateSurvey(JSONParser.java:363)
    at edu.umass.cs.surveyman.input.json.JSONParser.parse(JSONParser.java:382)
    at edu.umass.cs.surveyman.server.StaticAnalysisServer.parseJSON(StaticAnalysisServer.java:175)
    at edu.umass.cs.surveyman.server.StaticAnalysisServer.analyzeRequest(StaticAnalysisServer.java:118)
    at edu.umass.cs.surveyman.server.StaticAnalysisServer$1.handle(StaticAnalysisServer.java:46)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:363)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:745)

@jjfiv / @etosch: Any pointers?

@prakhar1989
Copy link
Owner Author

With the latest build the server is working now. Here's what I get when I run the curl above -

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 400 SurveyException: A survey must have at least one question.</title>
</head>
<body>
<h2>HTTP ERROR: 400</h2>
<p>Problem accessing /analyze. Reason:
<pre>    SurveyException: A survey must have at least one question.</pre></p>

So then I added a single question (as shown below) but now I keep getting a 501 Unimplemented error.

{"survey": [
    {
        "id": "b_10101",
        "randomize": true,
        "questions": [
        {
          "id": "q_5847",
          "qtext": "First question",
          "options": [
            {
              "id": "o_97512",
              "otext": "first"
            },
            {
              "id": "o_57705",
              "otext": "second"
            },
            {
              "id": "o_32878",
              "otext": "third"
            }
          ],
          "ordering": false,
          "freetext": false,
          "exclusive": true
        }
      ],
      "subblocks": []
    }
]}

@etosch
Copy link
Contributor

etosch commented Aug 9, 2015

s/ordering/ordered

@prakhar1989
Copy link
Owner Author

Tried. Same error 😢

@etosch
Copy link
Contributor

etosch commented Aug 9, 2015

It's failing when trying to assign breakoff (not finding the permitBreakoff tag). This isn't required, though, and the assignment for that value does check to see if the tag is present in the JSON node. More on this in a minute.

@prakhar1989
Copy link
Owner Author

@etosch: I just noticed that the server response is missing access-control headers because of which I'm unable to make requests to it via the react-surveyman app.

@etosch
Copy link
Contributor

etosch commented Aug 14, 2015

@jjfiv merged; try out and confirm.

  Emma Tosch
  [email protected]

On Fri, Aug 14, 2015, at 02:13 AM, Prakhar Srivastav wrote:

@etosch[1]: I just noticed that the server response is missing access-control headers because of which I'm unable to make requests to it via the react-surveyman app.


Reply to this email directly or view it on GitHub[2].

Links:

  1. https://github.com/etosch
  2. Survey Incremental Validation #35 (comment)

@prakhar1989
Copy link
Owner Author

I downloaded the latest build and tried running the server - but I still can't see the new headers.

curl -i POST -H "Content-Type: application/json" -d '{"survey": [
    {
        "id": "b_10101",
        "randomize": true,
        "questions": [
        {
          "id": "q_5847",
          "qtext": "First question",
          "options": [
            {
              "id": "o_97512",
              "otext": "first"
            },
            {
              "id": "o_57705",
              "otext": "second"
            },
            {
              "id": "o_32878",
              "otext": "third"
            }
          ],
          "ordered": false,
          "freetext": false,
          "exclusive": true
        }
      ],
      "subblocks": []
    }
]}
' 'http://localhost:1234/analyze' | head

> HTTP/1.1 200 OK
Content-Length: 831
Server: Jetty(7.x.y-SNAPSHOT)

Min Path Length:    1
Max Path Length:    1
Average Path Length:    1.000000
Max Possible Entropy:   1.584963
Prob. False Correlation:    1.000000
group,percentBots,entropy,TP,FP,TN,FN

@etosch
Copy link
Contributor

etosch commented Aug 16, 2015

I see the new access control header when running locally; will upload my jar.

@etosch
Copy link
Contributor

etosch commented Aug 16, 2015

etosch added a commit to SurveyMan/SurveyMan that referenced this issue Oct 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants