obiba / onyx

Web-based application that manages participant baseline interviews at assessment centres or clinics.
http://www.obiba.org/pages/products/onyx
GNU General Public License v3.0
6 stars 13 forks source link

ONYX-1722: Export missed section of questions #1537

Closed ymarcon closed 6 years ago

ymarcon commented 10 years ago

Jira issue originally created by user darmstrong:

I exported data from Onyx 1.6.4-b7905 in 2011 assuming it was complete. Now when data is being analyzed, we discover that all questions related to Family medical history are missing from 2 Onyx instances; all other questions were exported - even in same stage as the missing ones. This data was exported OK from other instances of same version of Onyx. Unfortunately, I'm not able to restore a backup from before the export. I created a new participant and filled out interview to confirm that the family history section questions are asked; they are. Can you provide an accurate query so I can get the data directly from mysql. Then I can do a SQL pivot to get it into format of one row for each participant (barcode). I don't need to import it into Opal. This is what I've come up with so far: select questionname, p.barcode, coalesce(convert(o.integer_value,char(12)), text_value ,categoryname ) vvalue /into outfile 'P:\diamfamily.csv' fields terminated by ',' lines terminated by '\n' / from participant p join questionnaireparticipant qp on qp.participantid = p.id join questionanswer qa on qp.id = questionnaire_participantid left outer join categoryanswer ca on question_answerid = qa.id left outer join openanswer o on o.category_answerid = ca.id where (questionname like '%family%' or question_name like 'prem_heart_disease%' or question_name like '%mother%' or question_name like '%RELATIVE%' or question_name like '%father%' or question_name like '%sister%' or question_name like '%brother%' or questionname like '%child%')

ymarcon commented 10 years ago

Comment created by darmstrong:

I need to send the data to the Data Harmonization team ASAP. When can I expect feedback? Thanks

ymarcon commented 10 years ago

Comment created by @ymarcon:

You must filter out the answers which "active" flag is not true: qa.active = true

ymarcon commented 10 years ago

Comment created by darmstrong:

Thanks for confirming my query will get all the data.

ymarcon commented 9 years ago

Issue was closed with resolution "Fixed"