Changes between Version 10 and Version 11 of OnyxDatabaseReporting


Ignore:
Timestamp:
01/14/13 16:07:31 (11 years ago)
Author:
Nick Holden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OnyxDatabaseReporting

    v10 v11  
    8989== MySQL snippets ==
    9090
    91 Lists primary diagnoses with a count (used in the reporting table):
     91# Lists primary diagnoses with a count (used in the reporting table):
    9292
    9393SELECT category_name, count(category_name)
     
    9898
    9999
    100 Lists BPt numbers, grouped and counted by primary diagnosis:
     100# Lists BPt numbers, grouped and counted by primary diagnosis:
    101101
    102102SELECT category_name, barcode, count(*)
     
    108108        GROUP BY category_name, barcode WITH ROLLUP;
    109109
    110 From the command line, to query for gender and birth date for specific diagnosis, into an outfile:
     110# From the command line, to query for gender and birth date for specific diagnosis, into an outfile:
    111111
    112112mysql -h briccsdb -u auditor -p briccs -e "
     
    122122
    123123
    124 Single diagnosis, count:
     124# Single diagnosis, count:
    125125
    126126SELECT count(participant.id) as 'Number of Participants'
     
    133133
    134134
    135 Complex query, using two references to the same tables, to derive those of a certain diagnosis (primary or secondary) where the recruitment context is not 'Study specific':
     135# Complex query, using two references to the same tables, to derive those of a certain diagnosis (primary or secondary) where the recruitment context is not 'Study specific':
    136136
    137137SELECT count(participant.id) as 'AS not study recruited'
     
    149149;
    150150
    151 Using UNION to produce a list of S numbers and DOBs for participants who are either study specific recruits or have a specific primary or secondary diagnosis (UNION combines two SELECTs with duplicates removed):
     151# Using UNION to produce a list of S numbers and DOBs for participants who are either study specific recruits or have a specific primary or secondary diagnosis (UNION combines two SELECTs with duplicates removed):
    152152
    153153mysql -h briccsdb -u auditor -p briccs -e "
     
    169169; " > mysql-output.txt
    170170
    171 Any one of a number of related primary or secondary diagnoses, aged under 65.
     171# Any one of a number of related primary or secondary diagnoses, aged under 65.
    172172
    173173SELECT count(distinct participant.id) as 'Number of Participants'
     
    186186OR category_answer.category_name = 'Acute_Stent_Thrombosis' )
    187187;
     188
     189# To find incomplete interviews only for Study specific recruits
     190
     191SELECT participant.barcode, participant.enrollment_id, participant.last_name, interview.start_date
     192FROM participant, interview, questionnaire_participant, question_answer, category_answer
     193WHERE
     194questionnaire_participant.participant_id = participant.id AND
     195question_answer.questionnaire_participant_id = questionnaire_participant.id AND
     196question_answer.question_name = "epi_type" AND
     197category_answer.question_answer_id = question_answer.id AND
     198category_answer.category_name = "Study_specific" AND
     199interview.status = "IN_PROGRESS" AND
     200interview.participant_id = participant.id
     201ORDER BY start_date
     202;