NUBIC / surveyor

A Rails gem that lets you code surveys, questionnaires, quizzes, etc... and add them to your app.
http://nubic.github.com/surveyor
MIT License
750 stars 274 forks source link

Provide a way to evaluate code in a survey #198

Open jdzak opened 13 years ago

jdzak commented 13 years ago

We need a way to evaluate code in a survey to do calculations and blank checks for dependencies, and change text of labels/questions beyond simple substitution.

This code has to also be compatible with surveyor iOS (evaluate javascript in the context of the response set json).

Nataliya commented 13 years ago

Please refer to the https://code.bioinformatics.northwestern.edu/issues/issues/show/1503 for examples of what should be addressed for the due-date.

pfriedman commented 13 years ago

Not only do we need to "change text of labels/questions beyond simple substitution" but need to set variables/response based on previous responses. Then use this calculated value as a dependency for other questions.

The most clear example of this is the setting of the PPG_FIRST in the NCS Pregnancy Screener Instrument.

Look for "DISPLAY APPROPRIATE PPG_FIRST ASSIGNMENT FOR RESPONDENT AS PREVIOUSLY SET." in that Instrument to see use of the calculated value.