diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/ConditionOccurrenceTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/ConditionOccurrenceTests.R index 8a0886c9..da525723 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/ConditionOccurrenceTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/ConditionOccurrenceTests.R @@ -11,8 +11,8 @@ createConditionOccurrenceTests <- function () { add_inpatient_admissions(enrolid=patient$enrolid, pdx = '0092', caseid = encounter$caseid, dxver = '9', year = '2012') #expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '4008576', condition_status_concept_id = '32902', condition_type_concept_id = '32854') #expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '198337', condition_status_concept_id = '32902', condition_type_concept_id = '32855' ) - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '4008576', condition_type_concept_id = '38000183') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '198337', condition_type_concept_id = '38000199' ) + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '4008576', condition_type_concept_id = '32854') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '198337', condition_type_concept_id = '32855' ) patient <- createPatient() encounter <- createEncounter() @@ -22,8 +22,8 @@ createConditionOccurrenceTests <- function () { add_facility_header(enrolid=patient$enrolid, svcdate = '2012-10-16', tsvcdat = '2012-10-16', dx9 = '1024', fachdid = encounter$caseid, dxver='9') #expect_condition_occurrence(person_id = patient$person_id, condition_concept_id='433706', condition_status_concept_id = '32902', condition_type_concept_id = '32860') #expect_condition_occurrence(person_id = patient$person_id, condition_concept_id='433706', condition_status_concept_id = '32902', condition_type_concept_id = '32846') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id='433706', condition_type_concept_id = '38000215') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id='433706', condition_type_concept_id = '38000238') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id='433706', condition_type_concept_id = '32846', condition_status_source_value = 'DX1') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id='433706', condition_type_concept_id = '32846', condition_status_source_value = 'DX9') patient <- createPatient() @@ -32,7 +32,7 @@ createConditionOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid = patient$enrolid, svcdate = '2012-07-23', tsvcdat = '2012-07-23', dx4='57411', dxver='9') #expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_status_concept_id = '32908', condition_type_concept_id = '32854') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_type_concept_id = '38000187') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_type_concept_id = '32854', condition_status_source_value = 'DX4') patient <- createPatient() encounter <- createEncounter() @@ -41,7 +41,7 @@ createConditionOccurrenceTests <- function () { add_inpatient_services(enrolid=patient$enrolid, fachdid = encounter$caseid, admdate = '2012-07-23', svcdate = '2012-07-23', tsvcdat = '2012-07-23', year = '2012') add_facility_header(enrolid=patient$enrolid, fachdid = encounter$caseid, svcdate = '2012-07-23', tsvcdat = '2012-07-23', dx9 = '4760', dxver = '9', year = '2012') #expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '24970', condition_status_concept_id = '32908', condition_type_concept_id = '32846') - expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '24970', condition_type_concept_id = '38000208') + expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '24970', condition_type_concept_id = '32854', condition_status_source_value = 'DX9') patient <- createPatient() encounter <- createEncounter() @@ -51,8 +51,8 @@ createConditionOccurrenceTests <- function () { expect_visit_occurrence(person_id = patient$person_id, visit_concept_id = '9203') # expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '195587', condition_status_concept_id = '32902', condition_type_concept_id = '32854') # expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '24970', condition_status_concept_id = '32902', condition_type_concept_id = '32854') - expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '195587', condition_type_concept_id = '38000184') - expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '24970', condition_type_concept_id = '38000183') + expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '195587', condition_type_concept_id = '32854', condition_status_source_value = 'DX1') + expect_condition_occurrence(person_id=patient$person_id, condition_concept_id = '24970', condition_type_concept_id = '32854', condition_status_source_value = 'PDX') patient <- createPatient() encounter <- createEncounter() @@ -61,8 +61,8 @@ createConditionOccurrenceTests <- function () { add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-10-15', tsvcdat = '2012-10-17', pdx = 'V5302', dxver='9') # expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '4047347', procedure_type_concept_id = '32854') # expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '46272569', procedure_type_concept_id = '32854') - expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '4047347', procedure_type_concept_id = '38000183') - expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '46272569', procedure_type_concept_id = '38000183') + expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '4047347', procedure_type_concept_id = '32854') + expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '46272569', procedure_type_concept_id = '32854') patient <- createPatient() @@ -71,7 +71,7 @@ createConditionOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid=patient$enrolid, pdx = 'E0152', svcdate = '2012-02-04', tsvcdat = '2012-02-08', dxver = '9') # expect_observation(person_id = patient$person_id, observation_concept_id = '4117957', observation_type_concept_id = '32854') - expect_observation(person_id = patient$person_id, observation_concept_id = '4117957', observation_type_concept_id = '38000183') + expect_observation(person_id = patient$person_id, observation_concept_id = '4117957', observation_type_concept_id = '32854') patient <- createPatient() encounter <- createEncounter() @@ -79,7 +79,7 @@ createConditionOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-08-21', tsvcdat = '2012-08-25', pdx = 'V726', dxver='9') # expect_measurement(person_id = patient$enrolid, measurement_concept_id = '4034850', measurement_type_concept_id = '32854') - expect_measurement(person_id = patient$enrolid, measurement_concept_id = '4034850', measurement_type_concept_id = '38000183') + expect_measurement(person_id = patient$enrolid, measurement_concept_id = '4034850', measurement_type_concept_id = '32854') patient <- createPatient() encounter <- createEncounter() @@ -87,7 +87,7 @@ createConditionOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-08-09', tsvcdat = '2012-08-12', dx1='S42241S', dxver='0') # expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '438021', condition_status_concept_id = '32902', condition_type_concept_id = '32854') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '438021', condition_type_concept_id = '38000184') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '438021', condition_type_concept_id = '32854') patient <- createPatient() encounter <- createEncounter() @@ -96,7 +96,7 @@ createConditionOccurrenceTests <- function () { add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-08-09', tsvcdat = '2012-08-12', dx1='V9001', dxver='0') # expect_observation(person_id = patient$person_id, observation_concept_id = '4155106', observation_type_concept_id = '32854') # expect_no_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117') - expect_observation(person_id = patient$person_id, observation_concept_id = '4155106', observation_type_concept_id = '38000184') + expect_observation(person_id = patient$person_id, observation_concept_id = '4155106', observation_type_concept_id = '32854') expect_no_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117') patient <- createPatient() @@ -105,7 +105,7 @@ createConditionOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2015-12-31', dtstart = '2015-01-01') add_inpatient_services(enrolid=patient$enrolid, admdate= '2015-11-09', svcdate = '2015-11-09', tsvcdat = '2015-11-12', dx1='S42241S', dxver='') # expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '438021', condition_source_concept_id = '45602528', condition_status_concept_id = '32902', condition_type_concept_id = '32854') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '438021', condition_source_concept_id = '45602528', condition_type_concept_id = '38000184') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '438021', condition_source_concept_id = '45602528', condition_type_concept_id = '32854') patient <- createPatient() encounter <- createEncounter() @@ -113,7 +113,7 @@ createConditionOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid=patient$enrolid, admdate = '2012-08-09', svcdate = '2012-08-09', tsvcdat = '2012-08-12', dx1='V9001', dxver='') # expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117', condition_source_concept_id = '44821630', condition_status_concept_id = '32902', condition_type_concept_id = '32854' ) - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117', condition_source_concept_id = '44821630', condition_type_concept_id = '38000184' ) + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117', condition_source_concept_id = '44821630', condition_type_concept_id = '32854' ) #This will test HIX-1274 patient <- createPatient() @@ -124,8 +124,8 @@ createConditionOccurrenceTests <- function () { add_inpatient_services(enrolid = patient$enrolid, svcdate = '2012-08-02', tsvcdat = '2012-08-02', dx4='57411', dxver='9') # expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_status_concept_id = '32908', condition_start_date = '2012-07-01', condition_type_concept_id = '32854') # expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_status_concept_id = '32908', condition_start_date = '2012-08-02', condition_type_concept_id = '32854') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_start_date = '2012-07-01', condition_type_concept_id = '38000187') - expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_start_date = '2012-08-02', condition_type_concept_id = '38000187') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_start_date = '2012-07-01', condition_type_concept_id = '32854') + expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '195587', condition_start_date = '2012-08-02', condition_type_concept_id = '32854') if (truvenType == "MDCD") { diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/DeathTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/DeathTests.R index 4a13b336..aaed0877 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/DeathTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/DeathTests.R @@ -17,28 +17,28 @@ createDeathTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2016-12-31', dtstart = '2012-01-01', mhsacovg = '0') declareTest(id = patient$person_id, "ICD10 Death and Death Type Correct. Id is PERSON_ID.") add_inpatient_services(enrolid=patient$enrolid, year = '2016', svcdate = '2016-01-06', tsvcdat='2016-01-09', dxver = '0', dx1='I461') - expect_death(person_id = patient$person_id, death_type_concept_id = '38003567') + expect_death(person_id = patient$person_id, death_type_concept_id = '32812') patient <- createPatient() encounter <- createEncounter() add_enrollment_detail(enrolid=patient$enrolid, dtend = '2015-12-31', dtstart = '2012-01-01', mhsacovg = '0') declareTest(id = patient$person_id, "ICD9 Death and Death Type Correct. Id is PERSON_ID.") add_inpatient_services(enrolid=patient$enrolid, year = '2013', svcdate = '2013-01-06', tsvcdat='2013-01-09', dxver = '9', dx1='798') - expect_death(person_id = patient$person_id, death_type_concept_id = '38003567') + expect_death(person_id = patient$person_id, death_type_concept_id = '32812') patient <- createPatient() encounter <- createEncounter() add_enrollment_detail(enrolid=patient$enrolid, dtend = '2013-02-01', dtstart = '2012-01-01', mhsacovg = '0') declareTest(id = patient$person_id, "Discharge Status and Death Type Correct. Id is PERSON_ID.") add_inpatient_services(enrolid=patient$enrolid, year = '2013', svcdate = '2013-01-06', tsvcdat='2013-01-09', dstatus = '20') - expect_death(person_id = patient$person_id, death_type_concept_id = '38003566') + expect_death(person_id = patient$person_id, death_type_concept_id = '32812') patient <- createPatient() encounter <- createEncounter() add_enrollment_detail(enrolid=patient$enrolid, dtend = '2015-12-31', dtstart = '2012-01-01', mhsacovg = '0') declareTest(id = patient$person_id, "Death by ICD9 and Death by Discharge, Keep the Discharge. Id is PERSON_ID.") add_inpatient_services(enrolid=patient$enrolid, year = '2013', svcdate = '2013-01-06', tsvcdat='2013-01-09', dstatus = '20',dxver = '9', dx1='798') - expect_death(person_id = patient$person_id, death_type_concept_id = '38003566') + expect_death(person_id = patient$person_id, death_type_concept_id = '32812') patient <- createPatient() encounter <- createEncounter() diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/DrugEraTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/DrugEraTests.R index 2f631f1f..9786e910 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/DrugEraTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/DrugEraTests.R @@ -15,7 +15,7 @@ createDrugEraTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '02-04-2012', daysupp = 8) add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '02-22-2012', daysupp = 30) - expect_drug_era(person_id = patient$person_id, drug_concept_id = '1134439', drug_era_start_date ='02-04-2012', gap_days = 10) + expect_drug_era(person_id = patient$person_id, drug_concept_id = '1134439', drug_era_start_date ='02-04-2012', gap_days = 11) patient <- createPatient() encounter <- createEncounter() @@ -24,7 +24,7 @@ createDrugEraTests <- function () { add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '02-04-2012', daysupp = 13) add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '02-22-2012', daysupp = 14) add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '03-12-2012', daysupp = 30) - expect_drug_era(person_id = patient$person_id, drug_concept_id = '1134439', drug_era_start_date ='02-04-2012', gap_days = 10) + expect_drug_era(person_id = patient$person_id, drug_concept_id = '1134439', drug_era_start_date ='02-04-2012', gap_days = 12) expect_count_drug_era(rowCount = 1, person_id = patient$person_id) patient <- createPatient() @@ -41,7 +41,7 @@ createDrugEraTests <- function () { declareTest(id = patient$person_id, "Drug_era_end_date should be drug start date + days supply. Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2010-01-01') add_drug_claims(enrolid = patient$enrolid, ndcnum = '00349835305', year = '2012', svcdate = '12-08-2010', daysupp = '14') - expect_drug_era(person_id = patient$person_id, drug_concept_id = '956874', drug_era_start_date ='12-08-2010', drug_era_end_date = '12-22-2010') + expect_drug_era(person_id = patient$person_id, drug_concept_id = '956874', drug_era_start_date ='12-08-2010', drug_era_end_date = '12-21-2010') patient <- createPatient() encounter <- createEncounter() @@ -64,6 +64,6 @@ createDrugEraTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '12-12-2011', daysupp = 30) add_drug_claims(enrolid = patient$enrolid, ndcnum = '00463303410', year = '2012', svcdate = '01-08-2012', daysupp = 30) - expect_drug_era(person_id = patient$person_id, drug_concept_id = '1134439', drug_era_start_date ='01-08-2012', gap_days = 0) + ## expect_drug_era(person_id = patient$person_id, drug_concept_id = '1134439', drug_era_start_date ='01-08-2012', gap_days = 0) } \ No newline at end of file diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/DrugExposureTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/DrugExposureTests.R index fd3bfa02..4ac6433d 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/DrugExposureTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/DrugExposureTests.R @@ -28,14 +28,14 @@ createDrugExposureTests <- function () { declareTest(id = patient$person_id, "CPT4 drug code in inpatient record moves to drug_exposure. Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid = patient$enrolid, proc1 = '90376', svcdate = '2012-08-09', tsvcdat = '2012-08-12', caseid = encounter$caseid, year = '2012') - expect_drug_exposure(person_id = patient$person_id, drug_concept_id = '46233994', drug_exposure_start_date = '2012-08-09') + expect_drug_exposure(person_id = patient$person_id, drug_concept_id = '46234006', drug_exposure_start_date = '2012-08-09') patient <- createPatient() encounter <- createEncounter() declareTest(id = patient$person_id, "Days supply is NULL but DRUG_EXPOSURE_END_DATE is set to DRUG_EXPOSURE_START_DATE (HIX-1430). Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid = patient$enrolid, proc1 = '90376', svcdate = '2012-08-09', tsvcdat = '2012-08-12', caseid = encounter$caseid, year = '2012') - expect_drug_exposure(person_id = patient$person_id, drug_concept_id = '46233994', drug_exposure_start_date = '2012-08-09', drug_exposure_end_date = '2012-08-09') + expect_drug_exposure(person_id = patient$person_id, drug_concept_id = '46234006', drug_exposure_start_date = '2012-08-09', drug_exposure_end_date = '2012-08-09') patient <- createPatient() encounter <- createEncounter() @@ -64,6 +64,7 @@ createDrugExposureTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2014-12-31', dtstart = '2014-01-01') add_drug_claims(enrolid = patient$enrolid, ndcnum = '00069100101', year = '2014', svcdate = '09-18-2014') expect_drug_exposure(person_id = patient$person_id, drug_source_concept_id = '45332969') + if (Sys.getenv("truvenType") == "CCAE") { diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/LocationTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/LocationTests.R index 239e6271..cd5d4432 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/LocationTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/LocationTests.R @@ -9,9 +9,9 @@ if (truvenType != "MDCD") { expect_location(state="NJ",location_source_value="11") patient<-createPatient() - declareTest(id = patient$person_id, "No location record generated for egeoloc 89. Id is PERSON_ID") + declareTest(id = patient$person_id, "Only one location record generated for 89. Id is PERSON_ID") add_enrollment_detail(enrolid=patient$enrolid, egeoloc = "89") - expect_count_location(location_source_value = "89", rowCount = 0) + expect_count_location(location_source_value = "89", state = "UN", rowCount = 1) patient<-createPatient() declareTest(id = patient$person_id, "Only one location record generated for 38. Id is PERSON_ID") diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/MeasurementTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/MeasurementTests.R index 5f2f46cb..730dc682 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/MeasurementTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/MeasurementTests.R @@ -7,10 +7,10 @@ createMeasurementTests <- function () { patient <- createPatient() encounter <- createEncounter() - declareTest(id = patient$person_id, "LOINC code does not have a dash in the second to last character, record is dropped. Id is PERSON_ID.") + ## declareTest(id = patient$person_id, "LOINC code does not have a dash in the second to last character, record is dropped. Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_lab(enrolid = patient$enrolid, year='2012', svcdate = '2012-03-07', loinccd = '99999') - expect_no_measurement(person_id = patient$person_id) + ## expect_no_measurement(person_id = patient$person_id) patient <- createPatient() encounter <- createEncounter() @@ -94,7 +94,7 @@ createMeasurementTests <- function () { patient <- createPatient() encounter <- createEncounter() - declareTest(id = patient$person_id, "Patient has a LOINC of 3142-7, 29463-7, 3141-9 and RESULT > 100000 and RESUNIT = 'LBS'") + declareTest(id = patient$person_id, "Patient has a LOINC of 3142-7, 29463-7, 3141-9 and RESULT > 100000 and RESUNIT = ''LBS''") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_lab(enrolid = patient$enrolid, year='2012', svcdate = '2012-04-06', loinccd = '29463-7', result = '1950000', resunit = 'LBS') expect_measurement(person_id = patient$person_id, value_as_number = '195', unit_concept_id = '8739') @@ -104,14 +104,7 @@ createMeasurementTests <- function () { if (truvenType == "CCAE") { - - patient <- createPatient() - encounter <- createEncounter() - declareTest(id = patient$person_id, "Patient has 2 in CGTPKAMT column, value_as_number=1 pack per day or more. Id is PERSON_ID.") - add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') - add_health_risk_assessment(enrolid = patient$enrolid, survdate = '2012-03-14', cgtpkamt = '2') - expect_measurement(person_id = patient$person_id, measurement_source_value = 'CGTPKAMT', value_as_number = '2', measurement_date = '2012-03-14', value_source_value = '1 pack per day or more') - + patient <- createPatient() encounter <- createEncounter() declareTest(id = patient$person_id, "Patient has weight 201, value_as_string = null, value_as_number=201. Id is PERSON_ID.") diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/ObservationTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/ObservationTests.R index 709b17cb..bfdc9c49 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/ObservationTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/ObservationTests.R @@ -17,14 +17,20 @@ createObservationTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_health_risk_assessment(enrolid = patient$enrolid, survdate = '2012-05-25', exerweek = '3') expect_observation(person_id = patient$person_id, observation_source_value = 'EXERWEEK', value_as_number = '3', observation_date = '2012-05-25') + + patient <- createPatient() + encounter <- createEncounter() + declareTest(id = patient$person_id, "Patient has 2 in CGTPKAMT column, value_as_number=1 pack per day or more. Id is PERSON_ID.") + add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') + add_health_risk_assessment(enrolid = patient$enrolid, survdate = '2012-03-14', cgtpkamt = '2') + expect_observation(person_id = patient$person_id, observation_source_value = 'CGTPKAMT', value_as_number = '2.00', observation_date = '2012-03-14') - #This will test HIX-1299 patient <- createPatient() encounter <- createEncounter() - declareTest(id = patient$person_id, "Patient answered 1 for question FLU_SHOT, drug_exposure record created (HIX-1299). Id is PERSON_ID.") + declareTest(id = patient$person_id, "Patient answered 1 for question FLU_SHOT, observation record created. Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_health_risk_assessment(enrolid = patient$enrolid, survdate = '2012-05-25', flu_shot = '1') - expect_drug_exposure(person_id = patient$person_id, drug_concept_id = '4214838') + expect_observation(person_id = patient$person_id, observation_source_value = 'FLU_SHOT') } } diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/ProcedureOccurrenceTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/ProcedureOccurrenceTests.R index c597683a..bd135fd1 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/ProcedureOccurrenceTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/ProcedureOccurrenceTests.R @@ -66,16 +66,17 @@ createProcedureOccurrenceTests <- function () { add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_outpatient_services(enrolid = patient$enrolid, fachdid = encounter$caseid, proc1 = '54861', svcdate = '2012-02-15', tsvcdat = '2012-02-15', year = '2012') add_facility_header(enrolid = patient$enrolid, fachdid = encounter$caseid, proc1 = '54861', svcdate = '2012-02-15', tsvcdat = '2012-02-15', year = '2012') - expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2109995', procedure_date = '2012-02-15', procedure_type_concept_id = '32860') - expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2109995', procedure_date = '2012-02-15', procedure_type_concept_id = '32846') + expect_count_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2109995', procedure_date = '2012-02-15', procedure_type_concept_id = '32846', rowCount = 2) + ## expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2109995', procedure_date = '2012-02-15', procedure_type_concept_id = '32846') + ## expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2109995', procedure_date = '2012-02-15', procedure_type_concept_id = '32846') patient <- createPatient() encounter <- createEncounter() - declareTest(id = patient$person_id, "Patient has procedure in proc5 position in facility header, procedure_type_concept_id = 32860. Id is PERSON_ID.") + declareTest(id = patient$person_id, "Patient has procedure in proc5 position in facility header, procedure_type_concept_id = 32846 Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_outpatient_services(enrolid = patient$enrolid, fachdid = encounter$caseid, svcdate = '2012-03-03', tsvcdat = '2012-03-03', year = '2012') add_facility_header(enrolid = patient$enrolid, fachdid = encounter$caseid, proc5 = '93042', svcdate = '2012-03-03', tsvcdat = '2012-03-03', year = '2012') - expect_procedure_occurrence(person_id = patient$person_id, procedure_type_concept_id = '32860' ) + expect_procedure_occurrence(person_id = patient$person_id, procedure_type_concept_id = '32846' ) expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2313827', procedure_type_concept_id = '32846' ) patient <- createPatient() @@ -89,15 +90,17 @@ createProcedureOccurrenceTests <- function () { expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '40757149', procedure_type_concept_id = '32846' ) expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2313736', procedure_type_concept_id = '32846' ) expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '42739018', procedure_type_concept_id = '32846' ) - expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '709845', procedure_type_concept_id = '32846' ) + ## expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '709845', procedure_type_concept_id = '32846' ) + expect_measurement(person_id = patient$person_id, measurement_concept_id= '709845', measurement_type_concept_id = '32846') + #Test case to address issue HIX-1255 - patient <- createPatient() - encounter <- createEncounter() - declareTest(id = patient$person_id, "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.") - add_enrollment_detail(enrolid=patient$enrolid, dtend = '2016-12-31', dtstart = '2016-01-01') - add_inpatient_admissions(caseid = encounter$caseid, enrolid = patient$enrolid, pdx = 'DB025ZZ', year = '2016', admdate = '2016-05-30', disdate = '2016-06-05') - add_inpatient_services(enrolid = patient$enrolid, caseid = encounter$caseid, svcdate = '2016-06-05', tsvcdat = '2016-06-05', year = '2016', pdx = '') - expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2789746', procedure_date = '2016-06-05', procedure_type_concept_id = '32855') + ## patient <- createPatient() + ## encounter <- createEncounter() + ## declareTest(id = patient$person_id, "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.") + ## add_enrollment_detail(enrolid=patient$enrolid, dtend = '2016-12-31', dtstart = '2016-01-01') + ## add_inpatient_admissions(caseid = encounter$caseid, enrolid = patient$enrolid, pdx = 'DB025ZZ', year = '2016', admdate = '2016-05-30', disdate = '2016-06-05') + ## add_inpatient_services(enrolid = patient$enrolid, caseid = encounter$caseid, svcdate = '2016-06-05', tsvcdat = '2016-06-05', year = '2016', pdx = '') + ## expect_procedure_occurrence(person_id = patient$person_id, procedure_concept_id = '2789746', procedure_date = '2016-06-05', procedure_type_concept_id = '32855') } diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/ProviderTests.R b/docs/IBM_CCAE_MDCR/Test Cases/R/ProviderTests.R index 9a2edb74..90e59641 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/ProviderTests.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/ProviderTests.R @@ -37,7 +37,7 @@ createProviderTests <- function () { declareTest(id = provider$provid, description = "Even when PROVID IS NULL create a PROVIDER (HIX-1404). Id is PROVIDER_SOURCE_VALUE") patient<-createPatient(); add_facility_header(enrolid=patient$enrolid, provid=NULL, stdprov="220") - expect_provider(provider_source_value =NULL, specialty_source_value="220") + expect_provider(provider_source_value ="", specialty_source_value="220") } if (truvenType == "MDCD") diff --git a/docs/IBM_CCAE_MDCR/Test Cases/R/VisitOccurrenceTest.R b/docs/IBM_CCAE_MDCR/Test Cases/R/VisitOccurrenceTest.R index 977808f2..6b25a95d 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/R/VisitOccurrenceTest.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/R/VisitOccurrenceTest.R @@ -50,12 +50,11 @@ createVisitOccurrenceTests <- function () { patient <- createPatient() encounter <- createEncounter() - declareTest(id = patient$person_id, "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.") + declareTest(id = patient$person_id, "Patient has an ER record that starts and ends on the first day of the IP visit, one ER visit created. Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-09-03', tsvcdat = '2012-09-03', stdplac = '23') add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-09-03', tsvcdat = '2012-09-10', revcode = '0100') - expect_visit_occurrence(person_id = patient$person_id, visit_start_date = '2012-09-03', visit_end_date = '2012-09-03', visit_concept_id = '9203') - expect_visit_occurrence(person_id = patient$person_id, visit_start_date = '2012-09-03', visit_end_date = '2012-09-10', visit_concept_id = '9201') + expect_visit_occurrence(person_id = patient$person_id, visit_start_date = '2012-09-03', visit_end_date = '2012-09-10', visit_concept_id = '262') patient <- createPatient() encounter <- createEncounter() @@ -67,10 +66,10 @@ createVisitOccurrenceTests <- function () { patient <- createPatient() encounter <- createEncounter() - declareTest(id = patient$person_id, "Setting Discharge_to_Concept_id for IP Record (HIX-1429). Id is PERSON_ID.") + declareTest(id = patient$person_id, "Setting discharged_to_concept_id for IP Record (HIX-1429). Id is PERSON_ID.") add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01') add_inpatient_services(enrolid=patient$enrolid, svcdate = '2012-03-21', tsvcdat = '2012-03-19',dstatus = '01') - expect_visit_occurrence(person_id=patient$person_id, visit_start_date = '2012-03-21', visit_end_date = '2012-03-21',discharge_to_concept_id = '8536' ) + expect_visit_occurrence(person_id=patient$person_id, visit_start_date = '2012-03-21', visit_end_date = '2012-03-21',discharged_to_concept_id = '581476' ) if (truvenType != "MDCD") { diff --git a/docs/IBM_CCAE_MDCR/Test Cases/extras/IBMCCAE_TestingFramework.R b/docs/IBM_CCAE_MDCR/Test Cases/extras/IBMCCAE_TestingFramework.R index c8a4aeef..77f73bfd 100644 --- a/docs/IBM_CCAE_MDCR/Test Cases/extras/IBMCCAE_TestingFramework.R +++ b/docs/IBM_CCAE_MDCR/Test Cases/extras/IBMCCAE_TestingFramework.R @@ -8848,7 +8848,7 @@ expect_specimen <- function(specimen_id, person_id, specimen_concept_id, specime invisible(NULL) } -expect_visit_detail <- function(visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_end_date, visit_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharge_to_source_value, discharge_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { +expect_visit_detail <- function(visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_end_date, visit_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharged_to_source_value, discharged_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { fields <- c() values <- c() if (!missing(visit_detail_id)) { @@ -8921,14 +8921,14 @@ expect_visit_detail <- function(visit_detail_id, person_id, visit_detail_concept values <- c(values, if (is.null(admitting_source_concept_id)) "NULL" else if (is(admitting_source_concept_id, "subQuery")) paste0("(", as.character(admitting_source_concept_id), ")") else paste0("'", as.character(admitting_source_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { - fields <- c(fields, "discharge_to_source_value") - values <- c(values, if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + if (!missing(discharged_to_source_value)) { + fields <- c(fields, "discharged_to_source_value") + values <- c(values, if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { - fields <- c(fields, "discharge_to_concept_id") - values <- c(values, if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + if (!missing(discharged_to_concept_id)) { + fields <- c(fields, "discharged_to_concept_id") + values <- c(values, if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } if (!missing(preceding_visit_detail_id)) { @@ -8951,7 +8951,7 @@ expect_visit_detail <- function(visit_detail_id, person_id, visit_detail_concept invisible(NULL) } -expect_visit_occurrence <- function(visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharge_to_concept_id, discharge_to_source_value, preceding_visit_occurrence_id) { +expect_visit_occurrence <- function(visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharged_to_concept_id, discharged_to_source_value, preceding_visit_occurrence_id) { fields <- c() values <- c() if (!missing(visit_occurrence_id)) { @@ -9024,14 +9024,14 @@ expect_visit_occurrence <- function(visit_occurrence_id, person_id, visit_concep values <- c(values, if (is.null(admitting_source_value)) "NULL" else if (is(admitting_source_value, "subQuery")) paste0("(", as.character(admitting_source_value), ")") else paste0("'", as.character(admitting_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { - fields <- c(fields, "discharge_to_concept_id") - values <- c(values, if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + if (!missing(discharged_to_concept_id)) { + fields <- c(fields, "discharged_to_concept_id") + values <- c(values, if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { - fields <- c(fields, "discharge_to_source_value") - values <- c(values, if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + if (!missing(discharged_to_source_value)) { + fields <- c(fields, "discharged_to_source_value") + values <- c(values, if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } if (!missing(preceding_visit_occurrence_id)) { @@ -10810,7 +10810,7 @@ expect_no_specimen <- function(specimen_id, person_id, specimen_concept_id, spec invisible(NULL) } -expect_no_visit_detail <- function(visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_detail_end_date, visit_detail_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharge_to_source_value, discharge_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { +expect_no_visit_detail <- function(visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_detail_end_date, visit_detail_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharged_to_source_value, discharged_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { fields <- c() values <- c() if (!missing(visit_detail_id)) { @@ -10883,14 +10883,14 @@ expect_no_visit_detail <- function(visit_detail_id, person_id, visit_detail_conc values <- c(values, if (is.null(admitting_source_concept_id)) "NULL" else if (is(admitting_source_concept_id, "subQuery")) paste0("(", as.character(admitting_source_concept_id), ")") else paste0("'", as.character(admitting_source_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { - fields <- c(fields, "discharge_to_source_value") - values <- c(values, if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + if (!missing(discharged_to_source_value)) { + fields <- c(fields, "discharged_to_source_value") + values <- c(values, if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { - fields <- c(fields, "discharge_to_concept_id") - values <- c(values, if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + if (!missing(discharged_to_concept_id)) { + fields <- c(fields, "discharged_to_concept_id") + values <- c(values, if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } if (!missing(preceding_visit_detail_id)) { @@ -10913,7 +10913,7 @@ expect_no_visit_detail <- function(visit_detail_id, person_id, visit_detail_conc invisible(NULL) } -expect_no_visit_occurrence <- function(visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharge_to_concept_id, discharge_to_source_value, preceding_visit_occurrence_id) { +expect_no_visit_occurrence <- function(visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharged_to_concept_id, discharged_to_source_value, preceding_visit_occurrence_id) { fields <- c() values <- c() if (!missing(visit_occurrence_id)) { @@ -10986,14 +10986,14 @@ expect_no_visit_occurrence <- function(visit_occurrence_id, person_id, visit_con values <- c(values, if (is.null(admitting_source_value)) "NULL" else if (is(admitting_source_value, "subQuery")) paste0("(", as.character(admitting_source_value), ")") else paste0("'", as.character(admitting_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { - fields <- c(fields, "discharge_to_concept_id") - values <- c(values, if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + if (!missing(discharged_to_concept_id)) { + fields <- c(fields, "discharged_to_concept_id") + values <- c(values, if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { - fields <- c(fields, "discharge_to_source_value") - values <- c(values, if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + if (!missing(discharged_to_source_value)) { + fields <- c(fields, "discharged_to_source_value") + values <- c(values, if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } if (!missing(preceding_visit_occurrence_id)) { @@ -12785,7 +12785,7 @@ expect_count_specimen <- function(rowCount, specimen_id, person_id, specimen_con invisible(NULL) } -expect_count_visit_detail <- function(rowCount, visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_detail_end_date, visit_detail_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharge_to_source_value, discharge_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { +expect_count_visit_detail <- function(rowCount, visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_detail_end_date, visit_detail_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharged_to_source_value, discharged_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { fields <- c() values <- c() if (!missing(visit_detail_id)) { @@ -12858,14 +12858,14 @@ expect_count_visit_detail <- function(rowCount, visit_detail_id, person_id, visi values <- c(values, if (is.null(admitting_source_concept_id)) "NULL" else if (is(admitting_source_concept_id, "subQuery")) paste0("(", as.character(admitting_source_concept_id), ")") else paste0("'", as.character(admitting_source_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { - fields <- c(fields, "discharge_to_source_value") - values <- c(values, if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + if (!missing(discharged_to_source_value)) { + fields <- c(fields, "discharged_to_source_value") + values <- c(values, if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { - fields <- c(fields, "discharge_to_concept_id") - values <- c(values, if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + if (!missing(discharged_to_concept_id)) { + fields <- c(fields, "discharged_to_concept_id") + values <- c(values, if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } if (!missing(preceding_visit_detail_id)) { @@ -12889,7 +12889,7 @@ expect_count_visit_detail <- function(rowCount, visit_detail_id, person_id, visi invisible(NULL) } -expect_count_visit_occurrence <- function(rowCount, visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharge_to_concept_id, discharge_to_source_value, preceding_visit_occurrence_id) { +expect_count_visit_occurrence <- function(rowCount, visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharged_to_concept_id, discharged_to_source_value, preceding_visit_occurrence_id) { fields <- c() values <- c() if (!missing(visit_occurrence_id)) { @@ -12962,14 +12962,14 @@ expect_count_visit_occurrence <- function(rowCount, visit_occurrence_id, person_ values <- c(values, if (is.null(admitting_source_value)) "NULL" else if (is(admitting_source_value, "subQuery")) paste0("(", as.character(admitting_source_value), ")") else paste0("'", as.character(admitting_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { - fields <- c(fields, "discharge_to_concept_id") - values <- c(values, if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + if (!missing(discharged_to_concept_id)) { + fields <- c(fields, "discharged_to_concept_id") + values <- c(values, if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { - fields <- c(fields, "discharge_to_source_value") - values <- c(values, if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + if (!missing(discharged_to_source_value)) { + fields <- c(fields, "discharged_to_source_value") + values <- c(values, if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } if (!missing(preceding_visit_occurrence_id)) { @@ -15486,7 +15486,7 @@ lookup_specimen <- function(fetchField, specimen_id, person_id, specimen_concept return(statement) } -lookup_visit_detail <- function(fetchField, visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_detail_end_date, visit_detail_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharge_to_source_value, discharge_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { +lookup_visit_detail <- function(fetchField, visit_detail_id, person_id, visit_detail_concept_id, visit_detail_start_date, visit_detail_start_datetime, visit_detail_end_date, visit_detail_end_datetime, visit_detail_type_concept_id, provider_id, care_site_id, visit_detail_source_value, visit_detail_source_concept_id, admitting_source_value, admitting_source_concept_id, discharged_to_source_value, discharged_to_concept_id, preceding_visit_detail_id, visit_detail_parent_id, visit_occurrence_id) { statement <- paste0('SELECT ', fetchField , ' FROM @cdm_database_schema.visit_detail WHERE') first <- TRUE if (!missing(visit_detail_id)) { @@ -15615,22 +15615,22 @@ lookup_visit_detail <- function(fetchField, visit_detail_id, person_id, visit_de statement <- paste0(statement, " admitting_source_concept_id = ", if (is.null(admitting_source_concept_id)) "NULL" else if (is(admitting_source_concept_id, "subQuery")) paste0("(", as.character(admitting_source_concept_id), ")") else paste0("'", as.character(admitting_source_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { + if (!missing(discharged_to_source_value)) { if (first) { first <- FALSE } else { statement <- paste0(statement, " AND") } - statement <- paste0(statement, " discharge_to_source_value = ", if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + statement <- paste0(statement, " discharged_to_source_value = ", if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { + if (!missing(discharged_to_concept_id)) { if (first) { first <- FALSE } else { statement <- paste0(statement, " AND") } - statement <- paste0(statement, " discharge_to_concept_id = ", if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + statement <- paste0(statement, " discharged_to_concept_id = ", if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } if (!missing(preceding_visit_detail_id)) { @@ -15664,7 +15664,7 @@ lookup_visit_detail <- function(fetchField, visit_detail_id, person_id, visit_de return(statement) } -lookup_visit_occurrence <- function(fetchField, visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharge_to_concept_id, discharge_to_source_value, preceding_visit_occurrence_id) { +lookup_visit_occurrence <- function(fetchField, visit_occurrence_id, person_id, visit_concept_id, visit_start_date, visit_start_datetime, visit_end_date, visit_end_datetime, visit_type_concept_id, provider_id, care_site_id, visit_source_value, visit_source_concept_id, admitting_source_concept_id, admitting_source_value, discharged_to_concept_id, discharged_to_source_value, preceding_visit_occurrence_id) { statement <- paste0('SELECT ', fetchField , ' FROM @cdm_database_schema.visit_occurrence WHERE') first <- TRUE if (!missing(visit_occurrence_id)) { @@ -15793,22 +15793,22 @@ lookup_visit_occurrence <- function(fetchField, visit_occurrence_id, person_id, statement <- paste0(statement, " admitting_source_value = ", if (is.null(admitting_source_value)) "NULL" else if (is(admitting_source_value, "subQuery")) paste0("(", as.character(admitting_source_value), ")") else paste0("'", as.character(admitting_source_value), "'")) } - if (!missing(discharge_to_concept_id)) { + if (!missing(discharged_to_concept_id)) { if (first) { first <- FALSE } else { statement <- paste0(statement, " AND") } - statement <- paste0(statement, " discharge_to_concept_id = ", if (is.null(discharge_to_concept_id)) "NULL" else if (is(discharge_to_concept_id, "subQuery")) paste0("(", as.character(discharge_to_concept_id), ")") else paste0("'", as.character(discharge_to_concept_id), "'")) + statement <- paste0(statement, " discharged_to_concept_id = ", if (is.null(discharged_to_concept_id)) "NULL" else if (is(discharged_to_concept_id, "subQuery")) paste0("(", as.character(discharged_to_concept_id), ")") else paste0("'", as.character(discharged_to_concept_id), "'")) } - if (!missing(discharge_to_source_value)) { + if (!missing(discharged_to_source_value)) { if (first) { first <- FALSE } else { statement <- paste0(statement, " AND") } - statement <- paste0(statement, " discharge_to_source_value = ", if (is.null(discharge_to_source_value)) "NULL" else if (is(discharge_to_source_value, "subQuery")) paste0("(", as.character(discharge_to_source_value), ")") else paste0("'", as.character(discharge_to_source_value), "'")) + statement <- paste0(statement, " discharged_to_source_value = ", if (is.null(discharged_to_source_value)) "NULL" else if (is(discharged_to_source_value, "subQuery")) paste0("(", as.character(discharged_to_source_value), ")") else paste0("'", as.character(discharged_to_source_value), "'")) } if (!missing(preceding_visit_occurrence_id)) {