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

Problem with parser when dependency condition on a text field #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gusaar
Copy link

@Gusaar Gusaar commented Mar 21, 2014

When you build redcap_siblings.csv, unparse it to a DSL, then build from DSL, this build fails. This appears to be the inverse of the problem solved by #3. I think the regular parser needs to be updated like the redcap parser was in #3.

To build from csv:
$ bundle exec rake surveyor:redcap FILE=surveys/redcap-siblings.csv

To unparse into a DSL document (choose survey id at prompt):
$bundle exec rake surveyor:unparse

To build survey from DSL file
$  bundle exec rake surveyor FILE=surveys/redcap-siblings_2014-03-12.rb
--- Parsing /Users/toddparsnick/Repos/HeHStudy/HeH/surveys/redcap-siblings_2014-03-12.rb ---
rake aborted!
can't convert String into Hash
/Users/toddparsnick/.rvm/gems/ruby-1.9.3-p327@HeH/bundler/gems/surveyor-2b988ebdf7e6/lib/surveyor/parser.rb:65:in `instance_eval'
/Users/toddparsnick/.rvm/gems/ruby-1.9.3-p327@HeH/bundler/gems/surveyor-2b988ebdf7e6/lib/surveyor/parser.rb:425:in `parse_and_build'
/Users/toddparsnick/.rvm/gems/ruby-1.9.3-p327@HeH/bundler/gems/surveyor-2b988ebdf7e6/lib/surveyor/parser.rb:82:in `method_missing'
(eval):18:in `block (2 levels) in parse'

appears to be issue with the following line from DSL. q_sibs is a text field.

   condition_A :q_sibs, ">", {:integer_value=>0, :answer_reference=>""}

@tparsnick
Copy link
Author

Although it would be nice if the redcap parser produced valid DSL for handling a dependency on a text field, what is higher priority is making the normal parser able to handle a dependency on a text field. We can make hand corrections to the DSL if needed.

@tparsnick tparsnick closed this Mar 21, 2014
@Gusaar Gusaar reopened this Mar 21, 2014
@tparsnick
Copy link
Author

Gustavo. Please explain what you did to indirectly address the issue. And what the workflow will be to use your fix.

@tparsnick
Copy link
Author

@Gusaar
Copy link

Gusaar commented Mar 24, 2014

Well, the problem that I solved here is that the parser doesn't allow a validation condition and a dependency condition at the same time, so I changed the logic to allow that to happen. The problem, is that by some reason the answer_id is not linked to the condition when the survey is created, so I did a rake task in HeH that make that link.

To be more explicit, the Question has a Dependency that has a Dependency Condition (DC), this DC has the question that depends of it, and it should have the answer id, but is not assigned, so I check that if the answer_id is nil, but we have a question id, then I just assign the answer id of that question to that field. I think that we just going to have that nil if we have this case. So after creating a survey that have dependency conditions, you just need to go to HeH an run

surveyor:fix_dependencies

@tparsnick tparsnick assigned alexperto and unassigned Gusaar Mar 27, 2014
@tparsnick
Copy link
Author

Another redcap csv with this issue is second hand smoke with branching logic [spouse_smoke_yrs] > 0. spouse_smoke_yrs is the referrant answer and is a textbox;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants