Skip to content

Commit

Permalink
Merge branch 'master' into ibms-tests-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bradanton authored Dec 4, 2023
2 parents e516f35 + e6535f1 commit ee0b31e
Show file tree
Hide file tree
Showing 41 changed files with 31,677 additions and 14,904 deletions.
2 changes: 1 addition & 1 deletion docs/CPRD/CPRD_Additional_STEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ These concatenated source values will then be mapped to standard concepts using
| concept_id | | Map the source value (add_int.enttype + '-' + add_int.category + '-' + add_int.description + '-' + add_int.data) to a concept using the [SOURCE_TO_STANDARD_QUERY](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_STANDARD.sql) with the filters: <br><br> WHERE source_vocabulary_id = 'JNJ_CPRD_ADD_ENTTYPE' AND standard_concept = 'S' AND target_invalid_reason is NULL | |
| source_value | | Concatenate add_int.enttype + '-' + add_int.category + '-' + add_int.description + '-' + add_int.data. | This will retain the information from the entity table about the record and the specific data field being mapped. Please refer to [appendix 2](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/CPRD/Appendix_2_Additional_Table_Descriptions.xlsx) which is a table showing the enttypes and data_field descriptions from the additional table and counts of each. |
| source_concept_id | | 0 | |
| type_concept_id | | Use **32851** - Health professional filled survey |
| type_concept_id | | Use **32817** - EHR |
| unit_concept_id | | Look up add_int.unit_source_value in the CONCEPT table where vocabulary_id = 'UCUM' and standard_concept = 'S' and invalid_reason is NULL. | |
| unit_source_value | add_int.unit_source_value | | |
| start_date | add_int.eventdate | | For the additional table, the adid is used to link back to the clinical table to get the eventdate. |
Expand Down
2 changes: 1 addition & 1 deletion docs/CPRD/CPRD_Clinical_STEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Any record with one of the SARS-COV-2 read codes listed below should be mapped t
| concept_id | medcode | Use the medcode to link to the medical table to find the read code. Use the [SOURCE_TO_STANDARD](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_STANDARD.sql) query to map the read code to standard concept(s) with the following filters: <br> <br> Where source_vocabulary_id = 'Read' and Target_standard_concept = 'S' and target_invalid_reason is NULL<br><br>*BE CAREFUL - READ CODES ARE CASE SENSITIVE*. If there is no mapping available, set concept_id to zero. | See the query [CPRD_Clinical_Medcodes.sql](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/CPRD/Queries/CPRD_Clinical_Medcodes.sql) as a high-level look at the domains covered by this table and how the link to the medical table should be made. |
| source_value | medical.read_code | Use the medcode to link to the medical table to find the read code. Store read code as source_value. | |
| source_concept_id | medcode | Use the medcode to link to the medical table to find the read code. Use the [SOURCE_TO_SOURCE](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_SOURCE.sql) query to map the read code to a source concept id with the following filters:<br><br> Where source_vocabulary_id = 'Read' <br><br>*BE CAREFUL - READ CODES ARE CASE SENSITIVE*. If there is no mapping available set source_concept_id to zero. | |
| type_concept_id | | Use **32827** - EHR encounter record | |
| type_concept_id | | Use **32817** - EHR | |
4 changes: 2 additions & 2 deletions docs/CPRD/CPRD_Death.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Per CPRD cause-specific mortality is not reliably recorded in the General Practi
PERSON_ID|Patient.Patid||
DEATH_DATE|Patient.Deathdate|
DEATH_DATETIME|Set time to 00:00:00 UTC Tz||
DEATH_TYPE_CONCEPT_ID|32815 (Death Certificate)
DEATH_TYPE_CONCEPT_ID|32817 (EHR)
CAUSE_OF_DEATH_CONCEPT_ID|0||
CAUSE_OF_DEATH_SOURCE_VALUE|0||
CAUSE_SOURCE_CONCEPT_ID|0||
CAUSE_SOURCE_CONCEPT_ID|0||
2 changes: 1 addition & 1 deletion docs/CPRD/CPRD_Immunisation_STEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ In the below table, only the relevant STEM fields are shown. Any fields that do
| concept_id | medcode | Use the medcode to link to the medical table to find the read code. Use the [SOURCE_TO_STANDARD](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_STANDARD.sql) query to map the read code to standard concept(s) with the following filters: <br> <br> Where source_vocabulary_id = 'Read' and Target_standard_concept = 'S' and target_invalid_reason is NULL<br><br>*BE CAREFUL - READ CODES ARE CASE SENSITIVE*. If there is no mapping available, set concept_id to zero. | See the query [CPRD_Immunisation_Medcodes.sql](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/CPRD/Queries/CPRD_Immunisation_Medcodes.sql) as a high-level look at the domains covered by this table and how the link to the medical table should be made. |
| source_value | medical.read_code | Use the medcode to link to the medical table to find the read code. Store read code as source_value. | |
| source_concept_id | medcode | Use the medcode to link to the medical table to find the read code. Use the [SOURCE_TO_SOURCE](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_SOURCE.sql) query to map the read code to a source concept id with the following filters:<br><br> Where source_vocabulary_id = 'Read' <br><br>*BE CAREFUL - READ CODES ARE CASE SENSITIVE*. If there is no mapping available set source_concept_id to zero. | |
| type_concept_id | | Use **32827** - EHR encounter record | |
| type_concept_id | | Use **32818** - EHR administration | |
2 changes: 1 addition & 1 deletion docs/CPRD/CPRD_Referral_STEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ Any record with one of the SARS-COV-2 read codes listed below should be mapped t
| concept_id | medcode | Use the medcode to link to the medical table to find the read code. Use the [SOURCE_TO_STANDARD](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_STANDARD.sql) query to map the read code to standard concept(s) with the following filters: <br> <br> Where source_vocabulary_id = 'Read' and Target_standard_concept = 'S' and target_invalid_reason is NULL<br><br>*BE CAREFUL - READ CODES ARE CASE SENSITIVE*. If there is no mapping available, set concept_id to zero. | See [CPRD_Referral_Medcodes.sql](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/CPRD/Queries/CPRD_Referral_Medcodes.sql) for an idea of how the codes in the referral table map to the vocabulary and how the link between the referral table and medical table should be made. |
| source_value | medical.read_code | Use the medcode to link to the medical table to find the read code. Store read code as source_value. | | |
| source_concept_id | medcode | Use the medcode to link to the medical table to find the read code. Use the [SOURCE_TO_SOURCE](https://github.com/OHDSI/ETL-LambdaBuilder/blob/master/docs/Standard%20Queries/SOURCE_TO_SOURCE.sql) query to map the read code to a source concept id with the following filters:<br><br> Where source_vocabulary_id = 'Read' <br><br>*BE CAREFUL - READ CODES ARE CASE SENSITIVE*. If there is no mapping available set source_concept_id to zero. | |
| type_concept_id | | Use **32842** - EHR referral record | |
| type_concept_id | | Use **32817** - EHR | |

2 changes: 1 addition & 1 deletion docs/CPRD/CPRD_Visit_Detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For datetime fields, set time to midnight 00:00:00.
| visit_detail_start_datetime | eventdate | Use the same logic used to set visit_detail_start_date. Set time to 00:00:00 | |
| visit_detail_end_date | | Set as visit_detail_start_date | |
| visit_detail_end_datetime | | Set as visit_detail_start_datetime | |
| visit_detail_type_concept_id | | Use **32827** - EHR encounter record | |
| visit_detail_type_concept_id | | Use **32817** - EHR | |
| provider_id | staffid | | |
| care_site_id | patid | Use the last three digits of the patid (removing leading zeros) to look up the care_site_id in the care_site table. | |
| visit_detail_source_value | constype | Use the consid to link back to the consultation table. Use the constype from the consultation table as the visit_detail_source_value. If there are two based on how the visit detail was defined, choose one. | |
Expand Down
2 changes: 1 addition & 1 deletion docs/CPRD/CPRD_Visit_Occurrence.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For datetime fields, set time to midnight 00:00:00.
| visit_start_datetime | visit_detail_start_datetime | | |
| visit_end_date | visit_detail_end_date | | |
| visit_end_datetime | visit_detail_end_datetime || |
| visit_type_concept_id | | Use **32827** - EHR encounter record | |
| visit_type_concept_id | | Use **32817** - EHR | |
| provider_id | visit_detail.provider_id | Choose one provider_id if a patient saw more than one provider on the same day. | |
| care_site_id | visit_detail.care_site_id| | |
| visit_source_value | visit_detail_source_value | Choose one visit_detail_source_value for this field if a patient had more than one visit_detail_source_value on the same day. | |
Expand Down
3 changes: 2 additions & 1 deletion docs/IBM_CCAE_MDCR/Test Cases/code to run.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ executeSql(conn, paste0("TRUNCATE TABLE ",nativeDatabaseSchema,".GEOLOC; INSERT
".GEOLOC (EGEOLOC, EGEOLOC_Description, STATE) VALUES (11, 'New Jersey', 'NJ'); INSERT INTO ",
nativeDatabaseSchema,
".GEOLOC (EGEOLOC, EGEOLOC_Description, STATE) VALUES (38, 'Virginia', 'VA')"))

}

#IF TESTING CCAE YOU NEED A COPY OF HRA_QUESTON_REF, HRA_VARIABLE_REF IN YOUR RAW
if (frameworkType == "CCAE" ){
executeSql(conn, paste0("TRUNCATE TABLE ",nativeDatabaseSchema,".HRA_VARIABLE_REF;
Expand Down
5 changes: 4 additions & 1 deletion docs/OPTUM_PANTHER/Optum_Panther_Observation_Period.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: "Description for how to build the Optum Panther Observation Period

## Reading from OPTUM_EHR.Encounter

The OBSERVATION_PERIOD table should be built by setting the OBSERVATION_PERIOD_START_DATE as the date of the earliest encounter available in the data and the OBSERVATION_PERIOD_END_DATE should the the date of the latest encounter in the data.
The OBSERVATION_PERIOD table should be built by setting the OBSERVATION_PERIOD_START_DATE as the date of the earliest encounter available in the data and the OBSERVATION_PERIOD_END_DATE should the the date of the latest encounter in the data, data from the oncology module (type_concept_id=32882) should not be used in the OBSERVATION_PERIOD table creation.


| Destination Field | Source Field | Logic | Comment |
Expand All @@ -25,5 +25,8 @@ The OBSERVATION_PERIOD table should be built by setting the OBSERVATION_PERIOD_S
## Change Log
- Removed the use of *first_month_active* and *last_month_active* and changed to using the encounter dates instead

### 04-Dec-2023
- Oncology event dates excluded from the OBSERVATION PERIOD table

### 07-Aug-2023
- Cut of dates before 01-Jan-2007 rule added
5 changes: 4 additions & 1 deletion docs/Optum Clinformatics/Optum_death.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ description: "DEATH table mapping from DOD DEATH table, MEDICAL_CLAIMS and MED_D
### **Deriving date of death in DOD**

- If there are outpatient or pharmacy visits (VISIT_CONCEPT_ID in 9202, 581458) with visit start date after 30 days of death date, delete the visit record.
- If there are inpatient or ER visits (VISIT_CONCEPT_ID in 9202, 9203) with visit start date after 30 days of death date, delete the death record.
- If there are inpatient or ER visits (VISIT_CONCEPT_ID in 9201, 9203) with visit start date after 30 days of death date, delete the death record.
- If the death date occurs before the patient's date of birth, then delete the death record.
- If person is absent in **Death** table, but the fact of death is confirmed by the SES logic (see below), populate the DEATH table as well.

Expand Down Expand Up @@ -86,6 +86,9 @@ CAUSE_SOURCE_CONCEPT_ID|0||

## Change log

### 04-Dec-2024
- fixed misprint in the delete death record rule (DOD), inpatient VISIT_CONCEPT_ID 9202 -> 9201

### 11-Aug-2023

- table is revived since in CDM v5.4 the death table is present (the file was retired in intent of migration to CDM v6)
Expand Down
5 changes: 4 additions & 1 deletion docs/Optum Clinformatics/Test Cases/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ src/*.o
src/*.so
src/*.dll
/Debug
standalone/build/*
standalone/build/*

#VSCode files
.vscode/
11 changes: 6 additions & 5 deletions docs/Optum Clinformatics/Test Cases/R/CareSiteTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,35 @@ createCareSiteTests <- function()
provider <- createProvider()
declareTest("CARE_SITE - Creates a CARE_SITE entry from a record found in native provider table where prov_type is NULL.", #PASS V2.0.0.19
id = provider$provider_id)
add_provider(prov_unique = provider$provid, prov_type = NULL)
add_provider(prov_unique = provider$provid, prov_type = NULL, grp_practice = NULL, hosp_affil = NULL)
expect_care_site(care_site_id = provider$provider_id, care_site_source_value = provider$provider_id, place_of_service_concept_id = 0)


provider <- createProvider()
declareTest("CARE_SITE - Creates a CARE_SITE entry from a record found in native provider table where prov_type = 2.", #PASS V2.0.0.19
id = provider$provider_id)
add_provider(prov_unique = provider$provid, prov_type = 2)
add_provider(prov_unique = provider$provid, prov_type = 2, grp_practice = NULL, hosp_affil = NULL)
expect_care_site(care_site_id = provider$provider_id, care_site_source_value = provider$provider_id, place_of_service_concept_id = 8717)

provider <- createProvider()
declareTest("CARE_SITE - Creates a CARE_SITE entry from a record found in native provider table where prov_type = 3.", #PASS V2.0.0.19
id = provider$provider_id)
add_provider(prov_unique = provider$provid, prov_type = 3)
add_provider(prov_unique = provider$provid, prov_type = 3, grp_practice = NULL, hosp_affil = NULL)
expect_care_site(care_site_id = provider$provider_id, care_site_source_value = provider$provider_id, place_of_service_concept_id = 38004693)

provider <- createProvider()
declareTest("CARE_SITE - Creates a CARE_SITE entry from a record found in native provider table where prov_type = 4.", #PASS V2.0.0.19
id = provider$provider_id)
add_provider(prov_unique = provider$provid, prov_type = 4)
add_provider(prov_unique = provider$provid, prov_type = 4, grp_practice = NULL, hosp_affil = NULL)
expect_care_site(care_site_id = provider$provider_id, care_site_source_value = provider$provider_id, place_of_service_concept_id = 0)


patient <- createPatient()
provider <- createProvider()
claim <- createClaim()
declareTest("CARE_SITE - Creates a CARE_SITE entry from an Rx_claims record", id = provider$provider_id) #PASS V2.0.0.19
add_member_continuous_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2009-12-31', gdr_cd = 'F', yrdob = 1988)
add_member_continuous_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2009-12-31', gdr_cd = 'F', yrdob = 1988, ethnicity = NULL)
add_member_enrollment(patid = patient$patid, eligeff = '2000-05-01', eligend = '2009-12-31')
add_rx_claims(patid = patient$patid, pat_planid = patient$patid, fill_dt = '2001-01-01', clmid = claim$clmid, pharm = provider$provid)
expect_care_site(care_site_id = provider$provider_id, care_site_source_value = provider$provider_id, place_of_service_concept_id = 38004340)

Expand Down
2 changes: 2 additions & 0 deletions docs/Optum Clinformatics/Test Cases/R/ConditionEraTests.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

createConditionEraTests <- function()
{
testDiag <- '7061'
Expand All @@ -8,6 +9,7 @@ createConditionEraTests <- function()
id = patient$person_id)
add_member_continuous_enrollment(eligeff = '2010-05-01', eligend = '2013-10-31',
gdr_cd = 'F', patid = patient$patid, yrdob = 1969)
add_member_enrollment(patid = patient$patid, eligeff = '2010-05-01', eligend = '2013-10-31')

claim <- createClaim()
add_medical_claims(clmid = claim$clmid, clmseq = '001', lst_dt = '2013-07-01',
Expand Down
Loading

0 comments on commit ee0b31e

Please sign in to comment.