Closed ymarcon closed 6 years ago
Comment created by darmstrong:
I need to send the data to the Data Harmonization team ASAP. When can I expect feedback? Thanks
Comment created by @ymarcon:
You must filter out the answers which "active" flag is not true: qa.active = true
Comment created by darmstrong:
Thanks for confirming my query will get all the data.
Issue was closed with resolution "Fixed"
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%')