Skip to content

Commit

Permalink
Merge pull request #117 from OHDSI/unit-test-fixes
Browse files Browse the repository at this point in the history
Unit test fixes
  • Loading branch information
bradanton authored Sep 4, 2024
2 parents 24c0ec3 + 4f13b0f commit 0f720c3
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 44 deletions.
2 changes: 1 addition & 1 deletion docs/IBM_CCAE_MDCR/Test Cases/R/ConditionOccurrenceTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ createConditionOccurrenceTests <- function () {
declareTest(id = patient$person_id, "Patient has diagnosis in dx1 in ltc. Id is PERSON_ID")
add_enrollment_detail(enrolid=patient$enrolid, dtend = '2012-12-31', dtstart = '2012-01-01')
add_long_term_care(enrolid = patient$enrolid, dx1 = 'v9001', dxver = '9', svcdate = '2012-11-05', tsvcdat = '2012-11-10')
expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117', condition_type_concept_id = '38004277')
expect_condition_occurrence(person_id = patient$person_id, condition_concept_id = '46270117', condition_type_concept_id = '32844')
}

if (tolower(frameworkType) == "ccae")
Expand Down
4 changes: 2 additions & 2 deletions docs/IBM_CCAE_MDCR/Test Cases/R/ProviderTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 ="", specialty_source_value="220")
expect_provider(provider_source_value =NULL, specialty_source_value="220")
}

if (tolower(frameworkType) == "mdcd")
Expand Down Expand Up @@ -70,7 +70,7 @@ createProviderTests <- function () {
declareTest(id = provider$provid, description = "Even when PROVID IS NULL create a PROVIDER (HIX-1404)")
patient<-createPatient();
add_facility_header(enrolid=patient$enrolid, prov_id=NULL, stdprov="220")
expect_provider( provider_source_value = '', specialty_source_value="220")
expect_provider( provider_source_value = NULL, specialty_source_value="220")
}

}
6 changes: 3 additions & 3 deletions docs/JMDC/Test Cases/R/ConditionOccurrence.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ createConditionOccurrenceTests <- function () {
declareTest(707, "Condition concept ID and source values")
add_enrollment(member_id = "M000000707")
add_claim(member_id = "M000000707", claim_id = "C000000000709")
add_diagnosis(member_id = "M000000707", claim_id = "C000000000709", standard_disease_code = 1)
add_diagnosis_master(standard_disease_code = 1, icd10_level4_code = "I10-")
expect_condition_occurrence(person_id = 707, visit_occurrence_id = 709, condition_concept_id = 320128, condition_source_value = "I10-", condition_source_concept_id = 45591453)
add_diagnosis(member_id = "M000000707", claim_id = "C000000000709", standard_disease_code = 8842488, standard_disease_name = "hypertensive urgency")
add_diagnosis_master(standard_disease_code = 8842488, icd10_level4_code = "I10-")
expect_condition_occurrence(person_id = 707, visit_occurrence_id = 709, condition_concept_id = 320128, condition_source_value = "8842488|hypertensive urgency", condition_source_concept_id = 45591453)

# declareTest(708, "Condition occurrence that are era-like")
# add_enrollment(member_id = "M000000708", observation_start = "201001", observation_end = "201212")
Expand Down
90 changes: 52 additions & 38 deletions docs/Optum Clinformatics/Test Cases/R/PersonTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,43 +97,57 @@ createPersonTests <- function()
add_member_enrollment(patid = patient$patid, eligeff = '2010-03-01', eligend = '2012-12-31')
expect_person(person_id = patient$person_id, day_of_birth = NULL)

patient <- createPatient()
declareTest("PERSON - Person who has Asian race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'A')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 38003564, race_concept_id = 8515)


patient <- createPatient()
declareTest("PERSON - Person who has Black race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'B')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 38003564, race_concept_id = 8516)


patient <- createPatient()
declareTest("PERSON - Person who has White race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'W')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 38003564, race_concept_id = 8527)


patient <- createPatient()
declareTest("PERSON - Person who has Unknown race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'U')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 0, race_concept_id = 0)


patient <- createPatient()
declareTest("PERSON - Person who has Hispanic ethnicity", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'H')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 38003563, race_concept_id = 0)
patient <- createPatient()
declareTest("PERSON - Person who has Asian race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'A')
expect_person(person_id = patient$person_id, race_concept_id = 8515)


patient <- createPatient()
declareTest("PERSON - Person who has Black race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'B')
expect_person(person_id = patient$person_id, race_concept_id = 8516)


patient <- createPatient()
declareTest("PERSON - Person who has White race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'W')
expect_person(person_id = patient$person_id, race_concept_id = 8527)


patient <- createPatient()
declareTest("PERSON - Person who has Unknown race", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', race = 'U')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 0, race_concept_id = 0)


patient <- createPatient()
declareTest("PERSON - Person who has Hispanic ethnicity", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', ethnicity = 'H')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 38003563)

patient <- createPatient()
declareTest("PERSON - Person who has Not Hispanic ethnicity", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', ethnicity = 'N')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 38003564)

patient <- createPatient()
declareTest("PERSON - Person who has Not Unknown ethnicity", id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2000-05-01', eligend = '2000-12-31',
gdr_cd = 'M', patid = patient$patid, yrdob = 1987)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2000-12-31', ethnicity = 'U')
expect_person(person_id = patient$person_id, ethnicity_concept_id = 0)

}

0 comments on commit 0f720c3

Please sign in to comment.