text: TRUNCATE TABLE cdm_testing_ccae.drug_claims;
  TRUNCATE TABLE cdm_testing_ccae.enrollment_detail;
  TRUNCATE TABLE cdm_testing_ccae.enrollment_summary;
  TRUNCATE TABLE cdm_testing_ccae.facility_header;
  TRUNCATE TABLE cdm_testing_ccae.health_risk_assessment;
  TRUNCATE TABLE cdm_testing_ccae.hra_question_ref;
  TRUNCATE TABLE cdm_testing_ccae.hra_variable_ref;
  TRUNCATE TABLE cdm_testing_ccae.inpatient_admissions;
  TRUNCATE TABLE cdm_testing_ccae.inpatient_services;
  TRUNCATE TABLE cdm_testing_ccae.lab;
  TRUNCATE TABLE cdm_testing_ccae.outpatient_services;
  -- Group 1: Condition Occurrence
  -- Test Case 1: Patient has two different primary diagnoses between inpatient_services and inpatient_admissions, the inpatient_admissions PDX is used. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '1', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '2', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '1', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', '2500', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-09', '     ', '2012-08-12', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '2', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '1', '0', '0.0', '0.0', ' ', '14', '1', '0', '0092', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Test Case 3: Patient has the same diagnosis code in outpatient_services and facility_header but in different positions, outpatient_services dx is prioritized. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '3', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '1024', '       ', '       ', '       ', '       ', '9', '9', '1', '49', '1', '1', '1', '3', '4', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-10-16', '40151', '2012-10-16', '10', '2012');
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', '1024', '9', '9', '9', '49', '1', '1', '1', '3', '4', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '8853', '       ', '3', '1', '2', '22', '1', '2012-10-16', '2012-10-16', '10', '2012');
  -- Test Case 5: Patient has diagnosis in dx4 field in inpatient_services, condition_type_concept_id = 38000187. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '5', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '57411', '       ', '9', '9', '9', '49', '1', '1', '1', '5', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-07-23', '     ', '2012-07-23', '10', '2012');
  -- Test Case 7: Patient has diagnosis in dx9 field in facility_header, condition_type_concept_id = 38000208. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '7', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-07-23', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '7', '8', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-07-23', '     ', '2012-07-23', '10', '2012');
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', '4760', '9', '9', '9', '49', '1', '1', '1', '7', '8', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '8853', '       ', '3', '1', '2', '22', '1', '2012-07-23', '2012-07-23', '10', '2012');
  -- Test Case 9: Patient has revcode 0450 and diagnosis codes in the pdx and dx1 fields, ER record created and conditions have condition_type_concept_id = 38000215. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '9', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', '57411', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '9', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', '4760', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '0450', '1', '2', '21', '1', '2012-04-14', '     ', '2012-04-14', '10', '2012');
  -- Test Case 11: Patient has diagnosis in a dx field that has domain=procedure, condition record moved to procedure_occurrence. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '11', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '11', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V755', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-10-15', '     ', '2012-10-17', '10', '2012');
  -- Test Case 13: Patient has diagnosis in a dx field that has domain=observation, condition record moved to observation. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '13', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '13', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'E0152', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-02-04', '     ', '2012-02-08', '10', '2012');
  -- Test Case 15: Patient has diagnosis in a dx field that has domain=measurement, condition record moved to measurement. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '15', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '15', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V726', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-21', '     ', '2012-08-25', '10', '2012');
  -- Test Case 17: Patient has icd10 diagnosis in a dx field with dxver=0, condition record created with icd10 mapped to snomed. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '17', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'S42241S', '       ', '       ', '       ', '       ', '0', '9', '9', '49', '1', '1', '1', '17', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-09', '     ', '2012-08-12', '10', '2012');
  -- Test Case 19: patient has icd10cm diagnosis in a dx field that overlaps with an icd10 diagnosis, condition record created with icd10cm mapped to snomed. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '19', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V9001', '       ', '       ', '       ', '       ', '0', '9', '9', '49', '1', '1', '1', '19', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-09', '     ', '2012-08-12', '10', '2012');
  -- Test Case 21: Patient has icd10 diagnosis after 10/1/2015 in a dx field with dxver=null, condition record created with icd10 mapped to snomed. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2015-12-31', '2015-01-01', '9', '1', '62', '1', '21', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2015-11-09', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'S42241S', '       ', '       ', '       ', '       ', '', '9', '9', '49', '1', '1', '1', '21', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2015-11-09', '     ', '2015-11-12', '10', '2012');
  -- Test Case 23: Patient has icd9 diagnosis before 10/1/2015 in a dx field with dxver=null, used ICD9. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '23', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-08-09', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V9001', '       ', '       ', '       ', '       ', '', '9', '9', '49', '1', '1', '1', '23', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-09', '     ', '2012-08-12', '10', '2012');
  -- Test Case 25: Patient has two IP records in inpatient_services with svcdate = condition_start_date (HIX-1274). Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '25', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '57411', '       ', '9', '9', '9', '49', '1', '1', '1', '25', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-07-01', '     ', '2012-07-01', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '57411', '       ', '9', '9', '9', '49', '1', '1', '1', '25', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-02', '     ', '2012-08-02', '10', '2012');
  -- Test Case 27: HRA mapped to condition/drug the END_DATE is NULL. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '27', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '-', '1', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '27', '-', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-03-12', '0', '9', '1.0', '-', '9', '2014');
  -- Test Case 29: Patient has 1 in CC_ASTHMA column, condition_source_value=Self-reported Asthma. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '29', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '1', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '29', '-', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-09-13', '0', '9', '1.0', '-', '9', '2014');
  -- Group 2: Condition Era
  -- Test Case 31: Patient condition_concept_id of 0, no condition_era record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '31', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', '71978', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '31', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', '71978', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-04-21', '     ', '2012-04-22', '10', '2012');
  -- Test Case 33: Two records with same condition_concept_id are less than 30 days apart, one condition_era record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '33', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '37613', '       ', '       ', '       ', '       ', '9', '9', '1', '49', '1', '1', '1', '33', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-07-01', '40151', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '37613', '       ', '       ', '       ', '       ', '9', '9', '1', '49', '1', '1', '1', '33', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-07-12', '40151', '10', '2012');
  -- Test Case 35: Two records with same condition_concept_id are more than 30 days apart, two condition_era records created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2013-12-31', '2012-01-01', '9', '1', '62', '1', '35', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '37613', '       ', '       ', '       ', '       ', '9', '9', '1', '49', '1', '1', '1', '35', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-07-01', '40151', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '37613', '       ', '       ', '       ', '       ', '9', '9', '1', '49', '1', '1', '1', '35', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-08-12', '40151', '10', '2012');
  -- Group 3: Cost
  -- Test Case 37: Patient has values in ingcost, dispfee and AWP (HIX-1319). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '37', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '20', 'N', '0.0', '0.0', '20', '1', '01', '30', '6', '0.0', '25', '1954', '9', '1', '49', '1', '1', '1', '37', '4', '0', ' ', '50', '1', '0', '1', '0', '00378510501', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '2012-02-09', '69', '08', '10', '2011');
  -- Test Case 39: Patient has cost values, cost is correctly associated with cost_domain_id = 10. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '39', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '40', '0.0', '0.0', '40', '1', '120', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '39', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '65779', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-06-11', '     ', '2012-06-30', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '40', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '39', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Test Case 41: Patient has procedure with domain = measurement, measurement record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '41', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '37', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '41', 'P', '0', ' ', '23', '1', '0', '120', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '82985', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-05-07', '40151', '2012-05-07', '10', '2012');
  -- Test Case 43: Patient has procedure with domain = observation, observation record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '43', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '52', '100', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '43', 'P', '0', ' ', '23', '1', '0', '75', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', 'S9368', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-10-03', '40151', '2012-10-03', '10', '2012');
  -- Test Case 45: Patient has cost values and revenue code, cost is correctly associated with cost_domain_id = 10. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '45', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '46', '0.0', '0.0', '80', '1', '20', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '45', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '  ', ' ', '1', '3', '0420', '1', '2', '21', '1', '2012-06-05', '     ', '2012-06-05', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '46', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '45', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Test Case 47: Testing DRG Populates (HIX-1431). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '47', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '48', '0.0', '0.0', '80', '1', '20', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '47', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '  ', ' ', '1', '3', '0420', '1', '2', '21', '1', '2012-06-05', '     ', '2012-06-05', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '48', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '47', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Test Case 49: Patient has cost values, cost is correctly associated with the right event_id (HIX-1515).
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '49', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '50', '0.0', '0.0', '40', '1', '120', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '49', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '65779', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-06-11', '     ', '2012-06-30', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '50', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '49', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Test Case 51: Patient has invalid revenue code, REVENUE_CODE_CONCEPT_ID set to 0. Id is PERSON_ID. (HIX-1486)
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '51', '0', ' ', '31', '1', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '52', '0.0', '0.0', '80', '1', '20', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '51', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '65779', '  ', ' ', '1', '3', '0000', '1', '2', '21', '1', '2012-06-05', '     ', '2012-06-05', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '52', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '51', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Group 4: Death
  -- Test Case 53: Date of death visit end date. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2015-12-31', '2012-01-01', '9', '1', '62', '1', '53', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '53', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2013-01-06', '     ', '2013-01-09', '10', '2013');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '7981', '       ', '       ', '       ', '       ', '9', '9', '1', '49', '1', '1', '1', '53', '54', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2013-01-07', '40151', '2013-01-07', '10', '2013');
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', '7981', '9', '9', '9', '49', '1', '1', '1', '53', '54', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '8853', '       ', '3', '1', '2', '22', '1', '2013-01-07', '2013-01-07', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2016-12-31', '2012-01-01', '9', '1', '62', '1', '55', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 55: ICD10 Death and Death Type Correct. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'I461', '       ', '       ', '       ', '       ', '0', '9', '9', '49', '1', '1', '1', '55', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2016-01-06', '     ', '2016-01-09', '10', '2016');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2015-12-31', '2012-01-01', '9', '1', '62', '1', '57', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 57: ICD9 Death and Death Type Correct. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', '798', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '57', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2013-01-06', '     ', '2013-01-09', '10', '2013');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2013-02-01', '2012-01-01', '9', '1', '62', '1', '59', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 59: Discharge Status and Death Type Correct. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '20', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '59', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2013-01-06', '     ', '2013-01-09', '10', '2013');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2015-12-31', '2012-01-01', '9', '1', '62', '1', '61', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 61: Death by ICD9 and Death by Discharge, Keep the Discharge. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '20', '798', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '61', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2013-01-06', '     ', '2013-01-09', '10', '2013');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2015-12-31', '2012-01-01', '9', '1', '62', '1', '63', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 63: Death and then contined Activity Cancels Death. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '20', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '63', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2013-01-06', '     ', '2013-01-09', '10', '2013');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '63', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2013-03-12', '40151', '10', '2013');
  -- Group 5: Device Exposure
  -- Group 6: Drug Exposure
  -- Test Case 65: Duplicate drug records become one record in the CDM. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '65', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '65', '4', '0', ' ', '0.0', '1', '0', '1', '0', '36987257801', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-01-2012', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '65', '4', '0', ' ', '0.0', '1', '0', '1', '0', '36987257801', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-01-2012', '69', '08', '10', '2012');
  -- Test Case 67: Negative daysupp should be 0 in cdm. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '67', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '-30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '67', '4', '0', ' ', '0.0', '1', '0', '1', '0', '58864060830', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '06-12-2012', '69', '08', '10', '2012');
  -- Test Case 69: Daysupp >365 should be 365 in cdm. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '69', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '432', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '69', '4', '0', ' ', '0.0', '1', '0', '1', '0', '58864060830', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '08-07-2012', '69', '08', '10', '2012');
  -- Test Case 71: CPT4 drug code in inpatient record moves to drug_exposure. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '71', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '72', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '71', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '90376', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-09', '     ', '2012-08-12', '10', '2012');
  -- Test Case 73: Days supply is NULL but DRUG_EXPOSURE_END_DATE is set to DRUG_EXPOSURE_START_DATE (HIX-1430). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '73', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '74', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '73', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '90376', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-09', '     ', '2012-08-12', '10', '2012');
  -- Test Case 75: Patient has 11 digit NDC that doesn''t map, should use first 9 digits instead. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '75', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '75', '4', '0', ' ', '0.0', '1', '0', '1', '0', '13533063670', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '01-17-2012', '69', '08', '10', '2012');
  -- Test Case 77: Patient has 9 digit NDC that doesn''t map, should use first 9 digits instead, should map to DRUG_CONCEPT_ID=0 because of the date filter. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2006-12-31', '2006-01-01', '9', '1', '62', '1', '77', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '77', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00006000543', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '07-08-2006', '69', '08', '10', '2006');
  -- Test Case 79: Patient has 9 digit NDC that doesn''t map, should use first 9 digits instead, should map to correct DRUG_CONCEPT_ID because of the date filter. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2014-12-31', '2014-01-01', '9', '1', '62', '1', '79', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '79', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00006032582', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '09-18-2014', '69', '08', '10', '2014');
  -- Test Case 81: Tofacitinib mapps to 11-digit DRUG_SOURCE_CONCEPT_ID instead of 9-digit (HIX-1534)
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2014-12-31', '2014-01-01', '9', '1', '62', '1', '81', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '81', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00069100101', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '09-18-2014', '69', '08', '10', '2014');
  -- Test Case 83: HRA Drug still has a DRUG_EXPOSURE_END_DATE (HIX-1433). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '83', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '83', '-', '9', '-', '1', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-05-25', '0', '9', '1.0', '-', '9', '2014');
  -- Group 7: Drug Era
  -- Test Case 85: Two drugs with same ingredient within 30 days, should be one drug era. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '85', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '85', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-04-2012', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '85', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-22-2012', '69', '08', '10', '2012');
  -- Test Case 87: Two drugs with same ingredient within 30 days, but 10 gap days. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '87', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '8', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '87', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-04-2012', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '87', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-22-2012', '69', '08', '10', '2012');
  -- Test Case 89: Three drugs with same ingredient within 30 days, but 10 gap days total (5 between each). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '89', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '13', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '89', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-04-2012', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '14', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '89', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '02-22-2012', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '89', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '03-12-2012', '69', '08', '10', '2012');
  -- Test Case 91: Two drugs with same ingredient > 30 days apart, should be two drug eras. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '91', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '91', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '09-21-2012', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '91', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '12-08-2012', '69', '08', '10', '2012');
  -- Test Case 93: Drug_era_end_date should be drug start date + days supply. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2010-01-01', '9', '1', '62', '1', '93', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '14', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '93', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00349835305', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '12-08-2010', '69', '08', '10', '2012');
  -- Test Case 95: No drug era created from procedure drugs since they are not related to ingredients. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '95', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '96', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '95', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '90376', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-03-26', '     ', '2012-03-30', '10', '2012');
  -- Test Case 97: Drug with two ingredients should have two drug eras. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2010-01-01', '9', '1', '62', '1', '97', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '97', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00008419001', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '05-01-2010', '69', '08', '10', '2012');
  -- Test Case 99: Two drugs with same ingredient within 30 days, one occurs outside of observation_period. Drug era should only include drug inside observation_period. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '99', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '99', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '12-12-2011', '69', '08', '10', '2012');
  INSERT INTO cdm_testing_ccae.drug_claims(_flag, age, agegrp, awp, cap_svc, cob, coins, copay, datatyp, dawind, daysupp, deaclas, deduct, dispfee, dobyr, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, genind, hlthplan, indstry, ingcost, maintin, metqty, mhsacovg, msa, ndcnum, netpay, ntwkprov, paidntwk, pay, phyflag, plantyp, qty, refill, region, rxmr, saletax, sex, svcdate, thercls, thergrp, version, year) VALUES ('0', '60', '5', '0.0', 'N', '0.0', '0.0', '0.0', '1', '01', '30', '6', '0.0', '0.0', '1954', '9', '1', '49', '1', '1', '1', '99', '4', '0', ' ', '0.0', '1', '0', '1', '0', '00463303410', '0.0', 'Y', 'Y', '0.0', '1', '6', '1', '0', '3', '1', '0.0', '2', '01-08-2012', '69', '08', '10', '2012');
  -- Group 8: Location
  -- Test Case 101: Location record generated for egeoloc 11. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '11', '1', '101', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 102: No location record generated for egeoloc 89. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '89', '1', '102', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 103: Only one location record generated for 38. Id is PERSON_ID
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-07-31', '2012-07-01', '9', '1', '38', '1', '103', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-06-30', '2012-06-01', '9', '1', '38', '1', '103', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Group 9: Measurement
  -- Test Case 104: LOINC code does not have a dash in the second to last character, record is dropped. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '104', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, dxver) VALUES ('104', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-03-07', '35644', '6960', '0.0', '0.0', '0.0', '1', '1952', '930', '2012', '58', '1', '6', '81', '99999', ' ');
  -- Test Case 106: Svcdate is outside of observation period, record is dropped. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '106', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, dxver) VALUES ('106', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2013-07-09', '35644', '6960', '0.0', '0.0', '0.0', '1', '1952', '930', '2012', '58', '1', '6', '81', '56773-5', ' ');
  -- Test Case 108: Patient has abnormal=L; value as concept_id = 4267416. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '108', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, dxver) VALUES ('108', 'L', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-12-20', '35644', '6960', '0.0', '0.0', '0.0', '1', '1952', '930', '2012', '58', '1', '6', '81', '56784-2', ' ');
  -- Test Case 110: Patient has result ne 0 and > neg 99999, result listed in value as number field. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '110', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, dxver) VALUES ('110', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-08-24', '35644', '6960', '0.0', '0.0', '120', '1', '1952', '930', '2012', '58', '1', '6', '81', '56789-1', ' ');
  -- Test Case 112: Patient lowercase units, maps to unit_concept_id 8840 (HIX-1183). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '112', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, resunit, dxver) VALUES ('112', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-04-06', '35644', '6960', '0.0', '0.0', '100', '1', '1952', '930', '2012', '58', '1', '6', '81', '56789-1', 'mg/dl', ' ');
  -- Test Case 114: If you do not get a map from UCUM for UNIT_CONCEPT_ID then try JNJ_UNITS (HIX-1419). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '114', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, resunit, dxver) VALUES ('114', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-04-06', '35644', '6960', '0.0', '0.0', '100', '1', '1952', '930', '2012', '58', '1', '6', '81', '56789-1', 'lbs.', ' ');
  -- Test Case 116: for LOINCs 3142-7, 29463-7, 3141-9 sometimes padded with 0000, strip padding (HIX-1418). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '116', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, loinccd, resunit, dxver) VALUES ('116', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-04-06', '35644', '6960', '0.0', '0.0', '1500000', '1', '1952', '930', '2012', '58', '1', '6', '81', '29463-7', 'lbs.', ' ');
  -- Test Case 118: Patient has 2 in CGTPKAMT column, value_as_number=1 pack per day or more. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '118', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '2', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '118', '-', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-03-14', '0', '9', '1.0', '-', '9', '2014');
  -- Test Case 120: Patient has weight 201, value_as_string = null, value_as_number=201. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '120', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, weight, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '120', '-', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-07-16', '0', '9', '1.0', '201', '-', '9', '2014');
  -- Test Case 122: BMI is only question answered bmi is only record created in observation . Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '122', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, bmi, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '28.6', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '122', '-', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-09-22', '0', '9', '1.0', '-', '9', '2014');
  -- Group 10: Observation Period
  -- Test Case 124: Subsumed enrollment test where two enrollment durations with the second subsumed by the first results in a single observation. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '124', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-07-31', '2012-06-01', '9', '1', '62', '1', '124', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 125: Combine enrollment test where two enrollment durations with the second within 30 days of the first results in a single observation. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-05-31', '2012-05-01', '9', '1', '62', '1', '125', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-06-15', '9', '1', '62', '1', '125', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 126: Gap enrollment test where two enrollment durations are 33 days apart results in two observations. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-06-01', '2012-01-01', '9', '1', '62', '1', '126', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-08-02', '9', '1', '62', '1', '126', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Group 11: Observation
  -- Test Case 127: Store Discharge Status. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2013-12-31', '2012-01-01', '9', '1', '62', '1', '127', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '51', '57411', '       ', '       ', '       ', '       ', '9', '9', '9', '49', '1', '1', '1', '127', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-07-23', '     ', '2012-07-23', '10', '2012');
  -- Test Case 129: SVCDATE is outside of observation_period, measurement record created . Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '129', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, bmi, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '20.0', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '129', '-', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2013-10-13', '0', '9', '1.0', '-', '9', '2014');
  -- Test Case 131: Patient answered 3 for question EXERWEEK, value_as_number=3. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '131', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, exerweek, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '131', '-', '3', '9', '-', '-', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-05-25', '0', '9', '1.0', '-', '9', '2014');
  -- Test Case 133: Patient answered 1 for question FLU_SHOT, drug_exposure record created (HIX-1299). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '133', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.health_risk_assessment(_flag, alc_amt, alcdyamt, alcweek, cc_allergy, cc_arthritis, cc_asthma, cc_backpain, cc_chf, cc_depress, cc_diab, cc_heartdis, cc_highbp, cc_highcol, cc_hrtburn, cc_lungdis, cc_migraine, cc_nonskincan, cc_osteopo, cc_skincan, cgramt, cgrcurr, cgrdur, cgrprev, cgrquit, cgtamt, cgtcurr, cgtdur, cgtpkamt, cgtprev, cgtqtcat, cgtquit, chewamt, chewcurr, chewdur, chewprev, chewquit, copestrs, dietfrt, dietfrvg, dietveg, dobyr, drnkdrv, educ_lvl, enrolid, exermo, famabscat12, fireext, flu_shot, hlthplan, hltimpct, job_sat, life_sat, liftwgt, mh_freq, mh_prob, pipeamt, pipecurr, pipedur, pipeprev, pipequit, planalc, plandiet, plandrad, planexer, planslp, planstrs, plantob, planwgt, prev_mammo, prev_paptest, prev_prostex, prev_sigmoid, prodabscat, risk_alc, risk_bp, risk_chol, risk_exer, risk_gluc, risk_mh, risk_nutr, risk_safe, risk_sleep, risk_smok, risk_wgt, seatbelt, selfhlth, sex, sleep_hr, slpapnea, slpprob, smkdetect, stretch, survdate, tobcurr, tobprev, version, wrkabscat, wrkabscat12, year) VALUES ('0', '-', ' ', '9', '-', '-', '-', '-', '-', '9', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', ' ', '-', ' ', '-', ' ', '9', '0', '9', '9', '0', '-', '9', ' ', '-', ' ', '-', ' ', '9', '-', '-', '-', '1961', '9', '-', '133', '-', '9', '-', '1', ' ', '-', '-', '-', '-', '9', '9', ' ', '-', ' ', '-', ' ', '9', '9', '-', '9', ' ', '9', '9', '9', '-', '-', '-', '-', '9', '0', '-', '-', '-', '9', '-', '1', '-', '-', '0', '-', '1', '-', '2', ' ', '-', '-', ' ', '-', '2012-05-25', '0', '9', '1.0', '-', '9', '2014');
  -- Group 12: Payer Plan Period
  -- Test Case 135: Person does not have prescription benefits and is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2013-01-31', '2013-01-01', '9', '1', '62', '1', '135', '0', ' ', '31', '0', '0', '1', '6', '3', '0', '2', '10', '2012');
  -- Test Case 136: Person has a gap of >32 days between enrollment periods with the same payer_source_value; person has two records. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2013-01-31', '2013-01-01', '9', '1', '62', '1', '136', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2013-05-31', '2013-05-01', '9', '1', '62', '1', '136', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 137: Person switches plans in the middle of an enrollment period; person has two records with the first truncated. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '2', '1957', '2012-04-30', '2012-04-01', '9', '1', '62', '1', '137', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '2', '1957', '2012-04-30', '2012-04-07', '9', '1', '62', '1', '137', '0', ' ', '31', '0', '0', '1', '5', '3', '1', '2', '10', '2012');
  -- Test Case 138: Person has duplicate records, only one is brought into the cdm. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '2', '1957', '2012-04-30', '2012-04-01', '9', '1', '62', '1', '138', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '2', '1957', '2012-04-30', '2012-04-01', '9', '1', '62', '1', '138', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Group 13: Person
  -- Test Case 139: Person with two genders is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '139', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '1', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '139', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 140: Person with two birth years >2 yrs apart is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1970', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '140', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1980', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '140', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 141: Person with two birth years <2 yrs apart is kept with last birth year selected. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1970', '2012-01-31', '2012-01-01', '9', '1', '62', '1', '141', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1971', '2012-02-28', '2012-02-01', '9', '1', '62', '1', '141', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 142: Person born before 1900 is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1899', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '142', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 143: Person born in 2099 is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '2099', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '143', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 144: Person born in 2014 but enrolled in 2012 is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '2014', '2012-01-31', '2012-01-01', '9', '1', '62', '1', '144', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 145: Person born in 2013 but enrolled in 2012 is kept, latest birth year taken. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '2013', '2012-01-31', '2012-01-01', '9', '1', '62', '1', '145', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 146: Person with two enrollment_detail records has one person record. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1980', '2012-01-31', '2012-01-01', '9', '1', '62', '1', '146', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1980', '2012-02-28', '2012-02-01', '9', '1', '62', '1', '146', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 147: Person with sex=3 is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '147', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '3', '10', '2012');
  -- Test Case 148: Person has record with sex=3 but last record has sex=1, person is kept. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-01-31', '2012-01-01', '9', '1', '62', '1', '148', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '3', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-02-28', '2012-02-01', '9', '1', '62', '1', '148', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '1', '10', '2012');
  -- Test Case 149: Person born the same year as enrolled, use first enrollment month to impute month of birth and day of birth. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '2012', '2012-04-30', '2012-04-01', '9', '1', '62', '1', '149', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 150: Person with Rx benefits is kept. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '150', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Test Case 151: Person without Rx benefits is excluded. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-03-31', '2012-03-01', '9', '1', '62', '1', '151', '0', ' ', '31', '0', '0', '1', '6', '3', '0', '2', '10', '2012');
  -- Test Case 152: Person with last enrollment_detail record that has egeoloc=11 gets associated to NJ. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-01-31', '2012-01-01', '9', '1', '89', '1', '152', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-02-28', '2012-02-01', '9', '1', '11', '1', '152', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  -- Group 14: Procedure Occurrence
  -- Test Case 153: Patient has two PPROC values, PPROC from inpatient_admissions is used. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '153', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '154', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '153', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '65779', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-06-11', '     ', '2012-06-12', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '154', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '153', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '29914', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  -- Test Case 155: Patient has two different providers for the same procedure, the provider on the first line (ascending) is chosen. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '155', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2012-01-01', '2', '0', '5', '156', '1', '2', '2012-12-31', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '155', '0', '0.0', '0.0', ' ', '14', '1', '0', 'V3000  ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, provid, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '156', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '155', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '50760', '  ', ' ', '3456789', '1', '3', '    ', '1', '2', '21', '220', '2012-10-20', '     ', '2012-10-22', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, provid, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '156', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '155', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '50760', '  ', ' ', '1234567', '1', '3', '    ', '1', '2', '21', '540', '2012-10-20', '     ', '2012-10-22', '10', '2012');
  -- Test Case 157: Patient has HCPCS procedure code with value in PROCMOD, only HCPCS comes across in record since PROCMOD associated with CPT4 only. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '157', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '157', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', 'C9727', '104', 'P1', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-05-12', '40151', '2012-05-12', '10', '2012');
  -- Test Case 159: Patient has two records for the same procedure, procedure in outpatient_services prioritized. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '159', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '159', '160', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '54861', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-02-15', '40151', '2012-02-15', '10', '2012');
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', 'v5869', ' ', '9', '9', '49', '1', '1', '1', '159', '160', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '54861', '7309', '8856', '9904', '8853', '       ', '3', '1', '2', '22', '1', '2012-02-15', '2012-02-15', '10', '2012');
  -- Test Case 161: Patient has procedure in proc5 position in facility header, procedure_type_concept_id = 38000273. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '161', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '161', '162', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-03-03', '40151', '2012-03-03', '10', '2012');
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', 'v5869', ' ', '9', '9', '49', '1', '1', '1', '161', '162', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '93042', '       ', '3', '1', '2', '22', '1', '2012-03-03', '2012-03-03', '10', '2012');
  -- Test Case 163: Patient has procedure with domain = device, device record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '163', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '163', '164', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', 'E0304', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-04-03', '40151', '2012-04-03', '10', '2012');
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', 'v5869', ' ', '9', '9', '49', '1', '1', '1', '163', '164', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '8853', '       ', '3', '1', '2', '22', '1', '2012-04-03', '2012-04-03', '10', '2012');
  -- Test Case 165: Patient has procedure with domain = drug, drug record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '165', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '165', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '90686', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-05-03', '40151', '2012-05-03', '10', '2012');
  -- Test Case 167: Patient has procedure with domain = measurement, measurement record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '167', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '167', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '82985', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-05-03', '40151', '2012-05-03', '10', '2012');
  -- Test Case 169: Patient has procedure with domain = observation, observation record created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '169', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '169', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', 'S9368', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-05-03', '40151', '2012-05-03', '10', '2012');
  -- Test Case 171: Patient has an ICD10PCS value in inpatient_admissions field pdx, pdx is correctly mapped and a procedure_occurrence record created (HIX-1255). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2016-12-31', '2016-01-01', '9', '1', '62', '1', '171', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_admissions(_flag, admdate, admtyp, age, agegrp, caseid, datatyp, days, disdate, dobyr, drg, dstatus, dx1, dx10, dx11, dx12, dx13, dx14, dx15, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, hospnet, hosppay, indstry, mdc, mhsacovg, msa, pdx, phyflag, physnet, physpay, plantyp, pproc, proc1, proc10, proc11, proc12, proc13, proc14, proc15, proc3, proc4, proc5, proc6, proc7, proc8, proc9, region, rx, sex, state, totcob, totcoins, totcopay, totded, totnet, totpay, version, year) VALUES ('0', '2016-05-30', '2', '0', '5', '172', '1', '2', '2016-06-05', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '171', '0', '0.0', '0.0', ' ', '14', '1', '0', 'DB025ZZ', '1', '0.0', '0.0', '6', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '3', '1', '2', '49', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '10', '2016');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '172', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '171', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', '', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2016-06-05', '     ', '2016-06-05', '10', '2016');
  -- Group 15: Provider
  -- Test Case 173: Provider in facility header table with stdprov=220, specialty = emergency medicine. Id is PROVIDER_SOURCE_VALUE
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, provid, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', 'v5869', ' ', '9', '9', '49', '1', '1', '1', '174', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '8853', '       ', '173', '3', '1', '2', '22', '220', '2012-04-02', '2014-01-31', '10', '2012');
  -- Test Case 175: Provider in outpatient_services table with stdprov=285, specialty = infectious disease. Id is PROVIDER_SOURCE_VALUE
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, provid, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '176', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '175', '1', '3', '    ', '1', '2', '11', '285', '2012-05-14', '40151', '10', '2012');
  -- Test Case 177: provider in inpatient_services table with stdprov=540, specialty = cardiac surgery. Id is PROVIDER_SOURCE_VALUE
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, provid, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '178', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '177', '1', '3', '    ', '1', '2', '21', '540', '2012-06-04', '     ', '2012-08-30', '10', '2012');
  -- Test Case 179: provider in lab table with stdprov =22, specialty = addiction medicine. Id is PROVIDER_SOURCE_VALUE
  INSERT INTO cdm_testing_ccae.lab(enrolid, abnormal, agegrp, eeclass, eestatu, eidflag, emprel, enrflag, hlthplan, indstry, mhsacovg, phyflag, proctyp, region, rx, sex, egeoloc, mdc, version, resltcat, dx1, proc1, svcdate, msa, orderid, provid, refhigh, reflow, result, testcnt, dobyr, stdprov, year, age, datatyp, plantyp, stdplac, dxver) VALUES ('180', 'N', '5', '9', '9', '1', '1', '1', '1', ' ', '1', '1', '1', '3', '1', '2', '49', '00', '10', '   ', '       ', '       ', '2012-02-03', '35644', '6960', '179', '0.0', '0.0', '0.0', '1', '1952', '22', '2012', '58', '1', '6', '81', ' ');
  -- Test Case 181: Even when PROVID IS NULL create a PROVIDER (HIX-1404). Id is PROVIDER_SOURCE_VALUE
  INSERT INTO cdm_testing_ccae.facility_header(_flag, age, agegrp, billtyp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dstatus, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, phyflag, plantyp, proc1, proc2, proc3, proc4, proc5, proc6, region, rx, sex, stdplac, stdprov, svcdate, tsvcdat, version, year) VALUES ('0', '61', '5', '131', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', '01', '5856   ', '       ', '       ', '       ', '       ', '       ', '       ', 'v5869', 'v5869', ' ', '9', '9', '49', '1', '1', '1', '182', '1', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '1', '6', '       ', '7309', '8856', '9904', '8853', '       ', '3', '1', '2', '22', '220', '2012-04-02', '2014-01-31', '10', '2012');
  -- Group 16: Visit Occurrence
  -- Test Case 183: Patient with visit that starts before the observation period, start date trimmed to beginning of observation period. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '183', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, caseid, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '184', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '183', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2011-12-05', '     ', '2012-01-06', '10', '2012');
  -- Test Case 185: svcdate>tsvcdate, visit_end_date is svcdate. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '185', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '185', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-03-21', '     ', '2012-03-19', '10', '2012');
  -- Test Case 187: Service falls during observation period but ends after the period ends, visit_end_date is the observation_period_end_date. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '187', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '187', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-12-30', '     ', '2013-01-08', '10', '2012');
  -- Test Case 189: service in inpatient_services with revcode of 0450, visit classified as ER. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '189', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '189', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '0450', '1', '2', '21', '1', '2012-04-12', '     ', '2012-04-12', '10', '2012');
  -- Test Case 191: service in outpatient_services with revcode of 0450, visit classified as ER. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '191', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '191', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '0450', '1', '2', '11', '1', '2012-05-01', '40151', '2012-05-01', '10', '2012');
  -- Test Case 193: service in outpatient_services with revcode of 0100, visit classified as IP. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '193', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '193', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '0100', '1', '2', '11', '1', '2012-10-17', '40151', '2012-10-20', '10', '2012');
  -- Test Case 195: Two visits created, expect a visit with a PRECEDING_VISIT_OCCURRENCE_ID. Id is PERSON_ID. (HIX-1521)
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '195', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '195', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-08', '     ', '2012-08-12', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '195', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-10-01', '     ', '2012-10-05', '10', '2012');
  -- Test Case 197: patient has two lines in the inpatient_services table where the end_date of one line and the start_date of the next >1, two visits created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '197', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '197', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-08-08', '     ', '2012-08-12', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '197', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-10-01', '     ', '2012-10-05', '10', '2012');
  -- Test Case 199: Patient has an ER record that starts and ends on the first day of the IP visit, separate ER visit created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '199', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '199', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '0450', '1', '2', '21', '1', '2012-09-03', '     ', '2012-09-03', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '199', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '0100', '1', '2', '21', '1', '2012-09-03', '     ', '2012-09-10', '10', '2012');
  -- Test Case 201: Patient has two lines in the inpatient_services table where the difference between the end_date of one line and the start_date of the next is <= 1, one visit created. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '201', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '201', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-05-15', '     ', '2012-05-16', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '201', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-05-16', '     ', '2012-05-17', '10', '2012');
  -- Test Case 203: Setting Discharge_to_Concept_id for IP Record (HIX-1429). Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '203', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '203', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '1', '3', '    ', '1', '2', '21', '1', '2012-03-21', '     ', '2012-03-19', '10', '2012');
  -- Test Case 205: Patient has record in outpatient_services table but no rx benefits, visit dropped. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '205', '0', ' ', '31', '0', '0', '1', '6', '3', '0', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.outpatient_services(_flag, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, dobyr, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, fachdid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, phyflag, plantyp, proc1, procgrp, procmod, proctyp, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '58', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '1954', 'V202   ', '       ', '       ', '       ', '       ', ' ', '9', '1', '49', '1', '1', '1', '205', '206', 'P', '0', ' ', '23', '1', '0', '0.0', 'Y', 'Y', '0.0', '2014-01-31', '1', '6', '       ', '104', '  ', '1', '1', '3', '    ', '1', '2', '11', '1', '2012-01-06', '40151', '2012-01-06', '10', '2012');
  -- Test Case 207: Patient has two records in the same visit with different provid and provstd. Id is PERSON_ID.
  INSERT INTO cdm_testing_ccae.enrollment_detail(_flag, age, agegrp, datatyp, dobyr, dtend, dtstart, eeclass, eestatu, egeoloc, emprel, enrolid, hlthplan, indstry, memdays, mhsacovg, msa, phyflag, plantyp, region, rx, sex, version, year) VALUES ('0', '49', '1', '1', '1957', '2012-12-31', '2012-01-01', '9', '1', '62', '1', '207', '0', ' ', '31', '0', '0', '1', '6', '3', '1', '2', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, provid, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '207', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '209', '1', '3', '    ', '1', '2', '21', '220', '2012-08-08', '     ', '2012-08-12', '10', '2012');
  INSERT INTO cdm_testing_ccae.inpatient_services(_flag, admdate, admtyp, age, agegrp, cap_svc, cob, coins, copay, datatyp, deduct, disdate, dobyr, drg, dstatus, dx1, dx2, dx3, dx4, dx5, dxver, eeclass, eestatu, egeoloc, eidflag, emprel, enrflag, enrolid, facprof, hlthplan, indstry, mdc, mhsacovg, msa, netpay, ntwkprov, paidntwk, pay, pddate, pdx, phyflag, plantyp, pproc, proc1, procmod, proctyp, provid, qty, region, revcode, rx, sex, stdplac, stdprov, svcdate, svcscat, tsvcdat, version, year) VALUES ('0', '2012-03-06', '1', '0', '5', 'N', '0.0', '0.0', '0.0', '1', '0.0', '2011-06-03', '1952', '775', '01', 'V3000  ', '       ', '       ', '       ', '       ', ' ', '9', '9', '49', '1', '1', '1', '207', 'F', '1', ' ', '05', '1', '0', '0.0', 'Y', 'Y', '0.0', '2010-04-30', 'V3000  ', '1', '6', '       ', '       ', '  ', ' ', '210', '1', '3', '    ', '1', '2', '21', '540', '2012-08-08', '     ', '2012-08-12', '10', '2012');