Changes between Version 2 and Version 3 of DataIntegration GRAPHIC2 CiviCRM to i2b2


Ignore:
Timestamp:
10/01/13 13:04:57 (11 years ago)
Author:
Richard Bramley
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataIntegration GRAPHIC2 CiviCRM to i2b2

    v2 v3  
    2121    , cids.nhs_number_1 nhs_number
    2222    , cids.uhl_s_number_2 uhl_s_number
    23     , grd.genvasc_id_10 genvasc_id
    24     , grd.genvasc_consent_q1_11 consent_1
    25     , grd.genvasc_consent_q2_12 consent_2
    26     , grd.genvasc_consent_q3_13 consent_3
    27     , grd.genvasc_consent_q4_14 consent_4
    28     , grd.genvasc_consent_q5_15 consent_5
    29     , grd.genvasc_consent_q6_16 consent_6
    30     , grd.genvasc_consent_q7_17 consent_7
     23    , g2d.*
    3124    , recruit.birth_date
    3225    , enrollment.start_date enrollment_date
    33     , CASE
     26/*    , CASE
    3427        WHEN (wstatus.withdrawal_status_24 = 'A') THEN enrollment.end_date
    35       END withdrawal_date
     28      END withdrawal_date */
    3629FROM   civicrm_contact recruit
    3730JOIN   civicrm_case_contact enrollcontact ON enrollcontact.contact_id = recruit.id
    3831JOIN   civicrm_case enrollment ON enrollment.id = enrollcontact.case_id
    39             AND enrollment.start_date < DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    40             AND enrollment.status_id NOT IN (699 /* declined */, 701 /* excluded */)
    41             AND enrollment.case_type_id = "3" /* GENVASC */
     32            AND enrollment.status_id NOT IN (7 /* declined */, 9 /* excluded */, 4 /* Recruitment Pending */)
     33            AND enrollment.case_type_id = "5" /* Graphic 2 */
    4234            AND enrollment.is_deleted = 0
    43 JOIN   civicrm_value_contact_ids_2 cids ON cids.entity_id = recruit.id
    44 JOIN   civicrm_value_genvasc_recruitment_data_6 grd ON grd.entity_id = enrollment.id
    45 LEFT JOIN civicrm_value_genvasc_withdrawal_status_9 wstatus ON wstatus.entity_id = enrollment.id
     35JOIN   civicrm_value_contact_ids_2 cids ON cids.entity_id = recruit.id /* Is this the case? */
     36JOIN   civicrm_value_graphic2_10 g2d ON g2d.entity_id = enrollment.id /* CHECK THIS */
     37/* MAYBE: LEFT JOIN civicrm_value_genvasc_withdrawal_status_9 wstatus ON wstatus.entity_id = enrollment.id */
    4638WHERE  recruit.is_deleted = 0
    47     AND COALESCE(wstatus.withdrawal_status_24, '') <> 'B'
    48     AND EXISTS (  SELECT 1
    49                   FROM  civicrm_relationship rel
    50                   WHERE rel.contact_id_a = recruit.id
    51                     AND rel.relationship_type_id = 15 /* with GP surgery */
    52                )
     39/*    AND COALESCE(wstatus.withdrawal_status_24, '') <> 'B' */
    5340;
    5441